backend/satellite_tools/satCerts.py | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
New commits:
commit 77b45bd45c371d7e0231c5004c3463fb9d5b6c2b
Author: Pradeep Kilambi <pkilambi(a)redhat.com>
Date: Thu Apr 2 10:54:35 2009 -0400
adding some additional checks before creating first org info
diff --git a/backend/satellite_tools/satCerts.py b/backend/satellite_tools/satCerts.py
index 101c43a..f542dc0 100644
--- a/backend/satellite_tools/satCerts.py
+++ b/backend/satellite_tools/satCerts.py
@@ -544,6 +544,16 @@ def create_first_private_chan_family():
Check to see if org has a channelfamily associated with it.
If not, Create one.
"""
+ _lookup_chfam = """
+ SELECT 1 from rhnChannelFamily
+ WHERE label='private-channel-family-1'
+ """
+ h = rhnSQL.prepare(_lookup_chfam)
+ row = h.execute()
+ # some extra check for upgrades
+ if row:
+ # Already exists, move on
+ return
_query_create_chfam = """
INSERT INTO rhnChannelFamily
(id, name, label, org_id, product_url)
@@ -551,10 +561,14 @@ def create_first_private_chan_family():
"""
h = rhnSQL.prepare(_query_create_chfam)
- h.execute(name="Private Channel Family 1", \
- label="private-channel-family-1", \
- org=1, url="First Org Created")
-
+ try:
+ h.execute(name='Private Channel Family 1', \
+ label='private-channel-family-1', \
+ org=1, url='First Org Created')
+ except rhnSQL.SQLError, e:
+ # if we're here that means we're voilating something
+ raise e
+
def verify_family_permissions(orgid=1):
"""
Show replies by date