aboutsummaryrefslogtreecommitdiffstats
path: root/vicn/resource/linux/certificate.py
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2017-03-25 02:00:42 +0100
committerJordan Augé <jordan.auge+fdio@cisco.com>2017-03-25 02:02:14 +0100
commit3c7c2275b2d4660b83db9495c5f6ece5c6557b43 (patch)
treec4dbecb5b293f87714a4b456dd9f1b97593e9a2d /vicn/resource/linux/certificate.py
parent15ee4c78051f3a02b73df3171bb415cfd0326904 (diff)
Misc. improvements to vICN codebase detailed below.
- vICN core . Added python setup script (allowing package installation) . Better error handling - Resources . LXD : better handling of certificate generation . Physical : generation of SSH keypair within vICN . Link : code simplification . EmulatedLteChannel: fixed typo in netmask configuration of emu-radio (missing /) - Examples . Added json file for tutorial #2 - Dumbell . New tutorial #03 - Load balancing in WiFi/LTE hetnet - Other minor changes incl. code cleanup (trailing spaces, etc.) Change-Id: Id306ca71e27d9859aa72760f63a2bc364bfe8159 Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'vicn/resource/linux/certificate.py')
-rw-r--r--vicn/resource/linux/certificate.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/vicn/resource/linux/certificate.py b/vicn/resource/linux/certificate.py
index e8750dff..7f9b8a74 100644
--- a/vicn/resource/linux/certificate.py
+++ b/vicn/resource/linux/certificate.py
@@ -31,6 +31,8 @@ DEFAULT_SUBJECT = '/CN=www.cisco.com/L=Paris/O=Cisco/C=FR'
CMD_CREATE='\n'.join([
'# Generate a new certificate',
+ 'mkdir -p $(dirname {self.key})',
+ 'mkdir -p $(dirname {self.cert})',
'openssl req -x509 -newkey rsa:' + DEFAULT_RSA_LENGTH +
' -keyout {self.key} -out {self.cert} -subj ' + DEFAULT_SUBJECT + ' -nodes'
])
@@ -40,9 +42,6 @@ class Certificate(Resource):
Resource: Certificate
Implements a SSL certificate.
-
- Todo:
- - ideally, this should be implemented as a pair of tightly coupled files.
"""
node = Attribute(Node,
description = 'Node on which the certificate is created',
@@ -53,6 +52,10 @@ class Certificate(Resource):
key = Attribute(String, description = 'Key path',
mandatory = True)
+ #--------------------------------------------------------------------------
+ # Resource lifecycle
+ #--------------------------------------------------------------------------
+
@inline_task
def __initialize__(self):
self._cert_file = File(node = Reference(self, 'node'),