aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--portal-gui/rpkigui/myrpki/glue.py20
-rw-r--r--portal-gui/rpkigui/myrpki/urls.py6
-rw-r--r--portal-gui/rpkigui/myrpki/views.py4
-rw-r--r--portal-gui/rpkigui/templates/myrpki/dashboard.html10
-rw-r--r--portal-gui/rpkigui/urls.py2
5 files changed, 36 insertions, 6 deletions
diff --git a/portal-gui/rpkigui/myrpki/glue.py b/portal-gui/rpkigui/myrpki/glue.py
index a8abac89..88963904 100644
--- a/portal-gui/rpkigui/myrpki/glue.py
+++ b/portal-gui/rpkigui/myrpki/glue.py
@@ -1,3 +1,5 @@
+# $Id: $
+
from __future__ import with_statement
import os
@@ -26,6 +28,7 @@ from django.conf import settings
def invoke_rpki(handle, args):
"""Invoke the myrpki cli for the specified configuration."""
config = settings.MYRPKI_DATA_DIR + '/' + handle + '/myrpki.conf'
+ # default myrpki.conf uses relative paths, so chdir() to the repo first
os.chdir(settings.MYRPKI_DATA_DIR + '/' + handle)
cmd = 'python ' + settings.MYRPKI_SRC_DIR + '/myrpki.py ' + ' '.join(['--config=' + config] + args)
print 'invoking', cmd
@@ -69,7 +72,7 @@ def output_roas(path, handle):
'%s-group-%d' % (handle.handle, r.pk)])
def configure_resources(handle):
- '''write out the .csv files and invoke the myrpki command line tool.'''
+ '''Write out the csv files and invoke the myrpki.py command line tool.'''
# chdir to the repo dir since the default myrpki.conf uses relative
# pathnames..
os.chdir(settings.MYRPKI_DATA_DIR + '/' + handle.handle)
@@ -77,6 +80,19 @@ 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)
- #invoke_rpki(handle.handle, ['configure_daemons'])
+ 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/urls.py b/portal-gui/rpkigui/myrpki/urls.py
index 2247c738..a2c5b5da 100644
--- a/portal-gui/rpkigui/myrpki/urls.py
+++ b/portal-gui/rpkigui/myrpki/urls.py
@@ -1,3 +1,5 @@
+# $Id: $
+
from django.conf.urls.defaults import *
from django.views.generic.list_detail import object_list
import views
@@ -8,8 +10,8 @@ urlpatterns = patterns('',
(r'^conf/export$', views.conf_export),
(r'^conf/list$', views.conf_list),
(r'^conf/select$', views.conf_select),
- (r'^import/parent$', views.parent_import),
- (r'^import/child$', views.child_import),
+# (r'^import/parent$', views.parent_import),
+# (r'^import/child$', views.child_import),
(r'^parent/(?P<parent_handle>[^/]+)$', views.parent_view),
(r'^child/(?P<child_handle>[^/]+)$', views.child_view),
# (r'^parent/(?P<parent_handle>[^/]+)/address$', views.parent_address),
diff --git a/portal-gui/rpkigui/myrpki/views.py b/portal-gui/rpkigui/myrpki/views.py
index 70c453c1..fef79e9a 100644
--- a/portal-gui/rpkigui/myrpki/views.py
+++ b/portal-gui/rpkigui/myrpki/views.py
@@ -1,3 +1,5 @@
+# $Id: $
+
import os
import tempfile
from django.views.generic.create_update import create_object, update_object, \
@@ -463,6 +465,7 @@ def prefix_allocate_view(request, pk):
if form.is_valid():
prefix.allocated = form.cleaned_data['child']
prefix.save()
+ glue.configure_resources(handle)
return http.HttpResponseRedirect(prefix.get_absolute_url())
else:
form = forms.PrefixAllocateForm(prefix.allocated.pk if prefix.allocated else None,
@@ -547,6 +550,7 @@ def asn_allocate_view(request, pk):
if form.is_valid():
obj.allocated = form.cleaned_data['child']
obj.save()
+ glue.configure_resources(handle)
return http.HttpResponseRedirect(obj.get_absolute_url())
else:
form = forms.PrefixAllocateForm(obj.allocated.pk if obj.allocated else None,
diff --git a/portal-gui/rpkigui/templates/myrpki/dashboard.html b/portal-gui/rpkigui/templates/myrpki/dashboard.html
index 7485c700..8abe7f82 100644
--- a/portal-gui/rpkigui/templates/myrpki/dashboard.html
+++ b/portal-gui/rpkigui/templates/myrpki/dashboard.html
@@ -37,13 +37,15 @@
{% endfor %}
</ul>
+<!--
<a href="/myrpki/import/parent">[add]</a>
+-->
</div>
<span>
<div style="border: outset">
<h1 style="text-align: center">Children</h1>
-<p>
+{% if request.session.handle.children.all %}
<ul>
{% for child in request.session.handle.children.all %}
<li><a href="/myrpki/child/{{ child.handle }}">{{ child.handle }}</a>
@@ -60,7 +62,13 @@
{% endif %}
{% endfor %}
</ul>
+<!--
<a href="/myrpki/import/child">[add]</a>
+-->
+{% else %}
+<p>-- none --
+{% endif %}
+
</div>
<div style="border: outset">
diff --git a/portal-gui/rpkigui/urls.py b/portal-gui/rpkigui/urls.py
index b5947c91..dddb6a0a 100644
--- a/portal-gui/rpkigui/urls.py
+++ b/portal-gui/rpkigui/urls.py
@@ -23,6 +23,6 @@ urlpatterns = patterns('',
#XXX
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
#{'document_root': '/Users/fenner/src/portal-gui/media/'}),
- {'document_root': '/home/me/src/rpki/portal-gui/media/'}),
+ {'document_root': '/home/melkins/src/rpki/portal-gui/media/'}),
)