aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Elkins <melkins@tislabs.com>2011-04-06 18:20:51 +0000
committerMichael Elkins <melkins@tislabs.com>2011-04-06 18:20:51 +0000
commitb1462099cfc97fc48af222c5df7bf0c7c9cf5340 (patch)
tree523b40ba20c9a37dc47c8541d05b742c52559a55
parent81f2530efab0b0d7499a3bfe5510be4fdc7e2848 (diff)
make the myrpki cli ignore the ghostbuster_request table when running configure_resources
svn path=/rpkid/rpki/myrpki.py; revision=3764
-rw-r--r--rpkid/rpki/myrpki.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/rpkid/rpki/myrpki.py b/rpkid/rpki/myrpki.py
index 3773f934..c46ab0ba 100644
--- a/rpkid/rpki/myrpki.py
+++ b/rpkid/rpki/myrpki.py
@@ -909,7 +909,7 @@ class IRDB(object):
db = irdbd_cfg.get("sql-database"),
passwd = irdbd_cfg.get("sql-password"))
- def update(self, handle, roa_requests, children, ghostbusters):
+ def update(self, handle, roa_requests, children, ghostbusters=None):
"""
Update the IRDB for a given resource handle. Removes all
existing data and replaces it with that specified in the
@@ -983,10 +983,14 @@ class IRDB(object):
cur.executemany("INSERT registrant_net (start_ip, end_ip, version, registrant_id) VALUES (%s, %s, 6, %s)",
((a.min, a.max, child_id) for a in ipv6))
- cur.execute("DELETE FROM ghostbuster_request WHERE self_handle = %s", (handle,))
- if ghostbusters:
- cur.executemany("INSERT INTO ghostbuster_request (self_handle, parent_handle, vcard) VALUES (%s, %s, %s)",
- ((handle, parent_handle, vcard) for parent_handle, vcard in ghostbusters))
+ # don't munge the ghostbuster_request table when the arg is None.
+ # this allows the cli to safely run configure_resources without
+ # stomping on GBRs created by the portal gui.
+ if ghostbusters is not None:
+ cur.execute("DELETE FROM ghostbuster_request WHERE self_handle = %s", (handle,))
+ if ghostbusters:
+ cur.executemany("INSERT INTO ghostbuster_request (self_handle, parent_handle, vcard) VALUES (%s, %s, %s)",
+ ((handle, parent_handle, vcard) for parent_handle, vcard in ghostbusters))
self.db.commit()
@@ -1708,7 +1712,8 @@ class main(rpki.cli.Cmd):
rpki.resource_set.resource_set_ipv6(x.get("v6")),
rpki.sundial.datetime.fromXMLtime(x.get("valid_until"))) for x in tree.getiterator("child")]
- irdb.update(handle, roa_requests, children, [])
+ # ghostbusters are ignored for now
+ irdb.update(handle, roa_requests, children)
# Check for certificates before attempting anything else