[elbe-devel] [PATCH v2 11/15] Change os.sytem to shellhelper::system for "updated.py"
Torben Hohn
torben.hohn at linutronix.de
Tue Jun 25 14:03:08 CEST 2019
On Mon, Jun 24, 2019 at 05:39:08PM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
Please catch exceptions here, and set return code.
>
> Signed-off-by: Olivier Dion <dion at linutronix.de>
> ---
> elbepack/updated.py | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/elbepack/updated.py b/elbepack/updated.py
> index adad4cce..343309ca 100644
> --- a/elbepack/updated.py
> +++ b/elbepack/updated.py
> @@ -35,6 +35,7 @@ from elbepack.aptprogress import (ElbeInstallProgress,
> ElbeAcquireProgress, ElbeOpProgress)
> from elbepack.egpg import unsign_file
> from elbepack.treeutils import etree
> +from elbepack.shellhelper import system
>
> downgrade_prevention_feature_available = True
> try:
> @@ -180,14 +181,14 @@ class rw_access(object):
> if self.mount_orig == 'ro':
> self.status.log("remount %s read/writeable" % self.mount)
> cmd = "mount -o remount,rw %s" % self.mount
> - os.system(cmd)
> + system(cmd)
>
> def __exit__(self, _typ, _value, _traceback):
> if self.mount_orig == 'ro':
> self.status.log("remount %s readonly" % self.mount)
> - os.system("sync")
> + system("sync")
> cmd = "mount -o remount,ro %s" % self.mount
> - ret = os.system(cmd)
> + system(cmd)
>
> def get_mount_status(self):
> with open('/etc/mtab') as mtab:
> @@ -430,7 +431,7 @@ def apply_update(fname, status):
> status.log("cleanup /var/cache/apt/archives")
> # don't use execute() here, it results in an error that the apt-cache
> # is locked. We currently don't understand this behaviour :(
> - os.system("apt-get clean")
> + system("apt-get clean")
> if p.exitcode != 0:
> raise Exception(
> "Applying update failed. See logfile for more information")
> --
> 2.11.0
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
--
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Hinweise zum Datenschutz finden Sie hier (Informations on data privacy
can be found here): https://linutronix.de/kontakt/Datenschutz.php
Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen |
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner
More information about the elbe-devel
mailing list