]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
nuke: Avoid a TypeError w/ null node description 1883/head
authorZack Cerza <zack@redhat.com>
Tue, 15 Aug 2023 18:05:38 +0000 (12:05 -0600)
committerZack Cerza <zack@redhat.com>
Tue, 15 Aug 2023 18:07:23 +0000 (12:07 -0600)
This avoids a `TypeError: argument of type 'NoneType' is not iterable`
when nuking a node whose description is None.

ex: https://sentry.ceph.com/share/issue/91172146663f4c71a6cbfe43725b2e07/

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/nuke/__init__.py

index fc498dd9a1fcf463ae8384b78e33e87d99018ec0..8a2985b9eff5aa29458fe4f923bf2e47e935cc40 100644 (file)
@@ -245,11 +245,11 @@ def nuke(ctx, should_unlock, sync_clocks=True, noipmi=False, keep_logs=False, sh
     with parallel() as p:
         for target, hostkey in ctx.config['targets'].items():
             status = get_status(target)
-            if ctx.name and ctx.name not in status.get('description', ""):
+            if ctx.name and ctx.name not in (status.get('description') or ""):
                 total_unnuked[target] = hostkey
                 log.info(
                     f"Not nuking {target} because description doesn't match: "
-                    f"{ctx.name} != {status['description']}"
+                    f"{ctx.name} != {status.get('description')}"
                 )
                 continue
             elif status.get('up') is False: