summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2017-02-24 16:49:43 -0600
committerGitHub <noreply@github.com>2017-02-24 16:49:43 -0600
commit305c88700de7fc17de80b2f58fb6d44180573e61 (patch)
tree7dc877c4c4d6d4d20aba3b8b240c5997ec4475e0
parent5d39056379c33e6a8e4f8a7bc837517f271a5495 (diff)
downloadansible-305c88700de7fc17de80b2f58fb6d44180573e61.tar.gz
PEP8 E712 fixes (#21916)
-rw-r--r--lib/ansible/module_utils/basic.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/ec2_elb_lb.py8
-rw-r--r--lib/ansible/modules/cloud/amazon/ec2_eni.py6
-rw-r--r--lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py2
-rw-r--r--lib/ansible/modules/cloud/amazon/rds.py2
-rw-r--r--lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py4
-rw-r--r--lib/ansible/modules/cloud/docker/_docker.py2
-rw-r--r--lib/ansible/modules/cloud/softlayer/sl_vm.py2
-rw-r--r--lib/ansible/modules/cloud/vmware/vca_fw.py2
-rw-r--r--lib/ansible/modules/cloud/vmware/vsphere_guest.py2
-rw-r--r--lib/ansible/modules/database/postgresql/postgresql_privs.py2
-rw-r--r--lib/ansible/modules/monitoring/boundary_meter.py2
-rw-r--r--lib/ansible/modules/network/a10/a10_server_axapi3.py2
-rw-r--r--lib/ansible/modules/network/nxos/nxos_install_os.py2
-rw-r--r--lib/ansible/modules/network/nxos/nxos_pim_interface.py2
-rw-r--r--lib/ansible/modules/network/nxos/nxos_vpc.py4
-rw-r--r--lib/ansible/modules/network/snmp_facts.py2
-rw-r--r--lib/ansible/modules/packaging/os/openbsd_pkg.py4
-rw-r--r--lib/ansible/modules/packaging/os/swdepot.py6
-rw-r--r--lib/ansible/modules/system/filesystem.py4
-rw-r--r--lib/ansible/modules/system/firewalld.py56
-rw-r--r--lib/ansible/modules/system/gluster_volume.py6
-rw-r--r--lib/ansible/modules/system/group.py12
-rw-r--r--lib/ansible/modules/system/known_hosts.py52
-rw-r--r--lib/ansible/modules/system/locale_gen.py2
-rw-r--r--lib/ansible/modules/system/user.py2
-rw-r--r--lib/ansible/modules/web_infrastructure/jenkins_job.py4
-rw-r--r--lib/ansible/plugins/connection/ssh.py2
-rw-r--r--lib/ansible/plugins/filter/ipaddr.py2
-rw-r--r--lib/ansible/plugins/lookup/dig.py2
-rw-r--r--lib/ansible/plugins/lookup/dnstxt.py2
-rw-r--r--lib/ansible/utils/module_docs.py2
-rw-r--r--test/sanity/pep8/legacy-files.txt19
-rw-r--r--test/sanity/pep8/legacy-ignore.txt1
34 files changed, 103 insertions, 123 deletions
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py
index fd52bac3b3..e556b0bcff 100644
--- a/lib/ansible/module_utils/basic.py
+++ b/lib/ansible/module_utils/basic.py
@@ -1718,7 +1718,7 @@ class AnsibleModule(object):
def _set_defaults(self, pre=True):
for (k,v) in self.argument_spec.items():
default = v.get('default', None)
- if pre == True:
+ if pre is True:
# this prevents setting defaults on required items
if default is not None and k not in self.params:
self.params[k] = default
diff --git a/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py b/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py
index 489c5477ad..e3986bc9fa 100644
--- a/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py
@@ -1033,7 +1033,7 @@ class ElbManager(object):
policy = []
policy_type = 'LBCookieStickinessPolicyType'
- if self.module.boolean(self.stickiness['enabled']) == True:
+ if self.module.boolean(self.stickiness['enabled']) is True:
if 'expiration' not in self.stickiness:
self.module.fail_json(msg='expiration must be set when type is loadbalancer')
@@ -1050,7 +1050,7 @@ class ElbManager(object):
policy.append(self._policy_name(policy_attrs['type']))
self._set_stickiness_policy(elb_info, listeners_dict, policy, **policy_attrs)
- elif self.module.boolean(self.stickiness['enabled']) == False:
+ elif self.module.boolean(self.stickiness['enabled']) is False:
if len(elb_info.policies.lb_cookie_stickiness_policies):
if elb_info.policies.lb_cookie_stickiness_policies[0].policy_name == self._policy_name(policy_type):
self.changed = True
@@ -1062,7 +1062,7 @@ class ElbManager(object):
elif self.stickiness['type'] == 'application':
policy = []
policy_type = 'AppCookieStickinessPolicyType'
- if self.module.boolean(self.stickiness['enabled']) == True:
+ if self.module.boolean(self.stickiness['enabled']) is True:
if 'cookie' not in self.stickiness:
self.module.fail_json(msg='cookie must be set when type is application')
@@ -1076,7 +1076,7 @@ class ElbManager(object):
}
policy.append(self._policy_name(policy_attrs['type']))
self._set_stickiness_policy(elb_info, listeners_dict, policy, **policy_attrs)
- elif self.module.boolean(self.stickiness['enabled']) == False:
+ elif self.module.boolean(self.stickiness['enabled']) is False:
if len(elb_info.policies.app_cookie_stickiness_policies):
if elb_info.policies.app_cookie_stickiness_policies[0].policy_name == self._policy_name(policy_type):
self.changed = True
diff --git a/lib/ansible/modules/cloud/amazon/ec2_eni.py b/lib/ansible/modules/cloud/amazon/ec2_eni.py
index a00b168f9a..6a2e4f62a4 100644
--- a/lib/ansible/modules/cloud/amazon/ec2_eni.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_eni.py
@@ -316,7 +316,7 @@ def create_eni(connection, vpc_id, module):
eni = find_eni(connection, module)
if eni is None:
eni = connection.create_network_interface(subnet_id, private_ip_address, description, security_groups)
- if attached == True and instance_id is not None:
+ if attached is True and instance_id is not None:
try:
eni.attach(instance_id, device_index)
except BotoServerError:
@@ -399,14 +399,14 @@ def modify_eni(connection, vpc_id, module, eni):
secondary_addresses_to_remove_count = current_secondary_address_count - secondary_private_ip_address_count
connection.unassign_private_ip_addresses(network_interface_id=eni.id, private_ip_addresses=current_secondary_addresses[:secondary_addresses_to_remove_count], dry_run=False)
- if attached == True:
+ if attached is True:
if eni.attachment and eni.attachment.instance_id != instance_id:
detach_eni(eni, module)
if eni.attachment is None:
eni.attach(instance_id, device_index)
wait_for_eni(eni, "attached")
changed = True
- elif attached == False:
+ elif attached is False:
detach_eni(eni, module)
except BotoServerError as e:
diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py
index 95c9af9f55..58b2ca07d0 100644
--- a/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py
@@ -448,7 +448,7 @@ def find_default_vpc_nacl(vpc_id, client, module):
except botocore.exceptions.ClientError as e:
module.fail_json(msg=str(e))
nacls = response['NetworkAcls']
- return [n['NetworkAclId'] for n in nacls if n['IsDefault'] == True]
+ return [n['NetworkAclId'] for n in nacls if n['IsDefault'] is True]
def find_subnet_ids_by_nacl_id(nacl_id, client, module):
diff --git a/lib/ansible/modules/cloud/amazon/rds.py b/lib/ansible/modules/cloud/amazon/rds.py
index 232b952b8d..f29942168f 100644
--- a/lib/ansible/modules/cloud/amazon/rds.py
+++ b/lib/ansible/modules/cloud/amazon/rds.py
@@ -1005,7 +1005,7 @@ def validate_parameters(required_vars, valid_vars, module):
if k in valid_vars:
params[v] = module.params[k]
else:
- if module.params.get(k) == False:
+ if module.params.get(k) is False:
pass
else:
module.fail_json(msg="Parameter %s is not valid for %s command" % (k, command))
diff --git a/lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py b/lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py
index 1af5b5e2f8..87fbf38ded 100644
--- a/lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py
+++ b/lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py
@@ -805,7 +805,7 @@ class ClcLoadBalancer:
if not node in nodes:
changed = True
nodes.append(node)
- if changed == True and not self.module.check_mode:
+ if changed is True and not self.module.check_mode:
result = self.set_loadbalancernodes(
alias,
location,
@@ -836,7 +836,7 @@ class ClcLoadBalancer:
if node in nodes:
changed = True
nodes.remove(node)
- if changed == True and not self.module.check_mode:
+ if changed is True and not self.module.check_mode:
result = self.set_loadbalancernodes(
alias,
location,
diff --git a/lib/ansible/modules/cloud/docker/_docker.py b/lib/ansible/modules/cloud/docker/_docker.py
index 4bad2b246b..f48fe6c28a 100644
--- a/lib/ansible/modules/cloud/docker/_docker.py
+++ b/lib/ansible/modules/cloud/docker/_docker.py
@@ -623,7 +623,7 @@ def normalize_image(image):
def is_running(container):
'''Return True if an inspected container is in a state we consider "running."'''
- return container['State']['Running'] == True and not container['State'].get('Ghost', False)
+ return container['State']['Running'] is True and not container['State'].get('Ghost', False)
def get_docker_py_versioninfo():
diff --git a/lib/ansible/modules/cloud/softlayer/sl_vm.py b/lib/ansible/modules/cloud/softlayer/sl_vm.py
index 63c5ebe5d7..26520571f9 100644
--- a/lib/ansible/modules/cloud/softlayer/sl_vm.py
+++ b/lib/ansible/modules/cloud/softlayer/sl_vm.py
@@ -383,7 +383,7 @@ def main():
elif module.params.get('state') == 'present':
(changed, instance) = create_virtual_instance(module)
- if module.params.get('wait') == True and instance:
+ if module.params.get('wait') is True and instance:
(changed, instance) = wait_for_instance(module, instance['id'])
module.exit_json(changed=changed, instance=json.loads(json.dumps(instance, default=lambda o: o.__dict__)))
diff --git a/lib/ansible/modules/cloud/vmware/vca_fw.py b/lib/ansible/modules/cloud/vmware/vca_fw.py
index fd63a4a06c..623b6b3bda 100644
--- a/lib/ansible/modules/cloud/vmware/vca_fw.py
+++ b/lib/ansible/modules/cloud/vmware/vca_fw.py
@@ -231,7 +231,7 @@ def main():
gateway.delete_fw_rule(**kwargs)
result['changed'] = True
- if not module.check_mode and result['changed'] == True:
+ if not module.check_mode and result['changed'] is True:
task = gateway.save_services_configuration()
if task:
vca.block_until_completed(task)
diff --git a/lib/ansible/modules/cloud/vmware/vsphere_guest.py b/lib/ansible/modules/cloud/vmware/vsphere_guest.py
index e444b361dd..fcef295155 100644
--- a/lib/ansible/modules/cloud/vmware/vsphere_guest.py
+++ b/lib/ansible/modules/cloud/vmware/vsphere_guest.py
@@ -762,7 +762,7 @@ def deploy_template(vsphere_client, guest, resource_pool, template_src, esxi, mo
vm.set_extra_config(vm_extra_config)
# Power on if asked
- if power_on_after_clone == True:
+ if power_on_after_clone is True:
state = 'powered_on'
power_state(vm, state, True)
diff --git a/lib/ansible/modules/database/postgresql/postgresql_privs.py b/lib/ansible/modules/database/postgresql/postgresql_privs.py
index 5e82dfb8a3..9f0c65977b 100644
--- a/lib/ansible/modules/database/postgresql/postgresql_privs.py
+++ b/lib/ansible/modules/database/postgresql/postgresql_privs.py
@@ -534,7 +534,7 @@ class Connection(object):
self.cursor.execute(query % (set_what, for_whom))
# Only revoke GRANT/ADMIN OPTION if grant_option actually is False.
- if grant_option == False:
+ if grant_option is False:
if obj_type == 'group':
query = 'REVOKE ADMIN OPTION FOR %s FROM %s'
else:
diff --git a/lib/ansible/modules/monitoring/boundary_meter.py b/lib/ansible/modules/monitoring/boundary_meter.py
index e4d635fb24..6a5d135937 100644
--- a/lib/ansible/modules/monitoring/boundary_meter.py
+++ b/lib/ansible/modules/monitoring/boundary_meter.py
@@ -173,7 +173,7 @@ def create_meter(module, name, apiid, apikey):
except IOError:
# Now download the file...
rc = download_request(module, name, apiid, apikey, cert_type)
- if rc == False:
+ if rc is False:
module.fail_json("Download request for " + cert_type + ".pem failed")
return 0, "Meter " + name + " created"
diff --git a/lib/ansible/modules/network/a10/a10_server_axapi3.py b/lib/ansible/modules/network/a10/a10_server_axapi3.py
index 26646286e8..07a52bda58 100644
--- a/lib/ansible/modules/network/a10/a10_server_axapi3.py
+++ b/lib/ansible/modules/network/a10/a10_server_axapi3.py
@@ -204,7 +204,7 @@ def main():
changed = False
if operation == 'create':
- if slb_server_exists == False:
+ if slb_server_exists is False:
result = axapi_call_v3(module, axapi_base_url+'slb/server/', method='POST', body=json.dumps(json_post), signature=signature)
if axapi_failure(result):
module.fail_json(msg="failed to create the server: %s" % result['response']['err']['msg'])
diff --git a/lib/ansible/modules/network/nxos/nxos_install_os.py b/lib/ansible/modules/network/nxos/nxos_install_os.py
index 8f489e1b45..5f9a621241 100644
--- a/lib/ansible/modules/network/nxos/nxos_install_os.py
+++ b/lib/ansible/modules/network/nxos/nxos_install_os.py
@@ -210,7 +210,7 @@ def main():
kickstart_image_file):
changed = True
- if not module.check_mode and changed == True:
+ if not module.check_mode and changed is True:
set_boot_options(module,
system_image_file,
kickstart=kickstart_image_file)
diff --git a/lib/ansible/modules/network/nxos/nxos_pim_interface.py b/lib/ansible/modules/network/nxos/nxos_pim_interface.py
index 4db51f94be..4f1df756f0 100644
--- a/lib/ansible/modules/network/nxos/nxos_pim_interface.py
+++ b/lib/ansible/modules/network/nxos/nxos_pim_interface.py
@@ -680,7 +680,7 @@ def main():
commands.append(defaults)
elif state == 'absent':
- if existing.get('sparse') == True:
+ if existing.get('sparse') is True:
delta['sparse'] = False
# defaults is a list of commands
defaults = config_pim_interface_defaults(existing, jp_bidir, isauth)
diff --git a/lib/ansible/modules/network/nxos/nxos_vpc.py b/lib/ansible/modules/network/nxos/nxos_vpc.py
index 9e243d8ae7..c049a6c136 100644
--- a/lib/ansible/modules/network/nxos/nxos_vpc.py
+++ b/lib/ansible/modules/network/nxos/nxos_vpc.py
@@ -300,12 +300,12 @@ def get_commands_to_config_vpc(module, vpc, domain, existing):
' source {1} vrf {2}'.format(pkl_dest, pkl_src, pkl_vrf))
commands.append(pkl_command)
- if vpc.get('auto_recovery') == False:
+ if vpc.get('auto_recovery') is False:
vpc['auto_recovery'] = 'no'
else:
vpc['auto_recovery'] = ''
- if vpc.get('peer_gw') == False:
+ if vpc.get('peer_gw') is False:
vpc['peer_gw'] = 'no'
else:
vpc['peer_gw'] = ''
diff --git a/lib/ansible/modules/network/snmp_facts.py b/lib/ansible/modules/network/snmp_facts.py
index fe16f5c1e6..e93fd2b028 100644
--- a/lib/ansible/modules/network/snmp_facts.py
+++ b/lib/ansible/modules/network/snmp_facts.py
@@ -209,7 +209,7 @@ def main():
# Verify that we receive a community when using snmp v2
if m_args['version'] == "v2" or m_args['version'] == "v2c":
- if m_args['community'] == False:
+ if m_args['community'] is False:
module.fail_json(msg='Community not set when using snmp version 2')
if m_args['version'] == "v3":
diff --git a/lib/ansible/modules/packaging/os/openbsd_pkg.py b/lib/ansible/modules/packaging/os/openbsd_pkg.py
index 85e4d9a6d5..527578bd3d 100644
--- a/lib/ansible/modules/packaging/os/openbsd_pkg.py
+++ b/lib/ansible/modules/packaging/os/openbsd_pkg.py
@@ -302,7 +302,7 @@ def package_latest(names, pkg_spec, module):
# parse out a successful update above. This way we will report a
# successful run when we actually modify something but fail
# otherwise.
- if pkg_spec[name]['changed'] != True:
+ if pkg_spec[name]['changed'] is not True:
if pkg_spec[name]['stderr']:
pkg_spec[name]['rc'] = 1
@@ -614,7 +614,7 @@ def main():
else:
combined_error_message = pkg_spec[n]['stdout']
- if pkg_spec[n]['changed'] == True:
+ if pkg_spec[n]['changed'] is True:
combined_changed = True
# If combined_error_message contains anything at least some part of the
diff --git a/lib/ansible/modules/packaging/os/swdepot.py b/lib/ansible/modules/packaging/os/swdepot.py
index 2b88c985cb..4ea494c213 100644
--- a/lib/ansible/modules/packaging/os/swdepot.py
+++ b/lib/ansible/modules/packaging/os/swdepot.py
@@ -155,7 +155,7 @@ def main():
else:
installed = False
- if ( state == 'present' or state == 'latest' ) and installed == False:
+ if ( state == 'present' or state == 'latest' ) and installed is False:
if module.check_mode:
module.exit_json(changed=True)
rc, output = install_package(module, depot, name)
@@ -167,7 +167,7 @@ def main():
else:
module.fail_json(name=name, msg=output, rc=rc)
- elif state == 'latest' and installed == True:
+ elif state == 'latest' and installed is True:
#Check depot version
rc, version_depot = query_package(module, name, depot)
@@ -189,7 +189,7 @@ def main():
output = "Software package not in repository " + depot
module.fail_json(name=name, msg=output, rc=rc)
- elif state == 'absent' and installed == True:
+ elif state == 'absent' and installed is True:
if module.check_mode:
module.exit_json(changed=True)
rc, output = remove_package(module, name)
diff --git a/lib/ansible/modules/system/filesystem.py b/lib/ansible/modules/system/filesystem.py
index d49360f09b..cd3cd6daa6 100644
--- a/lib/ansible/modules/system/filesystem.py
+++ b/lib/ansible/modules/system/filesystem.py
@@ -208,9 +208,9 @@ def main():
rc,raw_fs,err = module.run_command("%s -c /dev/null -o value -s TYPE %s" % (cmd, dev))
fs = raw_fs.strip()
- if fs == fstype and resizefs == False and not force:
+ if fs == fstype and resizefs is False and not force:
module.exit_json(changed=False)
- elif fs == fstype and resizefs == True:
+ elif fs == fstype and resizefs is True:
# Get dev and fs size and compare
devsize_in_bytes = _get_dev_size(dev, module)
fssize_in_bytes = _get_fs_size(fssize_cmd, dev, module)
diff --git a/lib/ansible/modules/system/firewalld.py b/lib/ansible/modules/system/firewalld.py
index b4651ba0b4..05486fe23d 100644
--- a/lib/ansible/modules/system/firewalld.py
+++ b/lib/ansible/modules/system/firewalld.py
@@ -211,14 +211,14 @@ def update_fw_settings(fw_zone, fw_settings):
# masquerade handling
#
def get_masquerade_enabled(zone):
- if fw.queryMasquerade(zone) == True:
+ if fw.queryMasquerade(zone) is True:
return True
else:
return False
def get_masquerade_enabled_permanent(zone):
fw_zone, fw_settings = get_fw_zone_settings(zone)
- if fw_settings.getMasquerade() == True:
+ if fw_settings.getMasquerade() is True:
return True
else:
return False
@@ -507,7 +507,7 @@ def main():
## Check for firewalld running
try:
- if fw.connected == False:
+ if fw.connected is False:
module.fail_json(msg='firewalld service must be running, or try with offline=true')
except AttributeError:
module.fail_json(msg="firewalld connection can't be established,\
@@ -623,7 +623,7 @@ def main():
msgs.append('Permanent operation')
if desired_state == "enabled":
- if is_enabled == False:
+ if is_enabled is False:
if module.check_mode:
module.exit_json(changed=True)
@@ -633,7 +633,7 @@ def main():
)
changed=True
elif desired_state == "disabled":
- if is_enabled == True:
+ if is_enabled is True:
if module.check_mode:
module.exit_json(changed=True)
@@ -651,7 +651,7 @@ def main():
if desired_state == "enabled":
- if is_enabled == False:
+ if is_enabled is False:
if module.check_mode:
module.exit_json(changed=True)
@@ -661,7 +661,7 @@ def main():
)
changed=True
elif desired_state == "disabled":
- if is_enabled == True:
+ if is_enabled is True:
if module.check_mode:
module.exit_json(changed=True)
@@ -671,7 +671,7 @@ def main():
)
changed=True
- if changed == True:
+ if changed is True:
msgs.append("Changed service %s to %s" % (service, desired_state))
# FIXME - source type does not handle non-permanent mode, this was an
@@ -679,7 +679,7 @@ def main():
if source is not None:
is_enabled = action_handler(get_source, (zone, source))
if desired_state == "enabled":
- if is_enabled == False:
+ if is_enabled is False:
if module.check_mode:
module.exit_json(changed=True)
@@ -687,7 +687,7 @@ def main():
changed=True
msgs.append("Added %s to zone %s" % (source, zone))
elif desired_state == "disabled":
- if is_enabled == True:
+ if is_enabled is True:
if module.check_mode:
module.exit_json(changed=True)
@@ -749,7 +749,7 @@ def main():
msgs.append('Permanent operation')
if desired_state == "enabled":
- if is_enabled == False:
+ if is_enabled is False:
if module.check_mode:
module.exit_json(changed=True)
@@ -759,7 +759,7 @@ def main():
)
changed=True
elif desired_state == "disabled":
- if is_enabled == True:
+ if is_enabled is True:
if module.check_mode:
module.exit_json(changed=True)
@@ -776,7 +776,7 @@ def main():
msgs.append('Non-permanent operation')
if desired_state == "enabled":
- if is_enabled == False:
+ if is_enabled is False:
if module.check_mode:
module.exit_json(changed=True)
@@ -786,7 +786,7 @@ def main():
)
changed=True
elif desired_state == "disabled":
- if is_enabled == True:
+ if is_enabled is True:
if module.check_mode:
module.exit_json(changed=True)
@@ -796,7 +796,7 @@ def main():
)
changed=True
- if changed == True:
+ if changed is True:
msgs.append("Changed port %s to %s" % ("%s/%s" % (port, protocol), \
desired_state))
@@ -853,7 +853,7 @@ def main():
msgs.append('Permanent operation')
if desired_state == "enabled":
- if is_enabled == False:
+ if is_enabled is False:
if module.check_mode:
module.exit_json(changed=True)
@@ -863,7 +863,7 @@ def main():
)
changed=True
elif desired_state == "disabled":
- if is_enabled == True:
+ if is_enabled is True:
if module.check_mode:
module.exit_json(changed=True)
@@ -880,7 +880,7 @@ def main():
msgs.append('Non-permanent operation')
if desired_state == "enabled":
- if is_enabled == False:
+ if is_enabled is False:
if module.check_mode:
module.exit_json(changed=True)
@@ -890,7 +890,7 @@ def main():
)
changed=True
elif desired_state == "disabled":
- if is_enabled == True:
+ if is_enabled is True:
if module.check_mode:
module.exit_json(changed=True)
@@ -900,7 +900,7 @@ def main():
)
changed=True
- if changed == True:
+ if changed is True:
msgs.append("Changed rich_rule %s to %s" % (rich_rule, desired_state))
if interface is not None:
@@ -948,7 +948,7 @@ def main():
)
msgs.append('Permanent operation')
if desired_state == "enabled":
- if is_enabled == False:
+ if is_enabled is False:
if module.check_mode:
module.exit_json(changed=True)
@@ -956,7 +956,7 @@ def main():
changed=True
msgs.append("Changed %s to zone %s" % (interface, zone))
elif desired_state == "disabled":
- if is_enabled == True:
+ if is_enabled is True:
if module.check_mode:
module.exit_json(changed=True)
@@ -970,7 +970,7 @@ def main():
)
msgs.append('Non-permanent operation')
if desired_state == "enabled":
- if is_enabled == False:
+ if is_enabled is False:
if module.check_mode:
module.exit_json(changed=True)
@@ -978,7 +978,7 @@ def main():
changed=True
msgs.append("Changed %s to zone %s" % (interface, zone))
elif desired_state == "disabled":
- if is_enabled == True:
+ if is_enabled is True:
if module.check_mode:
module.exit_json(changed=True)
@@ -1027,7 +1027,7 @@ def main():
msgs.append('Permanent operation')
if desired_state == "enabled":
- if is_enabled == False:
+ if is_enabled is False:
if module.check_mode:
module.exit_json(changed=True)
@@ -1035,7 +1035,7 @@ def main():
changed=True
msgs.append("Added masquerade to zone %s" % (zone))
elif desired_state == "disabled":
- if is_enabled == True:
+ if is_enabled is True:
if module.check_mode:
module.exit_json(changed=True)
@@ -1047,7 +1047,7 @@ def main():
msgs.append('Non-permanent operation')
if desired_state == "enabled":
- if is_enabled == False:
+ if is_enabled is False:
if module.check_mode:
module.exit_json(changed=True)
@@ -1055,7 +1055,7 @@ def main():
changed=True
msgs.append("Added masquerade to zone %s" % (zone))
elif desired_state == "disabled":
- if is_enabled == True:
+ if is_enabled is True:
if module.check_mode:
module.exit_json(changed=True)
diff --git a/lib/ansible/modules/system/gluster_volume.py b/lib/ansible/modules/system/gluster_volume.py
index 8af22eb124..fbaf3dacde 100644
--- a/lib/ansible/modules/system/gluster_volume.py
+++ b/lib/ansible/modules/system/gluster_volume.py
@@ -241,11 +241,11 @@ def get_peers():
uuid = value
if key.lower() == 'state':
state = value
- peers[hostname] = [ uuid, state ]
+ peers[hostname] = [uuid, state]
elif row.lower() == 'other names:':
shortNames = True
- elif row != '' and shortNames == True:
- peers[row] = [ uuid, state ]
+ elif row != '' and shortNames is True:
+ peers[row] = [uuid, state]
elif row == '':
shortNames = False
return peers
diff --git a/lib/ansible/modules/system/group.py b/lib/ansible/modules/system/group.py
index 4242e6e008..3741da4175 100644
--- a/lib/ansible/modules/system/group.py
+++ b/lib/ansible/modules/system/group.py
@@ -105,7 +105,7 @@ class Group(object):
if key == 'gid' and kwargs[key] is not None:
cmd.append('-g')
cmd.append(kwargs[key])
- elif key == 'system' and kwargs[key] == True:
+ elif key == 'system' and kwargs[key] is True:
cmd.append('-r')
cmd.append(self.name)
return self.execute_command(cmd)
@@ -190,8 +190,8 @@ class AIX(Group):
cmd = [self.module.get_bin_path('mkgroup', True)]
for key in kwargs:
if key == 'gid' and kwargs[key] is not None:
- cmd.append('id='+kwargs[key])
- elif key == 'system' and kwargs[key] == True:
+ cmd.append('id=' + kwargs[key])
+ elif key == 'system' and kwargs[key] is True:
cmd.append('-a')
cmd.append(self.name)
return self.execute_command(cmd)
@@ -202,7 +202,7 @@ class AIX(Group):
for key in kwargs:
if key == 'gid':
if kwargs[key] is not None and info[2] != int(kwargs[key]):
- cmd.append('id='+kwargs[key])
+ cmd.append('id=' + kwargs[key])
if len(cmd) == 1:
return (None, '', '')
if self.module.check_mode:
@@ -275,9 +275,9 @@ class DarwinGroup(Group):
cmd += [ '-o', 'create' ]
if self.gid is not None:
cmd += [ '-i', self.gid ]
- elif 'system' in kwargs and kwargs['system'] == True:
+ elif 'system' in kwargs and kwargs['system'] is True:
gid = self.get_lowest_available_system_gid()
- if gid != False:
+ if gid is not False:
self.gid = str(gid)
cmd += [ '-i', self.gid ]
cmd += [ '-L', self.name ]
diff --git a/lib/ansible/modules/system/known_hosts.py b/lib/ansible/modules/system/known_hosts.py
index 4397255c5f..e86069030f 100644
--- a/lib/ansible/modules/system/known_hosts.py
+++ b/lib/ansible/modules/system/known_hosts.py
@@ -206,10 +206,10 @@ def sanity_check(module,host,key,sshkeygen):
except:
pass
- if stdout=='': #host not found
+ if stdout == '': # host not found
module.fail_json(msg="Host parameter does not match hashed host field in supplied key")
-def search_for_host_key(module,host,key,hash_host,path,sshkeygen):
+def search_for_host_key(module, host, key, hash_host, path, sshkeygen):
'''search_for_host_key(module,host,key,path,sshkeygen) -> (found,replace_or_add,found_line)
Looks up host and keytype in the known_hosts file path; if it's there, looks to see
@@ -220,37 +220,37 @@ def search_for_host_key(module,host,key,hash_host,path,sshkeygen):
if found=False, then replace is always False.
sshkeygen is the path to ssh-keygen, found earlier with get_bin_path
'''
- if os.path.exists(path)==False:
+ if os.path.exists(path) is False:
return False, False, None, key
- sshkeygen_command=[sshkeygen,'-F',host,'-f',path]
+ sshkeygen_command=[sshkeygen, '-F', host, '-f', path]
- #openssh >=6.4 has changed ssh-keygen behaviour such that it returns
- #1 if no host is found, whereas previously it returned 0
+ # openssh >=6.4 has changed ssh-keygen behaviour such that it returns
+ # 1 if no host is found, whereas previously it returned 0
rc,stdout,stderr=module.run_command(sshkeygen_command,
- check_rc=False)
- if stdout=='' and stderr=='' and (rc==0 or rc==1):
- return False, False, None, key #host not found, no other errors
- if rc!=0: #something went wrong
+ check_rc = False)
+ if stdout == '' and stderr == '' and (rc == 0 or rc == 1):
+ return False, False, None, key # host not found, no other errors
+ if rc != 0: # something went wrong
module.fail_json(msg="ssh-keygen failed (rc=%d,stdout='%s',stderr='%s')" % (rc,stdout,stderr))
- #If user supplied no key, we don't want to try and replace anything with it
+ # If user supplied no key, we don't want to try and replace anything with it
if key is None:
return True, False, None, key
- lines=stdout.split('\n')
+ lines = stdout.split('\n')
new_key = normalize_known_hosts_key(key)
- sshkeygen_command.insert(1,'-H')
- rc,stdout,stderr=module.run_command(sshkeygen_command,check_rc=False)
- if rc not in (0, 1) or stderr != '': #something went wrong
- module.fail_json(msg="ssh-keygen failed to hash host (rc=%d,stdout='%s',stderr='%s')" % (rc,stdout,stderr))
- hashed_lines=stdout.split('\n')
+ sshkeygen_command.insert(1, '-H')
+ rc, stdout, stderr = module.run_command(sshkeygen_command, check_rc=False)
+ if rc not in (0, 1) or stderr != '': # something went wrong
+ module.fail_json(msg="ssh-keygen failed to hash host (rc=%d,stdout='%s',stderr='%s')" % (rc, stdout, stderr))
+ hashed_lines = stdout.split('\n')
- for lnum,l in enumerate(lines):
- if l=='':
+ for lnum, l in enumerate(lines):
+ if l == '':
continue
- elif l[0]=='#': # info output from ssh-keygen; contains the line number where key was found
+ elif l[0] == '#': # info output from ssh-keygen; contains the line number where key was found
try:
# This output format has been hardcoded in ssh-keygen since at least OpenSSH 4.0
# It always outputs the non-localized comment before the found key
@@ -259,18 +259,18 @@ def search_for_host_key(module,host,key,hash_host,path,sshkeygen):
module.fail_json(msg="failed to parse output of ssh-keygen for line number: '%s'" % l)
else:
found_key = normalize_known_hosts_key(l)
- if hash_host==True:
- if found_key['host'][:3]=='|1|':
+ if hash_host is True:
+ if found_key['host'][:3] == '|1|':
new_key['host']=found_key['host']
else:
hashed_host=normalize_known_hosts_key(hashed_lines[lnum])
found_key['host']=hashed_host['host']
key=key.replace(host,found_key['host'])
- if new_key==found_key: #found a match
- return True, False, found_line, key #found exactly the same key, don't replace
- elif new_key['type'] == found_key['type']: # found a different key for the same key type
+ if new_key==found_key: # found a match
+ return True, False, found_line, key # found exactly the same key, don't replace
+ elif new_key['type'] == found_key['type']: # found a different key for the same key type
return True, True, found_line, key
- #No match found, return found and replace, but no line
+ # No match found, return found and replace, but no line
return True, True, None, key
def normalize_known_hosts_key(key):
diff --git a/lib/ansible/modules/system/locale_gen.py b/lib/ansible/modules/system/locale_gen.py
index ad94f8093f..a9da450f4b 100644
--- a/lib/ansible/modules/system/locale_gen.py
+++ b/lib/ansible/modules/system/locale_gen.py
@@ -233,7 +233,7 @@ def main():
else:
if changed:
try:
- if ubuntuMode==False:
+ if ubuntuMode is False:
apply_change(state, name)
else:
apply_change_ubuntu(state, name)
diff --git a/lib/ansible/modules/system/user.py b/lib/ansible/modules/system/user.py
index bd1f0d0e64..b1ede04105 100644
--- a/lib/ansible/modules/system/user.py
+++ b/lib/ansible/modules/system/user.py
@@ -2207,7 +2207,7 @@ def main():
if user.user_exists():
info = user.user_info()
- if info == False:
+ if info is False:
result['msg'] = "failed to look up user name: %s" % user.name
result['failed'] = True
result['uid'] = info[2]
diff --git a/lib/ansible/modules/web_infrastructure/jenkins_job.py b/lib/ansible/modules/web_infrastructure/jenkins_job.py
index a6d0ccd9f1..ad4c5bec06 100644
--- a/lib/ansible/modules/web_infrastructure/jenkins_job.py
+++ b/lib/ansible/modules/web_infrastructure/jenkins_job.py
@@ -264,12 +264,12 @@ class JenkinsJob:
if self.enabled is None:
return False
- if ( (self.enabled == False and status != "disabled") or (self.enabled == True and status == "disabled") ):
+ if ( (self.enabled is False and status != "disabled") or (self.enabled is True and status == "disabled") ):
return True
return False
def switch_state(self):
- if self.enabled == False:
+ if self.enabled is False:
self.server.disable_job(self.name)
else:
self.server.enable_job(self.name)
diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py
index b62e9a08a9..9becda8ee0 100644
--- a/lib/ansible/plugins/connection/ssh.py
+++ b/lib/ansible/plugins/connection/ssh.py
@@ -660,7 +660,7 @@ class Connection(ConnectionBase):
raise AnsibleOptionsError('scp_if_ssh needs to be one of [smart|True|False]')
if scp_if_ssh == 'smart':
methods = ['sftp', 'scp', 'piped']
- elif scp_if_ssh == True:
+ elif scp_if_ssh is True:
methods = ['scp']
else:
methods = ['sftp']
diff --git a/lib/ansible/plugins/filter/ipaddr.py b/lib/ansible/plugins/filter/ipaddr.py
index 39894d467c..eb5871c0a9 100644
--- a/lib/ansible/plugins/filter/ipaddr.py
+++ b/lib/ansible/plugins/filter/ipaddr.py
@@ -323,7 +323,7 @@ def ipaddr(value, query = '', version = False, alias = 'ipaddr'):
if not value:
return False
- elif value == True:
+ elif value is True:
return False
# Check if value is a list and parse each element
diff --git a/lib/ansible/plugins/lookup/dig.py b/lib/ansible/plugins/lookup/dig.py
index 034324eb2e..252739afe5 100644
--- a/lib/ansible/plugins/lookup/dig.py
+++ b/lib/ansible/plugins/lookup/dig.py
@@ -115,7 +115,7 @@ class LookupModule(LookupBase):
... flat=0 # returns a dict; default is 1 == string
'''
- if HAVE_DNS == False:
+ if HAVE_DNS is False:
raise AnsibleError("Can't LOOKUP(dig): module dns.resolver is not installed")
# Create Resolver object so that we can set NS if necessary
diff --git a/lib/ansible/plugins/lookup/dnstxt.py b/lib/ansible/plugins/lookup/dnstxt.py
index e97ee46d18..6069377f4c 100644
--- a/lib/ansible/plugins/lookup/dnstxt.py
+++ b/lib/ansible/plugins/lookup/dnstxt.py
@@ -39,7 +39,7 @@ class LookupModule(LookupBase):
def run(self, terms, variables=None, **kwargs):
- if HAVE_DNS == False:
+ if HAVE_DNS is False:
raise AnsibleError("Can't LOOKUP(dnstxt): module dns.resolver is not installed")
ret = []
diff --git a/lib/ansible/utils/module_docs.py b/lib/ansible/utils/module_docs.py
index fe6d77f27d..e0843e9d0c 100644
--- a/lib/ansible/utils/module_docs.py
+++ b/lib/ansible/utils/module_docs.py
@@ -138,7 +138,7 @@ def get_docstring(filename, verbose=False):
except:
display.error("unable to parse %s" % filename)
- if verbose == True:
+ if verbose is True:
display.display("unable to parse %s" % filename)
raise
diff --git a/test/sanity/pep8/legacy-files.txt b/test/sanity/pep8/legacy-files.txt
index 7f91ae25a0..c668c20825 100644
--- a/test/sanity/pep8/legacy-files.txt
+++ b/test/sanity/pep8/legacy-files.txt
@@ -28,7 +28,6 @@ lib/ansible/modules/cloud/amazon/ec2_asg.py
lib/ansible/modules/cloud/amazon/ec2_asg_facts.py
lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py
lib/ansible/modules/cloud/amazon/ec2_elb.py
-lib/ansible/modules/cloud/amazon/ec2_elb_lb.py
lib/ansible/modules/cloud/amazon/ec2_eni.py
lib/ansible/modules/cloud/amazon/ec2_eni_facts.py
lib/ansible/modules/cloud/amazon/ec2_group.py
@@ -40,7 +39,6 @@ lib/ansible/modules/cloud/amazon/ec2_snapshot_facts.py
lib/ansible/modules/cloud/amazon/ec2_tag.py
lib/ansible/modules/cloud/amazon/ec2_vol_facts.py
lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options_facts.py
-lib/ansible/modules/cloud/amazon/ec2_vpc_nacl.py
lib/ansible/modules/cloud/amazon/ec2_vpc_net.py
lib/ansible/modules/cloud/amazon/ec2_vpc_net_facts.py
lib/ansible/modules/cloud/amazon/ec2_vpc_route_table_facts.py
@@ -76,7 +74,6 @@ lib/ansible/modules/cloud/azure/azure_rm_securitygroup.py
lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py
lib/ansible/modules/cloud/azure/azure_rm_subnet.py
lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py
-lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py
lib/ansible/modules/cloud/cloudscale/cloudscale_server.py
lib/ansible/modules/cloud/cloudstack/cs_host.py
lib/ansible/modules/cloud/cloudstack/cs_instance.py
@@ -84,7 +81,6 @@ lib/ansible/modules/cloud/cloudstack/cs_iso.py
lib/ansible/modules/cloud/cloudstack/cs_portforward.py
lib/ansible/modules/cloud/cloudstack/cs_sshkeypair.py
lib/ansible/modules/cloud/digital_ocean/digital_ocean.py
-lib/ansible/modules/cloud/docker/_docker.py
lib/ansible/modules/cloud/google/gc_storage.py
lib/ansible/modules/cloud/google/gce_tag.py
lib/ansible/modules/cloud/google/gcpubsub.py
@@ -100,7 +96,6 @@ lib/ansible/modules/cloud/packet/packet_sshkey.py
lib/ansible/modules/cloud/profitbricks/profitbricks.py
lib/ansible/modules/cloud/profitbricks/profitbricks_datacenter.py
lib/ansible/modules/cloud/softlayer/sl_vm.py
-lib/ansible/modules/cloud/vmware/vca_fw.py
lib/ansible/modules/cloud/vmware/vmware_guest.py
lib/ansible/modules/cloud/vmware/vsphere_guest.py
lib/ansible/modules/cloud/webfaction/webfaction_app.py
@@ -131,14 +126,12 @@ lib/ansible/modules/files/synchronize.py
lib/ansible/modules/files/tempfile.py
lib/ansible/modules/files/unarchive.py
lib/ansible/modules/messaging/rabbitmq_queue.py
-lib/ansible/modules/monitoring/boundary_meter.py
lib/ansible/modules/monitoring/datadog_monitor.py
lib/ansible/modules/monitoring/logicmonitor.py
lib/ansible/modules/monitoring/nagios.py
lib/ansible/modules/monitoring/pagerduty_alert.py
lib/ansible/modules/monitoring/zabbix_screen.py
lib/ansible/modules/network/a10/a10_server.py
-lib/ansible/modules/network/a10/a10_server_axapi3.py
lib/ansible/modules/network/a10/a10_service_group.py
lib/ansible/modules/network/basics/slurp.py
lib/ansible/modules/network/cloudflare_dns.py
@@ -160,12 +153,9 @@ lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py
lib/ansible/modules/network/nxos/nxos_evpn_vni.py
lib/ansible/modules/network/nxos/nxos_feature.py
lib/ansible/modules/network/nxos/nxos_gir.py
-lib/ansible/modules/network/nxos/nxos_install_os.py
lib/ansible/modules/network/nxos/nxos_interface_ospf.py
-lib/ansible/modules/network/nxos/nxos_pim_interface.py
lib/ansible/modules/network/nxos/nxos_snapshot.py
lib/ansible/modules/network/nxos/nxos_vlan.py
-lib/ansible/modules/network/nxos/nxos_vpc.py
lib/ansible/modules/network/panos/panos_nat_policy.py
lib/ansible/modules/network/snmp_facts.py
lib/ansible/modules/notification/hall.py
@@ -194,17 +184,12 @@ lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py
lib/ansible/modules/storage/netapp/netapp_e_storage_system.py
lib/ansible/modules/storage/netapp/netapp_e_storagepool.py
lib/ansible/modules/system/debconf.py
-lib/ansible/modules/system/filesystem.py
lib/ansible/modules/system/firewalld.py
-lib/ansible/modules/system/gluster_volume.py
-lib/ansible/modules/system/group.py
lib/ansible/modules/system/known_hosts.py
-lib/ansible/modules/system/locale_gen.py
lib/ansible/modules/system/lvol.py
lib/ansible/modules/system/pam_limits.py
lib/ansible/modules/system/solaris_zone.py
lib/ansible/modules/system/systemd.py
-lib/ansible/modules/system/user.py
lib/ansible/modules/utilities/helper/meta.py
lib/ansible/modules/utilities/logic/include.py
lib/ansible/modules/utilities/logic/include_role.py
@@ -214,7 +199,6 @@ lib/ansible/modules/utilities/logic/set_fact.py
lib/ansible/modules/utilities/logic/wait_for.py
lib/ansible/modules/web_infrastructure/apache2_mod_proxy.py
lib/ansible/modules/web_infrastructure/django_manage.py
-lib/ansible/modules/web_infrastructure/jenkins_job.py
lib/ansible/modules/web_infrastructure/jira.py
lib/ansible/modules/web_infrastructure/nginx_status_facts.py
lib/ansible/modules/windows/win_acl.py
@@ -250,8 +234,6 @@ lib/ansible/plugins/connection/paramiko_ssh.py
lib/ansible/plugins/connection/ssh.py
lib/ansible/plugins/connection/winrm.py
lib/ansible/plugins/filter/ipaddr.py
-lib/ansible/plugins/lookup/dig.py
-lib/ansible/plugins/lookup/dnstxt.py
lib/ansible/plugins/lookup/first_found.py
lib/ansible/plugins/shell/fish.py
lib/ansible/plugins/shell/sh.py
@@ -259,5 +241,4 @@ lib/ansible/plugins/strategy/__init__.py
lib/ansible/plugins/strategy/linear.py
lib/ansible/template/__init__.py
lib/ansible/utils/encrypt.py
-lib/ansible/utils/module_docs.py
lib/ansible/vars/__init__.py
diff --git a/test/sanity/pep8/legacy-ignore.txt b/test/sanity/pep8/legacy-ignore.txt
index 9e7f635246..579133d885 100644
--- a/test/sanity/pep8/legacy-ignore.txt
+++ b/test/sanity/pep8/legacy-ignore.txt
@@ -3,4 +3,3 @@ E114
E125
E129
E501
-E712