Browse code

Allow hostname to be set to an expression as parameters to shell printf

Change-Id: Ia393e49e8c5881af26665d861240639775d781bc
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2842
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>

Danut Moraru authored on 2017/06/02 11:15:11
Showing 1 changed files
... ...
@@ -9,7 +9,8 @@ def execute(name, ks_config, config, root):
9 9
 
10 10
     if ks_config:
11 11
         if "hostname" in ks_config:
12
-            config['hostname'] = ks_config["hostname"].strip(" ")
12
+            evalhostname = os.popen('printf ' + ks_config["hostname"].strip(" ")).readlines()
13
+            config['hostname'] = evalhostname[0]
13 14
         if "hostname" not in config or config['hostname'] == "":
14 15
             random_id = '%12x' % random.randrange(16**12)
15 16
             config['hostname'] = "photon-" + random_id.strip()