diff options
author | Dmitry Tantsur <dtantsur@protonmail.com> | 2020-03-30 11:37:02 +0200 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2020-03-31 13:40:00 +0000 |
commit | 1faa3397a6ae1c9d82d8f4ba90134148bc022e61 (patch) | |
tree | 24de6242cc44bf2b8d108cc7342932d41a4a0669 /ironic/conductor | |
parent | a3d7d73a69f85b396aad30610294d5ea246a0df7 (diff) | |
download | ironic-1faa3397a6ae1c9d82d8f4ba90134148bc022e61.tar.gz |
Fix the remaining hacking issues
Fixes W504 and E117, resulting in some indentation changes.
Also fixes code that exceeds the complexity requirement, that is bumped
to 20 (mostly to avoid refactoring the agent heartbeat call, resulting
in conflicts for the deploy steps work).
Change-Id: I8e49f2c039b0ddfca9138f8e148708b7e8b5df7e
Diffstat (limited to 'ironic/conductor')
-rw-r--r-- | ironic/conductor/manager.py | 48 | ||||
-rw-r--r-- | ironic/conductor/steps.py | 4 | ||||
-rw-r--r-- | ironic/conductor/task_manager.py | 4 |
3 files changed, 28 insertions, 28 deletions
diff --git a/ironic/conductor/manager.py b/ironic/conductor/manager.py index 3f595c3f1..8ba0015c7 100644 --- a/ironic/conductor/manager.py +++ b/ironic/conductor/manager.py @@ -1294,10 +1294,10 @@ class ConductorManager(base_manager.BaseConductorManager): err_handler=utils.provisioning_error_handler) return - if (action == states.VERBS['abort'] and - node.provision_state in (states.CLEANWAIT, - states.RESCUEWAIT, - states.INSPECTWAIT)): + if (action == states.VERBS['abort'] + and node.provision_state in (states.CLEANWAIT, + states.RESCUEWAIT, + states.INSPECTWAIT)): self._do_abort(task) return @@ -1513,11 +1513,11 @@ class ConductorManager(base_manager.BaseConductorManager): # NOTE(dtantsur): it's also pointless (and dangerous) to # sync power state when a power action is in progress - if (task.node.provision_state == states.ENROLL or - not task.node.maintenance or - task.node.fault != faults.POWER_FAILURE or - task.node.target_power_state or - task.node.reservation): + if (task.node.provision_state == states.ENROLL + or not task.node.maintenance + or task.node.fault != faults.POWER_FAILURE + or task.node.target_power_state + or task.node.reservation): return False return True @@ -2052,14 +2052,14 @@ class ConductorManager(base_manager.BaseConductorManager): node = task.node vif = task.driver.network.get_current_vif(task, port) if ((node.provision_state == states.ACTIVE or node.instance_uuid) - and not node.maintenance and vif): - msg = _("Cannot delete the port %(port)s as node " - "%(node)s is active or has " - "instance UUID assigned or port is bound " - "to vif %(vif)s") - raise exception.InvalidState(msg % {'node': node.uuid, - 'port': port.uuid, - 'vif': vif}) + and not node.maintenance and vif): + msg = _("Cannot delete the port %(port)s as node " + "%(node)s is active or has " + "instance UUID assigned or port is bound " + "to vif %(vif)s") + raise exception.InvalidState(msg % {'node': node.uuid, + 'port': port.uuid, + 'vif': vif}) port.destroy() LOG.info('Successfully deleted port %(port)s. ' 'The node associated with the port was %(node)s', @@ -2327,13 +2327,13 @@ class ConductorManager(base_manager.BaseConductorManager): # Only allow updating MAC addresses for active nodes if maintenance # mode is on. if ((node.provision_state == states.ACTIVE or node.instance_uuid) - and 'address' in port_obj.obj_what_changed() - and not node.maintenance): - action = _("Cannot update hardware address for port " - "%(port)s as node %(node)s is active or has " - "instance UUID assigned") - raise exception.InvalidState(action % {'node': node.uuid, - 'port': port_uuid}) + and 'address' in port_obj.obj_what_changed() + and not node.maintenance): + action = _("Cannot update hardware address for port " + "%(port)s as node %(node)s is active or has " + "instance UUID assigned") + raise exception.InvalidState(action % {'node': node.uuid, + 'port': port_uuid}) # If port update is modifying the portgroup membership of the port # or modifying the local_link_connection, pxe_enabled or physical diff --git a/ironic/conductor/steps.py b/ironic/conductor/steps.py index 490daaf98..e67f6e3bb 100644 --- a/ironic/conductor/steps.py +++ b/ironic/conductor/steps.py @@ -436,8 +436,8 @@ def _validate_user_step(task, user_step, driver_step, step_type): # NOTE(mgoddard): we'll need something a little more sophisticated to # track core steps once we split out the single core step. - is_core = (driver_step['interface'] == 'deploy' and - driver_step['step'] == 'deploy') + is_core = (driver_step['interface'] == 'deploy' + and driver_step['step'] == 'deploy') if is_core: error = (_('deploy step %(step)s on interface %(interface)s is a ' 'core step and cannot be overridden by user steps. It ' diff --git a/ironic/conductor/task_manager.py b/ironic/conductor/task_manager.py index 09aeb6c65..5fb42f247 100644 --- a/ironic/conductor/task_manager.py +++ b/ironic/conductor/task_manager.py @@ -495,8 +495,8 @@ class TaskManager(object): 'target': self.node.target_provision_state, 'previous': self._prev_provision_state}) - if (self.node.provision_state.endswith('failed') or - self.node.provision_state == 'error'): + if (self.node.provision_state.endswith('failed') + or self.node.provision_state == 'error'): LOG.error(log_message) else: LOG.info(log_message) |