From: Zack Cerza Date: Wed, 11 Feb 2015 19:03:37 +0000 (-0700) Subject: Tweak _remove_sources_list_{deb,rpm}() X-Git-Tag: 1.1.0~1011^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F431%2Fhead;p=teuthology.git Tweak _remove_sources_list_{deb,rpm}() Make their implementations more concise, their logging more verbose, and avoid running apt-get update if no sources list was removed. Signed-off-by: Zack Cerza --- diff --git a/teuthology/task/install.py b/teuthology/task/install.py index b07491cd..204225f1 100644 --- a/teuthology/task/install.py +++ b/teuthology/task/install.py @@ -660,53 +660,37 @@ def _remove_sources_list_deb(remote, proj): """ remote.run( args=[ - 'sudo', 'rm', '-f', '/etc/apt/sources.list.d/{proj}.list'.format( + 'sudo', 'rm', '/etc/apt/sources.list.d/{proj}.list'.format( proj=proj), run.Raw('&&'), 'sudo', 'apt-get', 'update', - # ignore failure - run.Raw('||'), - 'true', ], - stdout=StringIO(), + check_status=False, ) def _remove_sources_list_rpm(remote, proj): """ - Removes /etc/yum.repos.d/{proj}.repo, /var/lib/{proj}, and /var/log/{proj}. + Removes /etc/yum.repos.d/{proj}.repo, /var/lib/{proj}, and /var/log/{proj} :param remote: the teuthology.orchestra.remote.Remote object - :param proj: the project whose sources.list needs removing + :param proj: the project whose .repo needs removing """ remote.run( - args=[ - 'sudo', 'rm', '-f', '/etc/yum.repos.d/{proj}.repo'.format( - proj=proj), - run.Raw('||'), - 'true', - ], - stdout=StringIO(), + args=['sudo', 'rm', '/etc/yum.repos.d/{proj}.repo'.format(proj=proj)], + check_status=False, ) # FIXME # There probably should be a way of removing these files that is # implemented in the yum/rpm remove procedures for the ceph package. # FIXME but why is this function doing these things? remote.run( - args=[ - 'sudo', 'rm', '-fr', '/var/lib/{proj}'.format(proj=proj), - run.Raw('||'), - 'true', - ], - stdout=StringIO(), + args=['sudo', 'rm', '-r', '/var/lib/{proj}'.format(proj=proj)], + check_status=False, ) remote.run( - args=[ - 'sudo', 'rm', '-fr', '/var/log/{proj}'.format(proj=proj), - run.Raw('||'), - 'true', - ], - stdout=StringIO(), + args=['sudo', 'rm', '-r', '/var/log/{proj}'.format(proj=proj)], + check_status=False, )