aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--portal-gui/rpkigui/myrpki/glue.py30
-rw-r--r--portal-gui/rpkigui/myrpki/views.py16
2 files changed, 27 insertions, 19 deletions
diff --git a/portal-gui/rpkigui/myrpki/glue.py b/portal-gui/rpkigui/myrpki/glue.py
index 009acc68..959a8da6 100644
--- a/portal-gui/rpkigui/myrpki/glue.py
+++ b/portal-gui/rpkigui/myrpki/glue.py
@@ -113,19 +113,21 @@ def configure_resources(handle):
output_asns(cfg.get('asn_csv'), handle)
output_prefixes(cfg.get('prefix_csv'), handle)
output_roas(cfg.get('roa_csv'), handle)
- run_rpkid = cfg.getboolean('run_rpkid')
- cmd = 'daemons' if run_rpkid else 'resources'
- invoke_rpki(handle.handle, ['configure_' + cmd])
- # handle the hosted case where some communication between rpkid operator
- # and resource holder is required
- if not run_rpkid:
- xml_path = cfg.get('xml_filename')
- if xml_path[0] != '/':
- # convert to full path
- xml_path = '%s/%s/%s' % (settings.MYRPKI_DATA_DIR, handle.handle, xml_path)
- # send the myrpki.xml to the rpkid hosting me
- invoke_rpki(handle.parents.all()[0].handle, ['configure_daemons', xml_path])
- # process the response
- invoke_rpki(handle.handle, ['configure_resources'])
+ run_rpkidemo = cfg.getboolean('run_rpkidemo', False)
+ if not run_rpkidemo:
+ run_rpkid = cfg.getboolean('run_rpkid')
+ cmd = 'daemons' if run_rpkid else 'resources'
+ invoke_rpki(handle.handle, ['configure_' + cmd])
+ # handle the hosted case where some communication between rpkid operator
+ # and resource holder is required
+ if not run_rpkid:
+ xml_path = cfg.get('xml_filename')
+ if xml_path[0] != '/':
+ # convert to full path
+ xml_path = '%s/%s/%s' % (settings.MYRPKI_DATA_DIR, handle.handle, xml_path)
+ # send the myrpki.xml to the rpkid hosting me
+ invoke_rpki(handle.parents.all()[0].handle, ['configure_daemons', xml_path])
+ # process the response
+ invoke_rpki(handle.handle, ['configure_resources'])
# vim:sw=4 ts=8 expandtab
diff --git a/portal-gui/rpkigui/myrpki/views.py b/portal-gui/rpkigui/myrpki/views.py
index dca9b2e6..731e7d56 100644
--- a/portal-gui/rpkigui/myrpki/views.py
+++ b/portal-gui/rpkigui/myrpki/views.py
@@ -29,6 +29,7 @@ from django.db import IntegrityError
from django import http
from django.views.generic.list_detail import object_list
from django.views.decorators.csrf import csrf_exempt
+from django.conf import settings
from rpkigui.myrpki import models, forms, glue, misc, AllocationTree
from rpkigui.myrpki.asnset import asnset
@@ -541,11 +542,16 @@ def upload_myrpki_xml(request, self_handle):
parent_handle = get_parent_handle(conf)
if request.method == 'POST':
- myrpki_xml = open('%s/%s/myrpki.xml' % (settings.MYRPKI_DATA_DIR, self_handle,), 'w')
- myrpki_xml.write(request.raw_post_data)
- myrpki_xml.close()
-
- glue.invoke_rpki(parent_handle, [ 'configure_daemons', myrpki_xml.name ])
+ try:
+ fname = '%s/%s/myrpki.xml' % (settings.MYRPKI_DATA_DIR, self_handle,)
+ print >>sys.stderr, 'writing ', fname
+ myrpki_xml = open(fname, 'w')
+ myrpki_xml.write(request.raw_post_data)
+ myrpki_xml.close()
+
+ glue.invoke_rpki(parent_handle, [ 'configure_daemons', myrpki_xml.name ])
+ except:
+ print >>sys.stderr, ''.join(sys.exc_info())
return serve_file(self_handle, 'myrpki.xml', 'application/xml')