summaryrefslogtreecommitdiffstats
path: root/share/newton_base
diff options
context:
space:
mode:
authorHuang Haibin <haibin.huang@intel.com>2018-04-27 14:48:49 +0800
committerHaibin Huang <haibin.huang@intel.com>2018-04-28 17:40:37 +0800
commitfa1c1b60fc11d6e7155bd0fe378e63527f826bfa (patch)
treed675310574ea12a3c5e40bbc09b9498fb059d7db /share/newton_base
parentd7ba7ff30d0aef3fb4e5c7fcaafee34c5834489d (diff)
Support inject many files
Change-Id: I5e7c6ee7553b7f7e2fe0d8289d2a0c9bf4077f75 Issue-ID: MULTICLOUD-216 Signed-off-by: Haibin Huang <haibin.huang@intel.com>
Diffstat (limited to 'share/newton_base')
-rw-r--r--share/newton_base/openoapi/server.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/share/newton_base/openoapi/server.py b/share/newton_base/openoapi/server.py
index 29823432..ba77dc55 100644
--- a/share/newton_base/openoapi/server.py
+++ b/share/newton_base/openoapi/server.py
@@ -367,24 +367,21 @@ class Servers(APIView):
strUserData = ''
source_content = ""
dest_path = ""
+ user_data.append("#cloud-config\n")
for context in contextarray:
- if context["fileName"] == "source_path":
- source_content = context["fileData"]
- if context["fileName"] == "dest_path":
- dest_path = context["fileData"]
- if len(source_content) > 0:
- user_data.append("#cloud-config\n")
user_data.append("write_files:\n")
user_data.append("- encoding: b64\n")
- user_data.append(" content: " + source_content + "\n")
+ user_data.append(" content: " + context["source_data_base64"] + "\n")
user_data.append(" owner: root:root\n")
- user_data.append(" path: " + dest_path + "\n")
+ user_data.append(" path: " + context["dest_path"] + "\n")
user_data.append(" permissions: '0644'\n")
user_data.append("\n")
- user_data.append("runcmd:")
+ if userdata:
+ user_data.append("runcmd:\n")
user_data.append("- " + userdata + "\n")
- strUserData.join(user_data)
- server["user_data"] = user_data
+
+ strUserData.join(user_data)
+ server["user_data"] = strUserData
VimDriverUtils.replace_key_by_mapping(server,
self.keys_mapping, True)