From: calvinosanch Date: Sun, 13 Oct 2019 13:52:33 +0000 (+0200) Subject: inject_user_key routine fixes X-Git-Tag: v7.0.0rc1~18 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Ffeature5837;p=osm%2FRO.git inject_user_key routine fixes Change-Id: I33da18782131a14c4e195995272295db7718bb92 Signed-off-by: calvinosanch --- diff --git a/osm_ro/nfvo.py b/osm_ro/nfvo.py index 635613a9..49705004 100644 --- a/osm_ro/nfvo.py +++ b/osm_ro/nfvo.py @@ -3986,7 +3986,7 @@ def instantiate_vnf(mydb, sce_vnf, params, params_out, rollbackList): cloud_config_vm = unify_cloud_config({"key-pairs": vm["instance_parameters"]["mgmt_keys"]}, cloud_config_vm) if RO_pub_key: - cloud_config_vm = unify_cloud_config(cloud_config_vm, {"key-pairs": RO_pub_key}) + cloud_config_vm = unify_cloud_config(cloud_config_vm, {"key-pairs": [RO_pub_key]}) if vm.get("boot_data"): cloud_config_vm = unify_cloud_config(vm["boot_data"], cloud_config_vm) @@ -4796,9 +4796,14 @@ def instance_action(mydb,nfvo_tenant,instance_id, action_dict): if 'ip_address' in vm: mgmt_ip = vm['ip_address'].split(';') priv_RO_key = decrypt_key(tenant[0]['encrypted_RO_priv_key'], tenant[0]['uuid']) - myvim.inject_user_key(mgmt_ip[0], action_dict.get('user', default_user), + data = myvim.inject_user_key(mgmt_ip[0], action_dict.get('user', default_user), action_dict['add_public_key'], password=password, ro_key=priv_RO_key) + vm_result[ vm['uuid'] ] = {"vim_result": 200, + "description": "Public key injected", + "name":vm['name'] + } + except KeyError: raise NfvoException("Unable to inject ssh key in vm: {} - Aborting".format(vm['uuid']), httperrors.Internal_Server_Error) diff --git a/osm_ro/openmano_schemas.py b/osm_ro/openmano_schemas.py index b8d197ae..8fd2889b 100644 --- a/osm_ro/openmano_schemas.py +++ b/osm_ro/openmano_schemas.py @@ -1156,7 +1156,7 @@ instance_scenario_action_schema = { "reboot": { "type": ["object", "null"], }, - "add_public_key": description_schema, + "add_public_key": {"type" : "string"}, "user": nameshort_schema, "console": {"type": ["string", "null"], "enum": ["novnc", "xvpvnc", "rdp-html5", "spice-html5", None]}, "vdu-scaling": {