Browse code

Fix generic ova bug. (bug 2026247)

Change-Id: I8dac94a600a4ebe816b34ad9604233ba065cae96
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/4586
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: gerrit-photon <photon-checkins@vmware.com>

xiaolin-vmware authored on 2018/01/03 10:30:39
Showing 1 changed files
... ...
@@ -40,6 +40,7 @@ def query_yes_no(question, default="no"):
40 40
 
41 41
 def create_vmdk_and_partition(config, vmdk_path):
42 42
     partitions_data = {}
43
+
43 44
     firmware = "bios"
44 45
     if 'boot' in config and config['boot'] == 'efi':
45 46
         firmware = "efi"
... ...
@@ -47,7 +48,13 @@ def create_vmdk_and_partition(config, vmdk_path):
47 47
                                 config['size']['swap'], '-n', vmdk_path, '-fm', firmware, '-m'],
48 48
                                stdout=subprocess.PIPE)
49 49
     count = 0
50
-    for line in iter(process.stdout.readline, ''):
50
+
51
+    while True:
52
+        line = process.stdout.readline().decode()
53
+        if line == '':
54
+            retval = process.poll()
55
+            if retval is not None:
56
+                break
51 57
         sys.stdout.write(line)
52 58
         if line.startswith("DISK_DEVICE="):
53 59
             partitions_data['disk'] = line.replace("DISK_DEVICE=", "").strip()
... ...
@@ -231,7 +238,6 @@ if __name__ == '__main__':
231 231
 
232 232
             config['iso_system'] = False
233 233
             config['vmdk_install'] = True
234
-
235 234
         else:
236 235
             # Check the arguments
237 236
             if not options.configfile:
... ...
@@ -244,6 +250,7 @@ if __name__ == '__main__':
244 244
             config['vmdk_install'] = False
245 245
 
246 246
         config["pkg_to_rpm_map_file"] = options.pkg_to_rpm_map_file
247
+
247 248
         if 'password' in config:
248 249
             # crypt the password if needed
249 250
             if config['password']['crypted']: