]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Tweak _remove_sources_list_{deb,rpm}() 431/head
authorZack Cerza <zack@redhat.com>
Wed, 11 Feb 2015 19:03:37 +0000 (12:03 -0700)
committerZack Cerza <zack@redhat.com>
Wed, 11 Feb 2015 19:39:35 +0000 (12:39 -0700)
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 <zack@redhat.com>
teuthology/task/install.py

index b07491cd0a70dedb1fa97480595855e1c5fbd0a5..204225f1f1f8265a581907377f5cd3923513569d 100644 (file)
@@ -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,
     )