]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: simpilfy package removal
authorSage Weil <sage@inktank.com>
Fri, 15 Feb 2013 23:39:02 +0000 (15:39 -0800)
committerSage Weil <sage@inktank.com>
Mon, 18 Feb 2013 21:39:04 +0000 (13:39 -0800)
apt-get doesn't have a nice way to tell if the package is not install and
we don't need to purge it.  Well, not one I found in 5 minutes.  Just
do a big purge and assume it works, or failed because there was nothing to
be done.

Signed-off-by: Sage Weil <sage@inktank.com>
teuthology/task/ceph.py

index fb9e3985cd85989a43486da683eaad751423b7d9..b2aa944d2911293139b6ecbfead20ecd2c1704bf 100644 (file)
@@ -237,30 +237,22 @@ def install_debs(ctx, debs, branch):
             p.spawn(_update_deb_package_list_and_install, remote, debs, branch)
 
 def _remove_deb(remote, debs):
-    for d in debs:
-        r = remote.run(
-                args=[
-                    'sudo', 'dpkg', '-l', d,
-                    ],
-                stdout=StringIO(),
-                wait=False,
-                )
-        if r.exitstatus.get() == 0:
-            remote.run(
-                    args=[
-                        'sudo', 'apt-get', '-y', '--force-yes',
-                        'purge',
-                        d,
-                        ],
-                    stdout=StringIO(),
-                )
+    args=[
+        'sudo', 'apt-get', '-y', '--force-yes', 'purge',
+        ]
+    args.extend(debs)
+    args.extend([
+            run.Raw('||'),
+            'true'
+            ])
+    remote.run(args=args)
     remote.run(
-            args=[
-                'sudo', 'apt-get', '-y', '--force-yes',
-                'autoremove',
-                ],
-            stdout=StringIO(),
-            )
+        args=[
+            'sudo', 'apt-get', '-y', '--force-yes',
+            'autoremove',
+            ],
+        stdout=StringIO(),
+        )
 
 def remove_debs(ctx, debs):
     log.info("Removing/purging debian packages {debs}".format(debs=', '.join(debs)))
@@ -287,7 +279,14 @@ def remove_sources(ctx):
 @contextlib.contextmanager
 def binaries(ctx, config):
 
-    debs = ['ceph', 'ceph-mds', 'ceph-common', 'python-ceph', 'ceph-test']
+    debs = ['ceph',
+            'ceph-mds',
+            'ceph-common',
+            'python-ceph',
+            'ceph-test',
+            'librados2',
+            'librbd1',
+            ]
     branch = config.get('branch', 'master')
     log.info('branch: {b}'.format(b=branch))
     install_debs(ctx, debs, branch)