summaryrefslogtreecommitdiffstats
path: root/vio
diff options
context:
space:
mode:
authorsunbin <bins@vmware.com>2018-05-22 22:00:35 +0800
committerliangke <lokyse@163.com>2018-05-31 11:57:44 +0800
commita73d35d8241aa899afca01470ad444779bbd32f5 (patch)
treead56907f3ac4fcfe69d34e90eecb26cd5deafdd5 /vio
parent6da71d2fe3e6386a55c0045d93c77fb10179e172 (diff)
Recover personality file functionv1.1.22.0.0-ONAPbeijing2.0.0-ONAP
1 VIO4.1 could inject personality file in R2 release 2 The VFC API is not clear if we deprecated personality file to use userdata or metadata. If the API finally could be suitable, Then I will update those code. Change-Id: I823ea096f3ac10d40722db55215fd4f9c6138dab Issue-ID: MULTICLOUD-227 Signed-off-by: liangke <lokyse@163.com>
Diffstat (limited to 'vio')
-rw-r--r--vio/vio/pub/vim/vimapi/nova/OperateServers.py28
1 files changed, 9 insertions, 19 deletions
diff --git a/vio/vio/pub/vim/vimapi/nova/OperateServers.py b/vio/vio/pub/vim/vimapi/nova/OperateServers.py
index 78b86ea..3075276 100644
--- a/vio/vio/pub/vim/vimapi/nova/OperateServers.py
+++ b/vio/vio/pub/vim/vimapi/nova/OperateServers.py
@@ -95,26 +95,16 @@ class OperateServers(OperateNova):
'delete_on_termination': False
}
)
- inject_files = create_req.get('contextArray', [])
+ inject_files = create_req.get("contextArray", [])
if inject_files:
- user_data = []
- strUserData = ""
- user_data.append("#cloud-config\n")
- for f in inject_files:
- user_data.append("write_files:\n")
- user_data.append("- encoding: b64\n")
- user_data.append(" content: " +
- f["source_data_base64"] + "\n")
- user_data.append(" owner: root:root\n")
- user_data.append(" path: " + f["dest_path"] + "\n")
- user_data.append(" permissions: '0644'\n")
- user_data.append("\n")
- if userdata:
- user_data.append("runcmd:\n")
- user_data.append("- " + userdata + "\n")
-
- strUserData.join(user_data)
- req["user_data"] = strUserData
+ req["personality"] = []
+ for i in inject_files:
+ req["personality"].append(
+ {
+ "path": i["dest_path"],
+ "contents": i["source_data_base64"]
+ }
+ )
return cc.create_server(**req)