diff options
author | Michael Elkins <melkins@tislabs.com> | 2011-10-07 16:05:07 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2011-10-07 16:05:07 +0000 |
commit | d8f2a9b798de2613f1cfc49f03f660dfad7aa441 (patch) | |
tree | b56335a0ffa68ddbca7a7ada402183b4c0fa62d5 /rpkid/rpki/gui/app/glue.py | |
parent | ace850d6cb78d1a2528b7a6d015d253b998b531e (diff) |
revert rev #3877 so the portal gui writes the csv files when configuring resources
svn path=/rpkid/rpki/gui/app/forms.py; revision=4022
Diffstat (limited to 'rpkid/rpki/gui/app/glue.py')
-rw-r--r-- | rpkid/rpki/gui/app/glue.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/rpkid/rpki/gui/app/glue.py b/rpkid/rpki/gui/app/glue.py index e99aa837..0664e86c 100644 --- a/rpkid/rpki/gui/app/glue.py +++ b/rpkid/rpki/gui/app/glue.py @@ -70,6 +70,10 @@ def output_roas(path, handle): '%s-group-%d' % (handle.handle, req.roa.pk)] for req in qs) w.close() +def qualify_path(pfx, fname): + """Ensure 'path' is an absolute filename.""" + return fname if fname.startswith('/') else os.path.join(pfx, fname) + def build_rpkid_caller(cfg, verbose=False): """ Returns a function suitable for calling rpkid using the @@ -126,8 +130,18 @@ def configure_resources(log, handle): holder have changed. It updates IRDB and notifies rpkid to immediately process the changes, rather than waiting for the cron job to run. + + For backwards compatability (and backups), it also writes the csv + files for use with the myrpki.py command line script. """ + path = confpath(handle.handle) + cfg = rpki.config.parser(os.path.join(path, 'rpki.conf'), 'myrpki') + + output_asns(qualify_path(path, cfg.get('asn_csv')), handle) + output_prefixes(qualify_path(path, cfg.get('prefix_csv')), handle) + output_roas(qualify_path(path, cfg.get('roa_csv')), handle) + roa_requests = [] for roa in handle.roas.all(): v4 = rpki.resource_set.roa_prefix_set_ipv4() @@ -168,7 +182,8 @@ def configure_resources(log, handle): ghostbusters.append((None, vcard)) # for hosted handles, get the config for the irdbd/rpkid host - cfg = rpki.config.parser(confpath(handle.host.handle if handle.host else handle.handle, 'rpki.conf'), 'myrpki') + if handle.host: + cfg = rpki.config.parser(confpath(handle.host.handle, 'rpki.conf'), 'myrpki') irdb = IRDB(cfg) irdb.update(handle, roa_requests, children, ghostbusters) |