From: Adam Israel Date: Fri, 14 Sep 2018 15:26:13 +0000 (-0400) Subject: Secure Key Management X-Git-Tag: v5.0.0~2 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=commitdiff_plain;h=5963cb495a42f8ca820774124db57dd4e45bec07 Secure Key Management This patchset implements the Secure Key Management feature as described in Gerrit 1429, enabling support for native charms deployed to machines provisioned by the Resource Orchestrator. - Implement GetPublicKey, which will provide the public key to be injected into new machines - Support machine placement, to provision an existing machine for use with juju - Automatically create a SSH keypair to be used for provisioning - Add method to check if a charm is deployed (CI) - Update integration tests to use new ssh key workflow Signed-off-by: Adam Israel --- diff --git a/n2vc/vnf.py b/n2vc/vnf.py index afd2501..06f1ff6 100644 --- a/n2vc/vnf.py +++ b/n2vc/vnf.py @@ -429,23 +429,14 @@ class N2VC: ######################################################## to = "" if machine_spec.keys(): - if all(k in machine_spec for k in ['hostname', 'username']): - # Get the path to the previously generated ssh private key. - # Machines we're manually provisioned must have N2VC's public - # key injected, so if we don't have a keypair, raise an error. - private_key_path = "" - - # Enlist the existing machine in Juju - machine = await self.model.add_machine( - spec='ssh:{}@{}:{}'.format( - specs['host'], - specs['user'], - private_key_path, - ) - ) - # Set the machine id that the deploy below will use. + if all(k in machine_spec for k in ['host', 'user']): + # Enlist an existing machine as a Juju unit + machine = await model.add_machine(spec='ssh:{}@{}:{}'.format( + machine_spec['user'], + machine_spec['host'], + self.GetPrivateKeyPath(), + )) to = machine.id - pass ####################################### # Get the initial charm configuration #