]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
[RM-16979] zypper handle ZYPPER_EXIT_INF_CAP_NOT_FOUND return code
authorOwen Synge <osynge@suse.com>
Fri, 26 Feb 2016 12:20:44 +0000 (07:20 -0500)
committerOwen Synge <osynge@suse.com>
Wed, 10 Aug 2016 11:07:17 +0000 (13:07 +0200)
When removing package(s) with zypper, that are (all) installed zypper may
succeed and return 0, but when any package(s) are not present before requesting
them to be removed zypper will return 104 on success.

The function remoto.process.run raises a "RuntimeError" exception when the
command does not return 0 in the form:

    RuntimeError("Failed to execute command: %s" % " ".join(cmd))

Hence to maintain the expected behaviour, remoto.process.check is used, and the
error code is checked, and if it does not match 0 or 104 the exception is
raised.

Signed-off-by: Owen Synge <osynge@suse.com>
ceph_deploy/util/pkg_managers.py

index 7d1ff28f269b2f97d5964064a11a91a32f3c9e68..a6a6794202221f0a344588d74711afa3b2de0308 100644 (file)
@@ -306,7 +306,15 @@ class Zypper(PackageManager):
                 extra_flags = [extra_flags]
             cmd.extend(extra_flags)
         cmd.extend(packages)
-        return self._run(cmd)
+        stdout, stderr, exitrc = remoto.process.check(
+            self.remote_conn,
+            cmd,
+            **kw
+        )
+        # exitrc is 104 when package(s) not installed.
+        if not exitrc in [0, 104]:
+            raise RuntimeError("Failed to execute command: %s" % " ".join(cmd))
+        return
 
     def clean(self):
         cmd = self.executable + ['refresh']