mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-05-06 13:23:06 +00:00
Fix W504 and remove exclusion
This is a topic where there are two points of view. While neither is fundamentally better than the other in reality, what's best is to not have any arguments about it. The tox.ini comments about 503 and 504 that were in place make the argument that: - 503 is intended to be disabled and 504 enabled by default - Donald Knuth believes 504 is the right way Since Donald Knuth is smarter than all of us, align with 504, match the comments in the file and turn on enforcement to keep it that way. Change-Id: I92d4d1e82935e30ae42a0e14e641cbe36fd6e811
This commit is contained in:
@@ -194,11 +194,15 @@ def _check_set_power_state(module, cloud, node):
|
||||
cloud.set_machine_power_off(node['uuid'])
|
||||
module.exit_json(changed=True, msg="Power requested off")
|
||||
if 'power off' in str(node['power_state']):
|
||||
if (_is_false(module.params['power']) and
|
||||
_is_false(module.params['state'])):
|
||||
if (
|
||||
_is_false(module.params['power'])
|
||||
and _is_false(module.params['state'])
|
||||
):
|
||||
return False
|
||||
if (_is_false(module.params['power']) and
|
||||
_is_false(module.params['state'])):
|
||||
if (
|
||||
_is_false(module.params['power'])
|
||||
and _is_false(module.params['state'])
|
||||
):
|
||||
module.exit_json(
|
||||
changed=False,
|
||||
msg="Power for node is %s, node must be reactivated "
|
||||
@@ -207,8 +211,10 @@ def _check_set_power_state(module, cloud, node):
|
||||
# In the event the power has been toggled on and
|
||||
# deployment has been requested, we need to skip this
|
||||
# step.
|
||||
if (_is_true(module.params['power']) and
|
||||
_is_false(module.params['deploy'])):
|
||||
if (
|
||||
_is_true(module.params['power'])
|
||||
and _is_false(module.params['deploy'])
|
||||
):
|
||||
# Node is powered down when it is not awaiting to be provisioned
|
||||
cloud.set_machine_power_on(node['uuid'])
|
||||
return True
|
||||
@@ -234,19 +240,25 @@ def main():
|
||||
module_kwargs = openstack_module_kwargs()
|
||||
module = AnsibleModule(argument_spec, **module_kwargs)
|
||||
|
||||
if (module.params['auth_type'] in [None, 'None'] and
|
||||
module.params['ironic_url'] is None):
|
||||
if (
|
||||
module.params['auth_type'] in [None, 'None']
|
||||
and module.params['ironic_url'] is None
|
||||
):
|
||||
module.fail_json(msg="Authentication appears disabled, Please "
|
||||
"define an ironic_url parameter")
|
||||
|
||||
if (module.params['ironic_url'] and
|
||||
module.params['auth_type'] in [None, 'None']):
|
||||
if (
|
||||
module.params['ironic_url']
|
||||
and module.params['auth_type'] in [None, 'None']
|
||||
):
|
||||
module.params['auth'] = dict(
|
||||
endpoint=module.params['ironic_url']
|
||||
)
|
||||
|
||||
if (module.params['config_drive'] and
|
||||
not isinstance(module.params['config_drive'], (str, dict))):
|
||||
if (
|
||||
module.params['config_drive']
|
||||
and not isinstance(module.params['config_drive'], (str, dict))
|
||||
):
|
||||
config_drive_type = type(module.params['config_drive'])
|
||||
msg = ('argument config_drive is of type %s and we expected'
|
||||
' str or dict') % config_drive_type
|
||||
|
||||
Reference in New Issue
Block a user