add public/private key support to onboarding synchronizer
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index a27199f..511bb1b 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -79,12 +79,15 @@
('synchronizer', 'Synchronizer'),
('rest', 'REST API'),
('tosca_custom_types', 'Tosca Custom Types'),
- ('tosca_resource', 'Tosca Resource'))
+ ('tosca_resource', 'Tosca Resource'),
+ ('private_key', 'Private Key'),
+ ('public_key', 'Public Key'))
FORMAT_CHOICES = (('python', 'Python'),
('manifest', 'Manifest'),
('docker', 'Docker Container'),
- ('yaml', 'YAML'))
+ ('yaml', 'YAML'),
+ ('raw', 'raw'))
service_controller = models.ForeignKey(ServiceController, related_name='service_controller_resources',
help_text="The Service Controller this resource is associated with")
diff --git a/xos/onboard/exampleservice/exampleservice-onboard.yaml b/xos/onboard/exampleservice/exampleservice-onboard.yaml
index 82178f8..a1f8595 100644
--- a/xos/onboard/exampleservice/exampleservice-onboard.yaml
+++ b/xos/onboard/exampleservice/exampleservice-onboard.yaml
@@ -17,3 +17,4 @@
admin: admin.py
synchronizer: synchronizer/manifest
tosca_custom_types: exampleservice.yaml
+ private_key: file:///opt/xos/key_import/exampleservice_rsa
diff --git a/xos/synchronizers/onboarding/xosbuilder.py b/xos/synchronizers/onboarding/xosbuilder.py
index 9f61271..0cff2c8 100644
--- a/xos/synchronizers/onboarding/xosbuilder.py
+++ b/xos/synchronizers/onboarding/xosbuilder.py
@@ -14,7 +14,7 @@
class XOSBuilder(object):
UI_KINDS=["models", "admin", "django_library", "rest", "tosca_custom_types", "tosca_resource"]
- SYNC_CONTROLLER_KINDS=["synchronizer"]
+ SYNC_CONTROLLER_KINDS=["synchronizer", "private_key", "public_key"]
SYNC_ALLCONTROLLER_KINDS=["models", "django_library"]
def __init__(self):
@@ -32,7 +32,9 @@
"django_library": "%s/services/%s/" % (xos_base, service_name),
"synchronizer": "%s/synchronizers/%s/" % (xos_base, service_name),
"tosca_custom_types": "%s/tosca/custom_types/" % (xos_base),
- "tosca_resource": "%s/tosca/resources/" % (xos_base)}
+ "tosca_resource": "%s/tosca/resources/" % (xos_base),
+ "private_key": "%s/services/%s/keys" % (xos_base, service_name),
+ "public_key": "%s/services/%s/keys/" % (xos_base, service_name)}
return base_dirs[scr.kind]
def get_build_fn(self, scr):
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index c8c48bf..c297529 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -47,6 +47,14 @@
type: string
required: false
description: url of tosca custom_types
+ private_key:
+ type: string
+ required: false
+ description: private key
+ public_key:
+ type: string
+ required: false
+ description: public key
tosca.nodes.ServiceControllerResource:
derived_from: tosca.nodes.Root
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 0d94afa..d17b679 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -125,6 +125,14 @@
type: string
required: false
description: url of tosca custom_types
+ private_key:
+ type: string
+ required: false
+ description: private key
+ public_key:
+ type: string
+ required: false
+ description: public key
tosca.nodes.ServiceControllerResource:
derived_from: tosca.nodes.Root
diff --git a/xos/tosca/resources/servicecontroller.py b/xos/tosca/resources/servicecontroller.py
index bde588f..187dca5 100644
--- a/xos/tosca/resources/servicecontroller.py
+++ b/xos/tosca/resources/servicecontroller.py
@@ -35,4 +35,6 @@
self.postprocess_resource_prop(obj, "admin", "python")
self.postprocess_resource_prop(obj, "tosca_custom_types", "yaml")
self.postprocess_resource_prop(obj, "synchronizer", "manifest")
+ self.postprocess_resource_prop(obj, "private_key", "raw")
+ self.postprocess_resource_prop(obj, "public_key", "raw")