X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Fvnf.py;h=06f1ff69e38c77b10d762fd9dac8ce28ac967440;hp=f2d0a1e61f3bd0acfe153f1bf9087edd6376963f;hb=5963cb495a42f8ca820774124db57dd4e45bec07;hpb=bf0b8e751a1a939cafc4a16bb2bc14752077bcf8 diff --git a/n2vc/vnf.py b/n2vc/vnf.py index f2d0a1e..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 # @@ -494,11 +485,12 @@ class N2VC: # ####################################### # # Execute initial config primitive(s) # # ####################################### - await self.ExecuteInitialPrimitives( + uuids = await self.ExecuteInitialPrimitives( model_name, application_name, params, ) + return uuids # primitives = {} # @@ -893,11 +885,11 @@ class N2VC: params = {} for parameter in parameters: param = str(parameter['name']) + value = None # Typecast parameter value, if present if 'data-type' in parameter: paramtype = str(parameter['data-type']).lower() - value = None if paramtype == "integer": value = int(parameter['value'])