Browse code

Log ostreeinstall error messages.

Change-Id: I7a6c149a7a02b694fdc2d9da6c7b2a4e6d555712
Reviewed-on: http://photon-jenkins.eng.vmware.com/857
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
Reviewed-by: Sharath George

xiaolin-vmware authored on 2016/05/12 09:30:35
Showing 2 changed files
... ...
@@ -381,6 +381,11 @@ class Installer(object):
381 381
             self.progress_bar.update_loading_message(comment)
382 382
 
383 383
         modules.commons.log(modules.commons.LOG_INFO, "Installer: {} ".format(command))
384
-        process = subprocess.Popen([command], shell=True, stdout=self.output)
385
-        retval = process.wait()
386
-        return retval
384
+        process = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE)
385
+        out,err = process.communicate()
386
+        if err != None and err != 0 and "systemd-tmpfiles" not in command:
387
+            modules.commons.log(modules.commons.LOG_ERROR, "Installer: failed in {} with error code {}".format(command, err))
388
+            modules.commons.log(modules.commons.LOG_ERROR, out)
389
+            self.exit_gracefully(None, None)
390
+
391
+        return err
... ...
@@ -105,23 +105,21 @@ class OstreeInstaller(Installer):
105 105
         self.run("mkdir -p {} ".format(sysroot_boot))
106 106
         self.run("mount {}2 {}".format(disk, sysroot_boot))
107 107
 
108
-        self.progress_bar.show_loading("Unpacking local OSTree repo")
109
-
110 108
         #Setup the disk
111 109
         self.run("dd if=/dev/zero of={}/swapfile bs=1M count=64".format(self.photon_root))
110
+        self.run("chmod 600 {}/swapfile".format(self.photon_root))
112 111
         self.run("mkswap -v1 {}/swapfile".format(self.photon_root))
113 112
         self.run("swapon {}/swapfile".format(self.photon_root))
114 113
 
115 114
         if self.default_repo:
116 115
             self.run("rm -rf /installer/boot")
117 116
             self.run("mkdir -p {}/repo".format(self.photon_root))
117
+            self.progress_bar.show_loading("Unpacking local OSTree repo")
118 118
             self.run("tar --warning=none -xf /mnt/cdrom/ostree-repo.tar.gz -C {}/repo".format(self.photon_root))
119 119
             self.local_repo_path = "{}/repo".format(self.photon_root)
120 120
             self.ostree_repo_url = self.repo_config['OSTREEREPOURL']
121 121
             self.ostree_ref = self.repo_config['OSTREEREFS']
122
-
123
-
124
-        self.progress_bar.update_loading_message("Unpacking done")
122
+            self.progress_bar.update_loading_message("Unpacking done")
125 123
 
126 124
 
127 125
         self.deploy_ostree(self.ostree_repo_url, self.ostree_ref)