]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add misc cleanup options before we unlock the system
authorVasu Kulkarni <vasu@redhat.com>
Thu, 31 May 2018 17:44:40 +0000 (10:44 -0700)
committerVasu Kulkarni <vasu@redhat.com>
Thu, 14 Feb 2019 20:28:12 +0000 (12:28 -0800)
Signed-off-by: Vasu Kulkarni <vasu@redhat.com>
teuthology/misc.py
teuthology/task/internal/lock_machines.py

index 2969ab9974b260e7d668e4c5111fb70bebc819b9..d459637384365e346f528913bd257233fff7cf58 100644 (file)
@@ -24,6 +24,7 @@ import pprint
 from netaddr.strategy.ipv4 import valid_str as _is_ipv4
 from netaddr.strategy.ipv6 import valid_str as _is_ipv6
 from teuthology import safepath
+from teuthology.parallel import parallel
 from teuthology.exceptions import (CommandCrashedError, CommandFailedError,
                                    ConnectionLostError)
 from .orchestra import run
@@ -1310,6 +1311,17 @@ def get_distro(ctx):
     return os_type or "ubuntu"
 
 
+def cleanup(ctx):
+    unregister_rhel_systems(ctx)
+
+
+def unregister_rhel_systems(ctx):
+    with parallel():
+        for remote in ctx.cluster.remotes.iterkeys():
+            if remote.os.name == 'rhel':
+                remote.run(args=['sudo', 'subscription-manager', 'unregister'])
+
+
 def get_distro_version(ctx):
     """
     Get the verstion of the distro that we are using (release number).
index 96b5eec632c0f77f8f4fa4a3ec978a7074041cc9..6638ffed94fe7fbb23b1cceed1a01871f41ee615 100644 (file)
@@ -150,6 +150,7 @@ def lock_machines(ctx, config):
     finally:
         # If both unlock_on_failure and nuke-on-error are set, don't unlock now
         # because we're just going to nuke (and unlock) later.
+        misc.cleanup(ctx)
         unlock_on_failure = (
             ctx.config.get('unlock_on_failure', False)
             and not ctx.config.get('nuke-on-error', False)