X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Fvnf.py;h=9f0440538377d8c0cf0d918d3e1af6c19b13e09b;hp=a1fcfe3b60279fc32b7ab5aadb87d118e8b18f7e;hb=1ddca81e7e1863b0a7d45d1b9b9d5cabccd4e628;hpb=fa32907c02582fc105166c33c5106ccf6b9389c6;ds=sidebyside 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 #