From 27fec2377f6e690b5f5f61e718380872fafe4c91 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 15 Feb 2013 15:39:02 -0800 Subject: [PATCH] ceph: simpilfy package removal 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 --- teuthology/task/ceph.py | 47 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/teuthology/task/ceph.py b/teuthology/task/ceph.py index fb9e3985cd..b2aa944d29 100644 --- a/teuthology/task/ceph.py +++ b/teuthology/task/ceph.py @@ -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) -- 2.39.5