]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
[RM-16979] zypper remove each package separately
authorOwen Synge <osynge@suse.com>
Tue, 17 May 2016 12:44:44 +0000 (14:44 +0200)
committerOwen Synge <osynge@suse.com>
Wed, 10 Aug 2016 11:07:58 +0000 (13:07 +0200)
We ca not remove multiple packages with zypper in one line. as if a package is
not available in a repository, zypper will abort immediately rather than remove
the packages it was instructed to remove.

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

index a6a6794202221f0a344588d74711afa3b2de0308..8291503eda24ae5e6265be308c301506058ab824 100644 (file)
@@ -298,22 +298,22 @@ class Zypper(PackageManager):
     def remove(self, packages, **kw):
         if isinstance(packages, str):
             packages = [packages]
-
-        extra_flags = kw.pop('extra_remove_flags', None)
-        cmd = self.executable + ['remove']
-        if extra_flags:
-            if isinstance(extra_flags, str):
-                extra_flags = [extra_flags]
-            cmd.extend(extra_flags)
-        cmd.extend(packages)
-        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))
+        for pkg in packages:
+            extra_flags = kw.pop('extra_remove_flags', None)
+            cmd = self.executable + ['remove']
+            if extra_flags:
+                if isinstance(extra_flags, str):
+                    extra_flags = [extra_flags]
+                cmd.extend(extra_flags)
+            cmd.append(pkg)
+            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):