From: Adam Israel Date: Fri, 14 Sep 2018 15:32:35 +0000 (-0400) Subject: Full charm support X-Git-Tag: v5.0.0~7 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F6489%2F2;p=osm%2FN2VC.git Full charm support This work adds the ability to deploy charms directly to an externally instantiated VM, which is expected to have N2VC's public key injected into it, by using the VCA's manual provisioning function. This allows the VCA to ssh to the target machine and provision it. The charm will then be deployed directly to that machine, allowing the charm to fully manage the VNF lifecycle. Change-Id: I935e432fbd60a9a6bc10a499ae1b8e07c1e70c14 Signed-off-by: Adam Israel --- diff --git a/n2vc/vnf.py b/n2vc/vnf.py index a1fcfe3..9f04405 100644 --- a/n2vc/vnf.py +++ b/n2vc/vnf.py @@ -335,14 +335,23 @@ class N2VC: ######################################################## to = "" if machine_spec.keys(): - 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(), - )) + 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. to = machine.id + pass ####################################### # Get the initial charm configuration #