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>
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()))
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)