]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: avoid redundant call to cache.get_scheduled_daemon_action
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 9 Mar 2026 19:08:44 +0000 (15:08 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 26 Mar 2026 13:31:38 +0000 (09:31 -0400)
Avoid a redundant call to cache.get_scheduled_daemon_action by
saving the call result in two variables at the first call site.
One var may be changed but the other will retain the original
value until it is checked again later.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/cephadm/serve.py

index b3e970273d7336e7b2347edff3bdb20b56fcfaac..ecc3ce91d7329afad027f11d125596805aada0b7 100644 (file)
@@ -1152,7 +1152,11 @@ class CephadmServe:
                 dd.hostname, dd.name())
             if last_deps is None:
                 last_deps = []
-            action = self.mgr.cache.get_scheduled_daemon_action(dd.hostname, dd.name())
+            action = scheduled_action = (
+                self.mgr.cache.get_scheduled_daemon_action(
+                    dd.hostname, dd.name()
+                )
+            )
             if not last_config:
                 self.log.info('Reconfiguring %s (unknown last config time)...' % (
                     dd.name()))
@@ -1209,8 +1213,7 @@ class CephadmServe:
                 action = 'reconfig'
 
             if action:
-                if self.mgr.cache.get_scheduled_daemon_action(dd.hostname, dd.name()) == 'redeploy' \
-                        and action == 'reconfig':
+                if scheduled_action == 'redeploy' and action == 'reconfig':
                     action = 'redeploy'
                 try:
                     daemon_spec = CephadmDaemonDeploySpec.from_daemon_description(dd)