]> git-server-git.apps.pok.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>
Wed, 19 Sep 2018 19:37:02 +0000 (12:37 -0700)
Signed-off-by: Vasu Kulkarni <vasu@redhat.com>
teuthology/misc.py
teuthology/task/internal/lock_machines.py

index 59825bc9887dd583c4873985a1c4331fff0c6c48..27867921422a98759e69b9b0fbeb4d3b88d42e53 100644 (file)
@@ -22,6 +22,7 @@ import re
 import pprint
 
 from teuthology import safepath
+from teuthology.parallel import parallel
 from teuthology.exceptions import (CommandCrashedError, CommandFailedError,
                                    ConnectionLostError)
 from .orchestra import run
@@ -1277,6 +1278,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)