From 73e67caaaaaf7da0b64c51fbf6ba821e14d219c2 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 11 Feb 2015 12:03:37 -0700 Subject: [PATCH] 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 --- teuthology/task/install.py | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) 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, ) -- 2.47.3