From 15cbc922087f60a6e8a5e1df5491b021c2bbc4f7 Mon Sep 17 00:00:00 2001 From: "Carl D. Roth" Date: Wed, 30 Nov 2016 18:23:17 -0800 Subject: [PATCH 1/4] Handle failed installs --- .../vendor-config-onl/src/python/onl/install/SystemInstall.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/install/SystemInstall.py b/packages/base/all/vendor-config-onl/src/python/onl/install/SystemInstall.py index b8c353a7..25d51928 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/install/SystemInstall.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/install/SystemInstall.py @@ -32,7 +32,8 @@ class UpgradeHelper(Upgrader): def _runInitrdShell(self, p): if self.callback is not None: - self.callback(self, p) + return self.callback(self, p) + return 0 class App(SubprocessMixin): From 8bee5e779695c51169251e95a78726b4d4ceee8a Mon Sep 17 00:00:00 2001 From: "Carl D. Roth" Date: Wed, 30 Nov 2016 18:23:34 -0800 Subject: [PATCH 2/4] Refactor the unmount part of the initrd context shutdown --- .../src/python/onl/install/InstallUtils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/install/InstallUtils.py b/packages/base/all/vendor-config-onl/src/python/onl/install/InstallUtils.py index 685f703d..c7d3ee14 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/install/InstallUtils.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/install/InstallUtils.py @@ -834,7 +834,7 @@ class InitrdContext(SubprocessMixin): return self - def shutdown(self): + def unmount(self): p = ProcMountsParser() if self.dir is not None: @@ -852,6 +852,10 @@ class InitrdContext(SubprocessMixin): cmd = ('umount', p,) self.check_call(cmd, vmode=self.V1) + def shutdown(self): + + self.unmount() + if self.initrd and self.dir: self.log.debug("cleaning up chroot in %s", self.dir) self.rmtree(self.dir) From 271434a71cbd6746f72cb622f3442eb82a7c7030 Mon Sep 17 00:00:00 2001 From: "Carl D. Roth" Date: Wed, 30 Nov 2016 18:23:58 -0800 Subject: [PATCH 3/4] Oops, unmount the contents of this (temporary) onie boot context --- .../all/vendor-config-onl/src/python/onl/install/App.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/install/App.py b/packages/base/all/vendor-config-onl/src/python/onl/install/App.py index 3cc220f8..69b83f8f 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/install/App.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/install/App.py @@ -168,6 +168,12 @@ class App(SubprocessMixin, object): ##self.grubEnv = ConfUtils.GrubEnv(log=self.log.getChild("grub")) with OnieBootContext(log=self.log) as self.octx: + + self.octx.ictx.attach() + self.octx.ictx.unmount() + self.octx.ictx.detach() + # XXX roth -- here, detach the initrd mounts + self.octx.detach() if self.octx.onieDir is not None: From 0f2b922be8e5c30576fb972960572ebf3281b212 Mon Sep 17 00:00:00 2001 From: "Carl D. Roth" Date: Wed, 30 Nov 2016 18:24:32 -0800 Subject: [PATCH 4/4] attach, then shutdown, the internal components --- .../src/python/onl/install/ShellApp.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/install/ShellApp.py b/packages/base/all/vendor-config-onl/src/python/onl/install/ShellApp.py index 934d40a3..e3a5e505 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/install/ShellApp.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/install/ShellApp.py @@ -189,11 +189,20 @@ class OnieBootContext: def shutdown(self): ctx, self.fctx = self.fctx, None - if ctx is not None: ctx.shutdown() + if ctx is not None: + ctx.shutdown() + ctx.attach() + ctx.shutdown() ctx, self.ictx = self.ictx, None - if ctx is not None: ctx.shutdown() + if ctx is not None: + ctx.shutdown() + ctx.attach() + ctx.shutdown() ctx, self.dctx = self.dctx, None - if ctx is not None: ctx.shutdown() + if ctx is not None: + ctx.shutdown() + ctx.attach() + ctx.shutdown() def __exit__(self, eType, eValue, eTrace): self.shutdown()