backend/satellite_tools/satCerts.py | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
New commits:
commit 6770e3b00584dedb5dfe84a90c488fb97ef1c506
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 1327ac3..5d05cad 100644
--- a/backend/satellite_tools/satCerts.py
+++ b/backend/satellite_tools/satCerts.py
@@ -543,6 +543,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)
@@ -550,10 +560,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
+
if __name__ == '__main__':
from common import initCFG, CFG