diff --git a/contrib/inventory/abiquo.py b/contrib/inventory/abiquo.py index 34544b6c217..cea1624270b 100755 --- a/contrib/inventory/abiquo.py +++ b/contrib/inventory/abiquo.py @@ -130,18 +130,18 @@ def generate_inv_from_api(enterprise_entity,config): if (config.getboolean('defaults', 'public_ip_only')) == True: for link in vmcollection['links']: if (link['type']=='application/vnd.abiquo.publicip+json' and link['rel']=='ip'): - vm_nic = link['title'] - break + vm_nic = link['title'] + break else: - vm_nic = None + vm_nic = None # Otherwise, assigning defined network interface IP address else: for link in vmcollection['links']: if (link['rel']==config.get('defaults', 'default_net_interface')): - vm_nic = link['title'] - break + vm_nic = link['title'] + break else: - vm_nic = None + vm_nic = None vm_state = True # From abiquo.ini: Only adding to inventory VMs deployed diff --git a/contrib/inventory/docker.py b/contrib/inventory/docker.py index 167f3e93bc9..a5f31f9607a 100755 --- a/contrib/inventory/docker.py +++ b/contrib/inventory/docker.py @@ -735,7 +735,7 @@ class DockerInventory(object): cert_path = def_cert_path or self._args.cert_path or self._env_args.cert_path if cert_path and cert_path == self._env_args.cert_path: - cert_path = os.path.join(cert_path, 'cert.pem') + cert_path = os.path.join(cert_path, 'cert.pem') cacert_path = def_cacert_path or self._args.cacert_path or self._env_args.cert_path if cacert_path and cacert_path == self._env_args.cert_path: diff --git a/contrib/inventory/ec2.py b/contrib/inventory/ec2.py index c97ceaed319..49e3821bcf8 100755 --- a/contrib/inventory/ec2.py +++ b/contrib/inventory/ec2.py @@ -308,13 +308,13 @@ class Ec2Inventory(object): if self.all_instances: self.ec2_instance_states = ec2_valid_instance_states elif config.has_option('ec2', 'instance_states'): - for instance_state in config.get('ec2', 'instance_states').split(','): - instance_state = instance_state.strip() - if instance_state not in ec2_valid_instance_states: - continue - self.ec2_instance_states.append(instance_state) + for instance_state in config.get('ec2', 'instance_states').split(','): + instance_state = instance_state.strip() + if instance_state not in ec2_valid_instance_states: + continue + self.ec2_instance_states.append(instance_state) else: - self.ec2_instance_states = ['running'] + self.ec2_instance_states = ['running'] # Return all RDS instances? (if RDS is enabled) if config.has_option('ec2', 'all_rds_instances') and self.rds_enabled: diff --git a/contrib/inventory/nsot.py b/contrib/inventory/nsot.py index c4737c83eab..c97f363e2e2 100644 --- a/contrib/inventory/nsot.py +++ b/contrib/inventory/nsot.py @@ -151,7 +151,7 @@ from click.exceptions import UsageError from six import string_types def warning(*objs): - print("WARNING: ", *objs, file=sys.stderr) + print("WARNING: ", *objs, file=sys.stderr) class NSoTInventory(object): diff --git a/contrib/inventory/softlayer.py b/contrib/inventory/softlayer.py index 21c0f441971..3933eb4d4d8 100755 --- a/contrib/inventory/softlayer.py +++ b/contrib/inventory/softlayer.py @@ -169,7 +169,7 @@ class SoftLayerInventory(object): # Inventory: group by tag for tag in instance['tagReferences']: - self.push(self.inventory, tag['tag']['name'], dest) + self.push(self.inventory, tag['tag']['name'], dest) def get_virtual_servers(self): '''Get all the CCI instances''' diff --git a/contrib/inventory/spacewalk.py b/contrib/inventory/spacewalk.py index 20cbb14ab2e..2735a812502 100755 --- a/contrib/inventory/spacewalk.py +++ b/contrib/inventory/spacewalk.py @@ -187,7 +187,7 @@ if options.list: groups[group_name].add(system['spacewalk_server_name']) if system['spacewalk_server_name'] in host_vars and not system['spacewalk_server_name'] in meta[ "hostvars" ]: - meta[ "hostvars" ][ system['spacewalk_server_name'] ] = host_vars[ system['spacewalk_server_name'] ] + meta[ "hostvars" ][ system['spacewalk_server_name'] ] = host_vars[ system['spacewalk_server_name'] ] except (OSError) as e: print('Problem executing the command "%s system-groups-systems": %s' % diff --git a/contrib/inventory/vbox.py b/contrib/inventory/vbox.py index bd926b38e91..8905fab6dce 100755 --- a/contrib/inventory/vbox.py +++ b/contrib/inventory/vbox.py @@ -24,10 +24,10 @@ except ImportError: import simplejson as json class SetEncoder(json.JSONEncoder): - def default(self, obj): - if isinstance(obj, set): - return list(obj) - return json.JSONEncoder.default(self, obj) + def default(self, obj): + if isinstance(obj, set): + return list(obj) + return json.JSONEncoder.default(self, obj) VBOX="VBoxManage" diff --git a/contrib/inventory/zone.py b/contrib/inventory/zone.py index c6c9768ec6d..893953efec6 100755 --- a/contrib/inventory/zone.py +++ b/contrib/inventory/zone.py @@ -27,10 +27,10 @@ result['all'] = {} pipe = Popen(['zoneadm', 'list', '-ip'], stdout=PIPE, universal_newlines=True) result['all']['hosts'] = [] for l in pipe.stdout.readlines(): - # 1:work:running:/zones/work:3126dc59-9a07-4829-cde9-a816e4c5040e:native:shared - s = l.split(':') - if s[1] != 'global': - result['all']['hosts'].append(s[1]) + # 1:work:running:/zones/work:3126dc59-9a07-4829-cde9-a816e4c5040e:native:shared + s = l.split(':') + if s[1] != 'global': + result['all']['hosts'].append(s[1]) result['all']['vars'] = {} result['all']['vars']['ansible_connection'] = 'zone' diff --git a/lib/ansible/compat/six/__init__.py b/lib/ansible/compat/six/__init__.py index 473e2d4f1ef..48604404198 100644 --- a/lib/ansible/compat/six/__init__.py +++ b/lib/ansible/compat/six/__init__.py @@ -36,13 +36,13 @@ if _system_six: # If we need some things from even newer versions of six, then we need to # use our bundled copy instead - if ( # Added in six-1.8.0 - not hasattr(_system_six.moves, 'shlex_quote') or - # Added in six-1.4.0 - not hasattr(_system_six, 'byte2int') or - not hasattr(_system_six, 'add_metaclass') or - not hasattr(_system_six.moves, 'urllib') - ): + if ( # Added in six-1.8.0 + not hasattr(_system_six.moves, 'shlex_quote') or + # Added in six-1.4.0 + not hasattr(_system_six, 'byte2int') or + not hasattr(_system_six, 'add_metaclass') or + not hasattr(_system_six.moves, 'urllib') + ): _system_six = False diff --git a/lib/ansible/galaxy/role.py b/lib/ansible/galaxy/role.py index 539951e2ceb..1727931ad86 100644 --- a/lib/ansible/galaxy/role.py +++ b/lib/ansible/galaxy/role.py @@ -252,7 +252,7 @@ class GalaxyRole(object): tmp_file = self.fetch(role_data) else: - raise AnsibleError("No valid role data found") + raise AnsibleError("No valid role data found") if tmp_file: diff --git a/lib/ansible/module_utils/azure_rm_common.py b/lib/ansible/module_utils/azure_rm_common.py index 7d2c7a1012a..d29a34a6501 100644 --- a/lib/ansible/module_utils/azure_rm_common.py +++ b/lib/ansible/module_utils/azure_rm_common.py @@ -376,9 +376,9 @@ class AzureRMModuleBase(object): dependencies = dict() if enum_modules: for module_name in enum_modules: - mod = importlib.import_module(module_name) - for mod_class_name, mod_class_obj in inspect.getmembers(mod, predicate=inspect.isclass): - dependencies[mod_class_name] = mod_class_obj + mod = importlib.import_module(module_name) + for mod_class_name, mod_class_obj in inspect.getmembers(mod, predicate=inspect.isclass): + dependencies[mod_class_name] = mod_class_obj self.log("dependencies: ") self.log(str(dependencies)) serializer = Serializer(classes=dependencies) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 1099c4ddfc1..268e610d482 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1399,7 +1399,7 @@ class AnsibleModule(object): ','.join(sorted(list(unsupported_parameters))), ','.join(sorted(self.argument_spec.keys())))) if self.check_mode and not self.supports_check_mode: - self.exit_json(skipped=True, msg="remote module (%s) does not support check mode" % self._name) + self.exit_json(skipped=True, msg="remote module (%s) does not support check mode" % self._name) def _count_terms(self, check): count = 0 diff --git a/lib/ansible/module_utils/docker_common.py b/lib/ansible/module_utils/docker_common.py index 4078ed9af6b..e19e855089e 100644 --- a/lib/ansible/module_utils/docker_common.py +++ b/lib/ansible/module_utils/docker_common.py @@ -249,7 +249,7 @@ class AnsibleDockerClient(Client): tls_config = TLSConfig(**kwargs) return tls_config except TLSParameterError as exc: - self.fail("TLS config error: %s" % exc) + self.fail("TLS config error: %s" % exc) def _get_connect_params(self): auth = self.auth_params diff --git a/lib/ansible/module_utils/eos.py b/lib/ansible/module_utils/eos.py index 14bd3c3c739..7a44720f803 100644 --- a/lib/ansible/module_utils/eos.py +++ b/lib/ansible/module_utils/eos.py @@ -68,7 +68,7 @@ def run_commands(module, commands): module.fail_json(msg=err) try: - out = module.from_json(out) + out = module.from_json(out) except ValueError: out = str(out).strip() diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index b0d951333e9..85fb0683177 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -325,7 +325,7 @@ class Facts(object): def get_pkg_mgr_facts(self): if self.facts['system'] == 'OpenBSD': - self.facts['pkg_mgr'] = 'openbsd_pkg' + self.facts['pkg_mgr'] = 'openbsd_pkg' else: self.facts['pkg_mgr'] = 'unknown' for pkg in Facts.PKG_MGRS: @@ -476,9 +476,9 @@ class Facts(object): def get_apparmor_facts(self): self.facts['apparmor'] = {} if os.path.exists('/sys/kernel/security/apparmor'): - self.facts['apparmor']['status'] = 'enabled' + self.facts['apparmor']['status'] = 'enabled' else: - self.facts['apparmor']['status'] = 'disabled' + self.facts['apparmor']['status'] = 'disabled' def get_caps_facts(self): capsh_path = self.module.get_bin_path('capsh') @@ -884,7 +884,7 @@ class Distribution(object): # example pattern are 13.04 13.0 13 distribution_version = re.search('^VERSION_ID="?([0-9]+\.?[0-9]*)"?', line) if distribution_version: - self.facts['distribution_version'] = distribution_version.group(1) + self.facts['distribution_version'] = distribution_version.group(1) if 'open' in data.lower(): release = re.search("^PRETTY_NAME=[^(]+ \(?([^)]+?)\)", line) if release: @@ -1071,8 +1071,8 @@ class LinuxHardware(Hardware): self.facts["%s_mb" % key.lower()] = int(val) // 1024 if key in self.MEMORY_FACTS: - val = data[1].strip().split(' ')[0] - memstats[key.lower()] = int(val) // 1024 + val = data[1].strip().split(' ')[0] + memstats[key.lower()] = int(val) // 1024 if None not in (memstats.get('memtotal'), memstats.get('memfree')): memstats['real:used'] = memstats['memtotal'] - memstats['memfree'] @@ -1811,8 +1811,8 @@ class OpenBSDHardware(Hardware): } for mib in sysctl_to_dmi: - if mib in self.sysctl: - self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib] + if mib in self.sysctl: + self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib] class FreeBSDHardware(Hardware): """ @@ -2040,8 +2040,8 @@ class NetBSDHardware(Hardware): } for mib in sysctl_to_dmi: - if mib in self.sysctl: - self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib] + if mib in self.sysctl: + self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib] class AIX(Hardware): """ @@ -2283,8 +2283,8 @@ class HPUX(Hardware): if os.access("/dev/kmem", os.R_OK): rc, out, err = self.module.run_command("echo 'phys_mem_pages/D' | adb -k /stand/vmunix /dev/kmem | tail -1 | awk '{print $2}'", use_unsafe_shell=True) if not err: - data = out - self.facts['memtotal_mb'] = int(data) / 256 + data = out + self.facts['memtotal_mb'] = int(data) / 256 else: rc, out, err = self.module.run_command("/usr/contrib/bin/machinfo | grep Memory", use_unsafe_shell=True) data = re.search('Memory[\ :=]*([0-9]*).*MB.*',out).groups()[0].strip() @@ -2308,7 +2308,7 @@ class HPUX(Hardware): self.facts['firmware_version'] = out.split(separator)[1].strip() rc, out, err = self.module.run_command("/usr/contrib/bin/machinfo |grep -i 'Machine serial number' ",use_unsafe_shell=True) if rc == 0 and out: - self.facts['product_serial'] = out.split(separator)[1].strip() + self.facts['product_serial'] = out.split(separator)[1].strip() class Darwin(Hardware): """ @@ -2926,18 +2926,18 @@ class HPUXNetwork(Network): interfaces = self.get_interfaces_info() self.facts['interfaces'] = interfaces.keys() for iface in interfaces: - self.facts[iface] = interfaces[iface] + self.facts[iface] = interfaces[iface] return self.facts def get_default_interfaces(self): rc, out, err = self.module.run_command("/usr/bin/netstat -nr") lines = out.splitlines() for line in lines: - words = line.split() - if len(words) > 1: - if words[0] == 'default': - self.facts['default_interface'] = words[4] - self.facts['default_gateway'] = words[1] + words = line.split() + if len(words) > 1: + if words[0] == 'default': + self.facts['default_interface'] = words[4] + self.facts['default_gateway'] = words[1] def get_interfaces_info(self): interfaces = {} @@ -3122,7 +3122,7 @@ class OpenBSDNetwork(GenericBsdIfconfigNetwork): # OpenBSD 'ifconfig -a' does not have information about aliases def get_interfaces_info(self, ifconfig_path, ifconfig_options='-aA'): - return super(OpenBSDNetwork, self).get_interfaces_info(ifconfig_path, ifconfig_options) + return super(OpenBSDNetwork, self).get_interfaces_info(ifconfig_path, ifconfig_options) # Return macaddress instead of lladdr def parse_lladdr_line(self, words, current_if, ips): diff --git a/lib/ansible/module_utils/known_hosts.py b/lib/ansible/module_utils/known_hosts.py index de074551f86..2b63ad84a75 100644 --- a/lib/ansible/module_utils/known_hosts.py +++ b/lib/ansible/module_utils/known_hosts.py @@ -101,7 +101,7 @@ def get_fqdn(repo_url): return result def check_hostkey(module, fqdn): - return not not_in_host_file(module, fqdn) + return not not_in_host_file(module, fqdn) # this is a variant of code found in connection_plugins/paramiko.py and we should modify # the paramiko code to import and use this. diff --git a/lib/ansible/module_utils/vmware.py b/lib/ansible/module_utils/vmware.py index 512e6142d1d..e681aa68d5b 100644 --- a/lib/ansible/module_utils/vmware.py +++ b/lib/ansible/module_utils/vmware.py @@ -226,7 +226,7 @@ def connect_to_api(module, disconnect_atexit=True): def get_all_objs(content, vimtype, folder=None, recurse=True): if not folder: - folder = content.rootFolder + folder = content.rootFolder obj = {} container = content.viewManager.CreateContainerView(folder, vimtype, recurse) diff --git a/lib/ansible/modules/cloud/amazon/aws_kms.py b/lib/ansible/modules/cloud/amazon/aws_kms.py index 9e81c3632e4..7b5aad31bbe 100644 --- a/lib/ansible/modules/cloud/amazon/aws_kms.py +++ b/lib/ansible/modules/cloud/amazon/aws_kms.py @@ -184,9 +184,9 @@ def do_grant(kms, keyarn, role_arn, granttypes, mode='grant', dry_run=True, clea if not dry_run: statement['Principal']['AWS'].append(role_arn) elif role_arn in statement['Principal']['AWS']: # not one the places the role should be - changes_needed[granttype] = 'remove' - if not dry_run: - statement['Principal']['AWS'].remove(role_arn) + changes_needed[granttype] = 'remove' + if not dry_run: + statement['Principal']['AWS'].remove(role_arn) elif mode == 'deny' and statement['Sid'] == statement_label[granttype] and role_arn in statement['Principal']['AWS']: # we don't selectively deny. that's a grant with a diff --git a/lib/ansible/modules/cloud/amazon/cloudformation_facts.py b/lib/ansible/modules/cloud/amazon/cloudformation_facts.py index 45b53bcc5a4..8684a5f67f2 100644 --- a/lib/ansible/modules/cloud/amazon/cloudformation_facts.py +++ b/lib/ansible/modules/cloud/amazon/cloudformation_facts.py @@ -222,7 +222,7 @@ class CloudFormationServiceManager: result = response.get(result_key) next_token = response.get('NextToken') if not next_token: - return result + return result return result + self.paginated_response(func, result_key, next_token) def to_dict(items, key, value): @@ -246,7 +246,7 @@ def main(): module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=False) if not HAS_BOTO3: - module.fail_json(msg='boto3 is required.') + module.fail_json(msg='boto3 is required.') # Describe the stack service_mgr = CloudFormationServiceManager(module) diff --git a/lib/ansible/modules/cloud/amazon/cloudfront_facts.py b/lib/ansible/modules/cloud/amazon/cloudfront_facts.py index bdead14981f..affd6540fc8 100644 --- a/lib/ansible/modules/cloud/amazon/cloudfront_facts.py +++ b/lib/ansible/modules/cloud/amazon/cloudfront_facts.py @@ -388,7 +388,7 @@ def main(): module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=False) if not HAS_BOTO3: - module.fail_json(msg='boto3 is required.') + module.fail_json(msg='boto3 is required.') service_mgr = CloudFrontServiceManager(module) diff --git a/lib/ansible/modules/cloud/amazon/cloudtrail.py b/lib/ansible/modules/cloud/amazon/cloudtrail.py index 7cb55c83b49..b6bc564fe97 100644 --- a/lib/ansible/modules/cloud/amazon/cloudtrail.py +++ b/lib/ansible/modules/cloud/amazon/cloudtrail.py @@ -139,13 +139,13 @@ class CloudTrailManager: ret = self.conn.describe_trails(trail_name_list=[name]) trailList = ret.get('trailList', []) if len(trailList) == 1: - return trailList[0] + return trailList[0] return None def exists(self, name=None): ret = self.view(name) if ret: - return True + return True return False def enable_logging(self, name): @@ -180,7 +180,7 @@ def main(): module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_together=required_together) if not HAS_BOTO: - module.fail_json(msg='boto is required.') + module.fail_json(msg='boto is required.') ec2_url, access_key, secret_key, region = get_ec2_creds(module) aws_connect_params = dict(aws_access_key_id=access_key, diff --git a/lib/ansible/modules/cloud/amazon/dynamodb_table.py b/lib/ansible/modules/cloud/amazon/dynamodb_table.py index 20c7bc28596..d403dc0c796 100644 --- a/lib/ansible/modules/cloud/amazon/dynamodb_table.py +++ b/lib/ansible/modules/cloud/amazon/dynamodb_table.py @@ -344,7 +344,7 @@ def validate_index(index, module): module.fail_json(msg='%s is not a valid option for an index' % key) for required_option in INDEX_REQUIRED_OPTIONS: if required_option not in index: - module.fail_json(msg='%s is a required option for an index' % required_option) + module.fail_json(msg='%s is a required option for an index' % required_option) if index['type'] not in INDEX_TYPE_OPTIONS: module.fail_json(msg='%s is not a valid index type, must be one of %s' % (index['type'], INDEX_TYPE_OPTIONS)) diff --git a/lib/ansible/modules/cloud/amazon/ec2.py b/lib/ansible/modules/cloud/amazon/ec2.py index 55ac11b5294..86aa68dddd7 100644 --- a/lib/ansible/modules/cloud/amazon/ec2.py +++ b/lib/ansible/modules/cloud/amazon/ec2.py @@ -1033,7 +1033,7 @@ def create_instances(module, ec2, vpc, override_count=None): grp_details = ec2.get_all_security_groups(group_ids=group_id) group_name = [grp_item.name for grp_item in grp_details] except boto.exception.NoAuthHandlerFound as e: - module.fail_json(msg = str(e)) + module.fail_json(msg = str(e)) # Lookup any instances that much our run id. @@ -1065,11 +1065,11 @@ def create_instances(module, ec2, vpc, override_count=None): 'user_data': user_data} if ebs_optimized: - params['ebs_optimized'] = ebs_optimized + params['ebs_optimized'] = ebs_optimized # 'tenancy' always has a default value, but it is not a valid parameter for spot instance request if not spot_price: - params['tenancy'] = tenancy + params['tenancy'] = tenancy if boto_supports_profile_name_arg(ec2): params['instance_profile_name'] = instance_profile_name @@ -1184,8 +1184,8 @@ def create_instances(module, ec2, vpc, override_count=None): if boto_supports_param_in_spot_request(ec2, 'placement_group'): params['placement_group'] = placement_group elif placement_group : - module.fail_json( - msg="placement_group parameter requires Boto version 2.3.0 or higher.") + module.fail_json( + msg="placement_group parameter requires Boto version 2.3.0 or higher.") # You can't tell spot instances to 'stop'; they will always be # 'terminate'd. For convenience, we'll ignore the latter value. diff --git a/lib/ansible/modules/cloud/amazon/ec2_lc_facts.py b/lib/ansible/modules/cloud/amazon/ec2_lc_facts.py index b81ce8975b6..ab5b5bb0e00 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_lc_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_lc_facts.py @@ -178,7 +178,7 @@ def list_launch_configs(connection, module): launch_config['CreatedTime'] = str(launch_config['CreatedTime']) if sort: - snaked_launch_configs.sort(key=lambda e: e[sort], reverse=(sort_order=='descending')) + snaked_launch_configs.sort(key=lambda e: e[sort], reverse=(sort_order=='descending')) try: if sort and sort_start and sort_end: diff --git a/lib/ansible/modules/cloud/amazon/ec2_tag.py b/lib/ansible/modules/cloud/amazon/ec2_tag.py index d27af699b88..79e35af216b 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_tag.py +++ b/lib/ansible/modules/cloud/amazon/ec2_tag.py @@ -176,12 +176,12 @@ def main(): module.fail_json(msg="tags argument is required when state is absent") for (key, value) in set(tags.items()): if (key, value) not in set(tagdict.items()): - baddict[key] = value - if set(baddict) == set(tags): - module.exit_json(msg="Nothing to remove here. Move along.", changed=False) + baddict[key] = value + if set(baddict) == set(tags): + module.exit_json(msg="Nothing to remove here. Move along.", changed=False) for (key, value) in set(tags.items()): if (key, value) in set(tagdict.items()): - dictremove[key] = value + dictremove[key] = value tagger = ec2.delete_tags(resource, dictremove) gettags = ec2.get_all_tags(filters=filters) module.exit_json(msg="Tags %s removed for resource %s." % (dictremove,resource), changed=True) diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options.py index 17543e91787..82bdf8d00a0 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options.py @@ -333,7 +333,7 @@ def main(): supplied_options = connection.get_all_dhcp_options(filters={'dhcp-options-id':params['dhcp_options_id']}) if len(supplied_options) != 1: if params['state'] != 'absent': - module.fail_json(msg=" a dhcp_options_id was supplied, but does not exist") + module.fail_json(msg=" a dhcp_options_id was supplied, but does not exist") else: found = True dhcp_option = supplied_options[0] diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options_facts.py index 28d988debd4..ba232f2e261 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options_facts.py @@ -131,7 +131,7 @@ def list_dhcp_options(client, module): snaked_dhcp_options_array = [] for dhcp_option in all_dhcp_options_array: - snaked_dhcp_options_array.append(camel_dict_to_snake_dict(dhcp_option)) + snaked_dhcp_options_array.append(camel_dict_to_snake_dict(dhcp_option)) module.exit_json(dhcp_options=snaked_dhcp_options_array) diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py index 704bf15aa15..911368d665a 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_nat_gateway.py @@ -387,7 +387,7 @@ def get_nat_gateways(client, subnet_id=None, nat_gateway_id=None, err_msg = '{0} Retrieving gateways'.format(DRY_RUN_MSGS) except botocore.exceptions.ClientError as e: - err_msg = str(e) + err_msg = str(e) return gateways_retrieved, err_msg, existing_gateways @@ -592,7 +592,7 @@ def get_eip_allocation_id_by_address(client, eip_address, check_mode=False): ) except botocore.exceptions.ClientError as e: - err_msg = str(e) + err_msg = str(e) return allocation_id, err_msg diff --git a/lib/ansible/modules/cloud/amazon/ecs_service.py b/lib/ansible/modules/cloud/amazon/ecs_service.py index 9bf424e1d02..54a0dc58f78 100644 --- a/lib/ansible/modules/cloud/amazon/ecs_service.py +++ b/lib/ansible/modules/cloud/amazon/ecs_service.py @@ -353,10 +353,10 @@ def main(): ) if not HAS_BOTO: - module.fail_json(msg='boto is required.') + module.fail_json(msg='boto is required.') if not HAS_BOTO3: - module.fail_json(msg='boto3 is required.') + module.fail_json(msg='boto3 is required.') service_mgr = EcsServiceManager(module) diff --git a/lib/ansible/modules/cloud/amazon/ecs_service_facts.py b/lib/ansible/modules/cloud/amazon/ecs_service_facts.py index e62b492c4b9..24ae3784e98 100644 --- a/lib/ansible/modules/cloud/amazon/ecs_service_facts.py +++ b/lib/ansible/modules/cloud/amazon/ecs_service_facts.py @@ -217,10 +217,10 @@ def main(): module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) if not HAS_BOTO: - module.fail_json(msg='boto is required.') + module.fail_json(msg='boto is required.') if not HAS_BOTO3: - module.fail_json(msg='boto3 is required.') + module.fail_json(msg='boto3 is required.') show_details = module.params.get('details', False) diff --git a/lib/ansible/modules/cloud/amazon/ecs_task.py b/lib/ansible/modules/cloud/amazon/ecs_task.py index 88314ffc152..161e4e17782 100644 --- a/lib/ansible/modules/cloud/amazon/ecs_task.py +++ b/lib/ansible/modules/cloud/amazon/ecs_task.py @@ -248,10 +248,10 @@ def main(): # Validate Requirements if not HAS_BOTO: - module.fail_json(msg='boto is required.') + module.fail_json(msg='boto is required.') if not HAS_BOTO3: - module.fail_json(msg='boto3 is required.') + module.fail_json(msg='boto3 is required.') # Validate Inputs if module.params['operation'] == 'run': diff --git a/lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py b/lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py index 0d68921aced..f04cb69441a 100644 --- a/lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py +++ b/lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py @@ -224,10 +224,10 @@ def main(): module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) if not HAS_BOTO: - module.fail_json(msg='boto is required.') + module.fail_json(msg='boto is required.') if not HAS_BOTO3: - module.fail_json(msg='boto3 is required.') + module.fail_json(msg='boto3 is required.') task_to_describe = None task_mgr = EcsTaskManager(module) diff --git a/lib/ansible/modules/cloud/amazon/lambda.py b/lib/ansible/modules/cloud/amazon/lambda.py index cee8efc0f93..89f896ec341 100644 --- a/lib/ansible/modules/cloud/amazon/lambda.py +++ b/lib/ansible/modules/cloud/amazon/lambda.py @@ -314,7 +314,7 @@ def main(): # If VPC configuration is desired if vpc_subnet_ids or vpc_security_group_ids: if len(vpc_subnet_ids) < 1: - module.fail_json(msg='At least 1 subnet is required') + module.fail_json(msg='At least 1 subnet is required') if len(vpc_security_group_ids) < 1: module.fail_json(msg='At least 1 security group is required') diff --git a/lib/ansible/modules/cloud/amazon/rds.py b/lib/ansible/modules/cloud/amazon/rds.py index e820fc0520d..efb7a5bb9b7 100644 --- a/lib/ansible/modules/cloud/amazon/rds.py +++ b/lib/ansible/modules/cloud/amazon/rds.py @@ -352,7 +352,7 @@ class RDSConnection: try: self.connection = connect_to_aws(boto.rds, region, **aws_connect_params) except boto.exception.BotoServerError as e: - module.fail_json(msg=e.error_message) + module.fail_json(msg=e.error_message) def get_db_instance(self, instancename): try: @@ -438,7 +438,7 @@ class RDS2Connection: try: self.connection = connect_to_aws(boto.rds2, region, **aws_connect_params) except boto.exception.BotoServerError as e: - module.fail_json(msg=e.error_message) + module.fail_json(msg=e.error_message) def get_db_instance(self, instancename): try: diff --git a/lib/ansible/modules/cloud/amazon/s3_sync.py b/lib/ansible/modules/cloud/amazon/s3_sync.py index 466183eb99a..5c64abf284e 100644 --- a/lib/ansible/modules/cloud/amazon/s3_sync.py +++ b/lib/ansible/modules/cloud/amazon/s3_sync.py @@ -282,8 +282,8 @@ def gather_files(fileroot, include=None, exclude=None): if include: found = False for x in include.split(','): - if fnmatch.fnmatch(fn, x): - found = True + if fnmatch.fnmatch(fn, x): + found = True if not found: # not on the include list, so we don't want it. continue @@ -376,7 +376,7 @@ def filter_list(s3, bucket, s3filelist, strategy): keeplist = list(s3filelist) for e in keeplist: - e['_strategy'] = strategy + e['_strategy'] = strategy # init/fetch info from S3 if we're going to use it for comparisons if not strategy == 'force': diff --git a/lib/ansible/modules/cloud/amazon/sns_topic.py b/lib/ansible/modules/cloud/amazon/sns_topic.py index 7c3ac484cf2..3f12155acf4 100644 --- a/lib/ansible/modules/cloud/amazon/sns_topic.py +++ b/lib/ansible/modules/cloud/amazon/sns_topic.py @@ -319,10 +319,10 @@ class SnsTopicManager(object): def ensure_gone(self): self.arn_topic = self._arn_topic_lookup() if self.arn_topic: - self._get_topic_subs() - if self.subscriptions_existing: - self._delete_subscriptions() - self._delete_topic() + self._get_topic_subs() + if self.subscriptions_existing: + self._delete_subscriptions() + self._delete_topic() def get_info(self): diff --git a/lib/ansible/modules/cloud/azure/azure.py b/lib/ansible/modules/cloud/azure/azure.py index 77e43e27e6c..5ba8af9f515 100644 --- a/lib/ansible/modules/cloud/azure/azure.py +++ b/lib/ansible/modules/cloud/azure/azure.py @@ -258,11 +258,11 @@ try: import azure as windows_azure if hasattr(windows_azure, '__version__') and LooseVersion(windows_azure.__version__) <= "0.11.1": - from azure import WindowsAzureError as AzureException - from azure import WindowsAzureMissingResourceError as AzureMissingException + from azure import WindowsAzureError as AzureException + from azure import WindowsAzureMissingResourceError as AzureMissingException else: - from azure.common import AzureException as AzureException - from azure.common import AzureMissingResourceHttpError as AzureMissingException + from azure.common import AzureException as AzureException + from azure.common import AzureMissingResourceHttpError as AzureMissingException from azure.servicemanagement import (ServiceManagementService, OSVirtualHardDisk, SSH, PublicKeys, PublicKey, LinuxConfigurationSet, ConfigurationSetInputEndpoints, diff --git a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py index 651da3caadd..b4c93d61f65 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py @@ -508,7 +508,7 @@ class AzureRMNetworkInterface(AzureRMModuleBase): id=pip.id, location=pip.location, resource_guid=pip.resource_guid) - #name=pip.name, + #name=pip.name, if results['network_security_group'].get('id'): nsg = self.get_security_group(results['network_security_group']['name']) diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py index 132df72fd10..a1637734844 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py @@ -605,7 +605,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase): self.log("Using image version {0}".format(self.image['version'])) if not self.storage_blob_name: - self.storage_blob_name = self.name + '.vhd' + self.storage_blob_name = self.name + '.vhd' if self.storage_account_name: self.get_storage_account(self.storage_account_name) diff --git a/lib/ansible/modules/cloud/centurylink/clc_publicip.py b/lib/ansible/modules/cloud/centurylink/clc_publicip.py index a53aeb79531..f8cbed031f2 100644 --- a/lib/ansible/modules/cloud/centurylink/clc_publicip.py +++ b/lib/ansible/modules/cloud/centurylink/clc_publicip.py @@ -286,7 +286,7 @@ class ClcPublicIp(object): result = None try: for ip_address in server.PublicIPs().public_ips: - result = ip_address.Delete() + result = ip_address.Delete() except CLCException as ex: self.module.fail_json(msg='Failed to remove public ip from the server : {0}. {1}'.format( server.id, ex.response_text diff --git a/lib/ansible/modules/cloud/cloudstack/cs_firewall.py b/lib/ansible/modules/cloud/cloudstack/cs_firewall.py index 22312cffd0f..ea08c91863b 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_firewall.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_firewall.py @@ -335,7 +335,7 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack): poll_async = self.module.params.get('poll_async') if poll_async: - firewall_rule = self.poll_job(res, 'firewallrule') + firewall_rule = self.poll_job(res, 'firewallrule') return firewall_rule @@ -359,7 +359,7 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack): poll_async = self.module.params.get('poll_async') if poll_async: - res = self.poll_job(res, 'firewallrule') + res = self.poll_job(res, 'firewallrule') return firewall_rule diff --git a/lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.py b/lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.py index a54a599e099..0d089964c27 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.py @@ -273,7 +273,7 @@ class AnsibleCloudStackSecurityGroupRule(AnsibleCloudStack): args['projectid'] = self.get_project('id') sgs = self.cs.listSecurityGroups(**args) if not sgs or 'securitygroup' not in sgs: - self.module.fail_json(msg="security group '%s' not found" % security_group_name) + self.module.fail_json(msg="security group '%s' not found" % security_group_name) return sgs['securitygroup'][0] diff --git a/lib/ansible/modules/cloud/docker/docker_image.py b/lib/ansible/modules/cloud/docker/docker_image.py index b91ee2096ab..e720dbbf596 100644 --- a/lib/ansible/modules/cloud/docker/docker_image.py +++ b/lib/ansible/modules/cloud/docker/docker_image.py @@ -291,8 +291,8 @@ class ImageManager(DockerBaseClass): # If name contains a tag, it takes precedence over tag parameter. repo, repo_tag = parse_repository_tag(self.name) if repo_tag: - self.name = repo - self.tag = repo_tag + self.name = repo + self.tag = repo_tag if self.state in ['present', 'build']: self.present() diff --git a/lib/ansible/modules/cloud/docker/docker_service.py b/lib/ansible/modules/cloud/docker/docker_service.py index b27bfed1590..0c674cc313b 100644 --- a/lib/ansible/modules/cloud/docker/docker_service.py +++ b/lib/ansible/modules/cloud/docker/docker_service.py @@ -520,8 +520,8 @@ def get_stdout(path_name): new_line = re.sub(r'\x1b\[.+m', '', line.encode('ascii')) full_stdout += new_line if new_line.strip(): - # Assuming last line contains the error message - last_line = new_line.strip().encode('utf-8') + # Assuming last line contains the error message + last_line = new_line.strip().encode('utf-8') fd.close() os.remove(path_name) return full_stdout, last_line diff --git a/lib/ansible/modules/cloud/google/gc_storage.py b/lib/ansible/modules/cloud/google/gc_storage.py index 32c2eb45536..c2ef23e0973 100644 --- a/lib/ansible/modules/cloud/google/gc_storage.py +++ b/lib/ansible/modules/cloud/google/gc_storage.py @@ -332,7 +332,7 @@ def handle_put(module, gs, bucket, obj, overwrite, src, expiration): # If bucket exists but key doesn't, just upload. if bucket_rc and not key_rc: - upload_gsfile(module, gs, bucket, obj, src, expiration) + upload_gsfile(module, gs, bucket, obj, src, expiration) def handle_delete(module, gs, bucket, obj): if bucket and not obj: diff --git a/lib/ansible/modules/cloud/google/gce_net.py b/lib/ansible/modules/cloud/google/gce_net.py index f0f293d41fa..6c8f02cd641 100644 --- a/lib/ansible/modules/cloud/google/gce_net.py +++ b/lib/ansible/modules/cloud/google/gce_net.py @@ -287,7 +287,7 @@ def main(): json_output['ipv4_range'] = network.cidr if network and mode == 'custom' and subnet_name: if not hasattr(gce, 'ex_get_subnetwork'): - module.fail_json(msg="Update libcloud to a more recent version (>1.0) that supports network 'mode' parameter", changed=False) + module.fail_json(msg="Update libcloud to a more recent version (>1.0) that supports network 'mode' parameter", changed=False) subnet = gce.ex_get_subnetwork(subnet_name, region=subnet_region) json_output['subnet_name'] = subnet_name diff --git a/lib/ansible/modules/cloud/google/gce_tag.py b/lib/ansible/modules/cloud/google/gce_tag.py index 114c314f1ba..73a4d2e7fa4 100644 --- a/lib/ansible/modules/cloud/google/gce_tag.py +++ b/lib/ansible/modules/cloud/google/gce_tag.py @@ -220,7 +220,7 @@ def main(): except ResourceNotFoundError: module.fail_json(msg='Instance %s not found in zone %s' % (instance_name, zone), changed=False) except GoogleBaseError as e: - module.fail_json(msg=str(e), changed=False, exception=traceback.format_exc()) + module.fail_json(msg=str(e), changed=False, exception=traceback.format_exc()) # Tag nodes instance_pattern_matches = [] diff --git a/lib/ansible/modules/cloud/misc/rhevm.py b/lib/ansible/modules/cloud/misc/rhevm.py index dada1c45549..f3a533d0633 100644 --- a/lib/ansible/modules/cloud/misc/rhevm.py +++ b/lib/ansible/modules/cloud/misc/rhevm.py @@ -626,10 +626,10 @@ class RHEVConn(object): setFailed() return False elif int(DISK.size) < (1024 * 1024 * 1024 * int(disksize)): - setMsg("Shrinking disks is not supported") - setMsg(str(e)) - setFailed() - return False + setMsg("Shrinking disks is not supported") + setMsg(str(e)) + setFailed() + return False else: setMsg("The size of the disk is correct") if str(DISK.interface) != str(diskinterface): diff --git a/lib/ansible/modules/cloud/misc/xenserver_facts.py b/lib/ansible/modules/cloud/misc/xenserver_facts.py index 24b66f05e4b..03dcdc2af71 100644 --- a/lib/ansible/modules/cloud/misc/xenserver_facts.py +++ b/lib/ansible/modules/cloud/misc/xenserver_facts.py @@ -154,7 +154,7 @@ def get_vms(session): vms = change_keys(recs, key='uuid') for vm in vms.values(): - xs_vms[vm['name_label']] = vm + xs_vms[vm['name_label']] = vm return xs_vms @@ -165,7 +165,7 @@ def get_srs(session): return None srs = change_keys(recs, key='uuid') for sr in srs.values(): - xs_srs[sr['name_label']] = sr + xs_srs[sr['name_label']] = sr return xs_srs def main(): diff --git a/lib/ansible/modules/cloud/openstack/_nova_compute.py b/lib/ansible/modules/cloud/openstack/_nova_compute.py index fd22545f37e..d305e3b0de9 100644 --- a/lib/ansible/modules/cloud/openstack/_nova_compute.py +++ b/lib/ansible/modules/cloud/openstack/_nova_compute.py @@ -443,14 +443,14 @@ def _create_server(module, nova): server = nova.servers.create(*bootargs, **bootkwargs) server = nova.servers.get(server.id) except Exception as e: - module.fail_json( msg = "Error in creating instance: %s " % e.message) + module.fail_json( msg = "Error in creating instance: %s " % e.message) if module.params['wait'] == 'yes': expire = time.time() + int(module.params['wait_for']) while time.time() < expire: try: server = nova.servers.get(server.id) except Exception as e: - module.fail_json( msg = "Error in getting info from instance: %s" % e.message) + module.fail_json( msg = "Error in getting info from instance: %s" % e.message) if server.status == 'ACTIVE': server = _add_floating_ip(module, nova, server) @@ -466,7 +466,7 @@ def _create_server(module, nova): module.fail_json(msg = "Timeout waiting for the server to come up.. Please check manually") if server.status == 'ERROR': - module.fail_json(msg = "Error in creating the server.. Please check manually") + module.fail_json(msg = "Error in creating the server.. Please check manually") private = openstack_find_nova_addresses(getattr(server, 'addresses'), 'fixed', 'private') public = openstack_find_nova_addresses(getattr(server, 'addresses'), 'floating', 'public') diff --git a/lib/ansible/modules/cloud/openstack/_quantum_floating_ip_associate.py b/lib/ansible/modules/cloud/openstack/_quantum_floating_ip_associate.py index 090f65ef4d9..ca000a0abe3 100644 --- a/lib/ansible/modules/cloud/openstack/_quantum_floating_ip_associate.py +++ b/lib/ansible/modules/cloud/openstack/_quantum_floating_ip_associate.py @@ -147,7 +147,7 @@ def _get_server_state(module, nova): server_info = info break except Exception as e: - module.fail_json(msg = "Error in getting the server list: %s" % e.message) + module.fail_json(msg = "Error in getting the server list: %s" % e.message) return server_info, server def _get_port_id(neutron, module, instance_id): diff --git a/lib/ansible/modules/cloud/openstack/_quantum_network.py b/lib/ansible/modules/cloud/openstack/_quantum_network.py index ce31ff76ddf..426e9bd5637 100644 --- a/lib/ansible/modules/cloud/openstack/_quantum_network.py +++ b/lib/ansible/modules/cloud/openstack/_quantum_network.py @@ -267,12 +267,12 @@ def main(): module.fail_json(msg='python-keystoneclient and either python-neutronclient or python-quantumclient are required') if module.params['provider_network_type'] in ['vlan' , 'flat']: - if not module.params['provider_physical_network']: - module.fail_json(msg = " for vlan and flat networks, variable provider_physical_network should be set.") + if not module.params['provider_physical_network']: + module.fail_json(msg = " for vlan and flat networks, variable provider_physical_network should be set.") if module.params['provider_network_type'] in ['vlan', 'gre']: - if not module.params['provider_segmentation_id']: - module.fail_json(msg = " for vlan & gre networks, variable provider_segmentation_id should be set.") + if not module.params['provider_segmentation_id']: + module.fail_json(msg = " for vlan & gre networks, variable provider_segmentation_id should be set.") neutron = _get_neutron_client(module, module.params) diff --git a/lib/ansible/modules/cloud/openstack/_quantum_router_gateway.py b/lib/ansible/modules/cloud/openstack/_quantum_router_gateway.py index 68159985f34..1b7c09fb58c 100644 --- a/lib/ansible/modules/cloud/openstack/_quantum_router_gateway.py +++ b/lib/ansible/modules/cloud/openstack/_quantum_router_gateway.py @@ -141,7 +141,7 @@ def _get_router_id(module, neutron): except Exception as e: module.fail_json(msg = "Error in getting the router list: %s " % e.message) if not routers['routers']: - return None + return None return routers['routers'][0]['id'] def _get_net_id(neutron, module): diff --git a/lib/ansible/modules/cloud/openstack/_quantum_subnet.py b/lib/ansible/modules/cloud/openstack/_quantum_subnet.py index ab1a6d4140e..51cc8eb4678 100644 --- a/lib/ansible/modules/cloud/openstack/_quantum_subnet.py +++ b/lib/ansible/modules/cloud/openstack/_quantum_subnet.py @@ -201,7 +201,7 @@ def _get_net_id(neutron, module): except Exception as e: module.fail_json("Error in listing neutron networks: %s" % e.message) if not networks['networks']: - return None + return None return networks['networks'][0]['id'] diff --git a/lib/ansible/modules/cloud/openstack/os_ironic_node.py b/lib/ansible/modules/cloud/openstack/os_ironic_node.py index fa41d6fcbc0..8e7d44a240d 100644 --- a/lib/ansible/modules/cloud/openstack/os_ironic_node.py +++ b/lib/ansible/modules/cloud/openstack/os_ironic_node.py @@ -208,7 +208,7 @@ def _check_set_power_state(module, cloud, node): if 'power off' in str(node['power_state']): if (_is_false(module.params['power']) and _is_false(module.params['state'])): - return False + return False if (_is_false(module.params['power']) and _is_false(module.params['state'])): module.exit_json( diff --git a/lib/ansible/modules/cloud/openstack/os_object.py b/lib/ansible/modules/cloud/openstack/os_object.py index 9e67ab39dff..4cadae5a039 100644 --- a/lib/ansible/modules/cloud/openstack/os_object.py +++ b/lib/ansible/modules/cloud/openstack/os_object.py @@ -100,7 +100,7 @@ def process_object( if container_obj: if name: if cloud_obj.get_object_metadata(container, name): - cloud_obj.delete_object(container, name) + cloud_obj.delete_object(container, name) changed= True else: cloud_obj.delete_container(container) diff --git a/lib/ansible/modules/cloud/openstack/os_subnet.py b/lib/ansible/modules/cloud/openstack/os_subnet.py index 54b12adf327..cdb0a982ea9 100644 --- a/lib/ansible/modules/cloud/openstack/os_subnet.py +++ b/lib/ansible/modules/cloud/openstack/os_subnet.py @@ -176,7 +176,7 @@ def _can_update(subnet, module, cloud): else: module.fail_json(msg='No network found for %s' % network_name) if netid != subnet['network_id']: - module.fail_json(msg='Cannot update network_name in existing \ + module.fail_json(msg='Cannot update network_name in existing \ subnet') if ip_version and subnet['ip_version'] != ip_version: module.fail_json(msg='Cannot update ip_version in existing subnet') diff --git a/lib/ansible/modules/cloud/packet/packet_device.py b/lib/ansible/modules/cloud/packet/packet_device.py index b3a072706b3..f01d963a6a8 100644 --- a/lib/ansible/modules/cloud/packet/packet_device.py +++ b/lib/ansible/modules/cloud/packet/packet_device.py @@ -500,7 +500,7 @@ def act_on_devices(target_state, module, packet_conn): created_devices = [create_single_device(module, packet_conn, n) for n in create_hostnames] if module.params.get('wait'): - created_devices = wait_for_ips(module, packet_conn, created_devices) + created_devices = wait_for_ips(module, packet_conn, created_devices) changed = True processed_devices = created_devices + process_devices diff --git a/lib/ansible/modules/cloud/packet/packet_sshkey.py b/lib/ansible/modules/cloud/packet/packet_sshkey.py index 2d0d580ec67..0d074a7bea0 100644 --- a/lib/ansible/modules/cloud/packet/packet_sshkey.py +++ b/lib/ansible/modules/cloud/packet/packet_sshkey.py @@ -169,10 +169,10 @@ def get_sshkey_selector(module): def selector(k): if 'key' in select_dict: # if key string is specified, compare only the key strings - return k.key == select_dict['key'] + return k.key == select_dict['key'] else: # if key string not specified, all the fields must match - return all([select_dict[f] == getattr(k,f) for f in select_dict]) + return all([select_dict[f] == getattr(k,f) for f in select_dict]) return selector diff --git a/lib/ansible/modules/cloud/vmware/vca_fw.py b/lib/ansible/modules/cloud/vmware/vca_fw.py index 78cebbb012e..fd63a4a06c8 100644 --- a/lib/ansible/modules/cloud/vmware/vca_fw.py +++ b/lib/ansible/modules/cloud/vmware/vca_fw.py @@ -246,4 +246,4 @@ def main(): from ansible.module_utils.basic import * from ansible.module_utils.vca import * if __name__ == '__main__': - main() + main() diff --git a/lib/ansible/modules/cloud/vmware/vmware_vswitch.py b/lib/ansible/modules/cloud/vmware/vmware_vswitch.py index cbe5e371977..bae7eba97b9 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vswitch.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vswitch.py @@ -86,10 +86,10 @@ except ImportError: def find_vswitch_by_name(host, vswitch_name): - for vss in host.config.network.vswitch: - if vss.name == vswitch_name: - return vss - return None + for vss in host.config.network.vswitch: + if vss.name == vswitch_name: + return vss + return None class VMwareHostVirtualSwitch(object): diff --git a/lib/ansible/modules/clustering/consul.py b/lib/ansible/modules/clustering/consul.py index 6caa5e9e502..2bb04de9060 100644 --- a/lib/ansible/modules/clustering/consul.py +++ b/lib/ansible/modules/clustering/consul.py @@ -365,19 +365,19 @@ def parse_check(module): if module.params.get('check_id') or module.params.get('script') or module.params.get('ttl') or module.params.get('http'): - return ConsulCheck( - module.params.get('check_id'), - module.params.get('check_name'), - module.params.get('check_node'), - module.params.get('check_host'), - module.params.get('script'), - module.params.get('interval'), - module.params.get('ttl'), - module.params.get('notes'), - module.params.get('http'), - module.params.get('timeout'), - module.params.get('service_id'), - ) + return ConsulCheck( + module.params.get('check_id'), + module.params.get('check_name'), + module.params.get('check_node'), + module.params.get('check_host'), + module.params.get('script'), + module.params.get('interval'), + module.params.get('ttl'), + module.params.get('notes'), + module.params.get('http'), + module.params.get('timeout'), + module.params.get('service_id'), + ) def parse_service(module): diff --git a/lib/ansible/modules/crypto/openssl_publickey.py b/lib/ansible/modules/crypto/openssl_publickey.py index e6fe182c249..1f7424d73bd 100644 --- a/lib/ansible/modules/crypto/openssl_publickey.py +++ b/lib/ansible/modules/crypto/openssl_publickey.py @@ -123,11 +123,11 @@ class PublicKey(object): if not os.path.exists(self.path) or self.force: try: - privatekey_content = open(self.privatekey_path, 'r').read() - privatekey = crypto.load_privatekey(crypto.FILETYPE_PEM, privatekey_content) - publickey_file = open(self.path, 'w') - publickey_file.write(crypto.dump_publickey(crypto.FILETYPE_PEM, privatekey)) - publickey_file.close() + privatekey_content = open(self.privatekey_path, 'r').read() + privatekey = crypto.load_privatekey(crypto.FILETYPE_PEM, privatekey_content) + publickey_file = open(self.path, 'w') + publickey_file.write(crypto.dump_publickey(crypto.FILETYPE_PEM, privatekey)) + publickey_file.close() except (IOError, OSError): e = get_exception() raise PublicKeyError(e) diff --git a/lib/ansible/modules/database/misc/mongodb_parameter.py b/lib/ansible/modules/database/misc/mongodb_parameter.py index 0fd77944d7c..f2b7e1fb533 100644 --- a/lib/ansible/modules/database/misc/mongodb_parameter.py +++ b/lib/ansible/modules/database/misc/mongodb_parameter.py @@ -236,4 +236,4 @@ from ansible.module_utils.basic import * from ansible.module_utils.pycompat24 import get_exception if __name__ == '__main__': - main() + main() diff --git a/lib/ansible/modules/database/mssql/mssql_db.py b/lib/ansible/modules/database/mssql/mssql_db.py index 337429e8895..4010404f479 100644 --- a/lib/ansible/modules/database/mssql/mssql_db.py +++ b/lib/ansible/modules/database/mssql/mssql_db.py @@ -194,10 +194,10 @@ def main(): cursor = conn.cursor() except Exception as e: if "Unknown database" in str(e): - errno, errstr = e.args - module.fail_json(msg="ERROR: %s %s" % (errno, errstr)) + errno, errstr = e.args + module.fail_json(msg="ERROR: %s %s" % (errno, errstr)) else: - module.fail_json(msg="unable to connect, check login_user and login_password are correct, or alternatively check your @sysconfdir@/freetds.conf / ${HOME}/.freetds.conf") + module.fail_json(msg="unable to connect, check login_user and login_password are correct, or alternatively check your @sysconfdir@/freetds.conf / ${HOME}/.freetds.conf") conn.autocommit(True) changed = False diff --git a/lib/ansible/modules/database/postgresql/postgresql_db.py b/lib/ansible/modules/database/postgresql/postgresql_db.py index 767a4d136cb..97bf5626ce4 100755 --- a/lib/ansible/modules/database/postgresql/postgresql_db.py +++ b/lib/ansible/modules/database/postgresql/postgresql_db.py @@ -223,7 +223,7 @@ def db_create(cursor, db, owner, template, encoding, lc_collate, lc_ctype): def db_matches(cursor, db, owner, template, encoding, lc_collate, lc_ctype): if not db_exists(cursor, db): - return False + return False else: db_info = get_db_info(cursor, db) if (encoding and diff --git a/lib/ansible/modules/database/vertica/vertica_role.py b/lib/ansible/modules/database/vertica/vertica_role.py index f11efcffaad..4e420b009b3 100644 --- a/lib/ansible/modules/database/vertica/vertica_role.py +++ b/lib/ansible/modules/database/vertica/vertica_role.py @@ -139,7 +139,7 @@ def update_roles(role_facts, cursor, role, def check(role_facts, role, assigned_roles): role_key = role.lower() if role_key not in role_facts: - return False + return False if assigned_roles and cmp(sorted(assigned_roles), sorted(role_facts[role_key]['assigned_roles'])) != 0: return False return True diff --git a/lib/ansible/modules/database/vertica/vertica_schema.py b/lib/ansible/modules/database/vertica/vertica_schema.py index 08380729e79..0317fc19fb2 100644 --- a/lib/ansible/modules/database/vertica/vertica_schema.py +++ b/lib/ansible/modules/database/vertica/vertica_schema.py @@ -184,12 +184,12 @@ def update_roles(schema_facts, cursor, schema, cursor.execute("create role {0}".format(role)) cursor.execute("grant usage on schema {0} to {1}".format(schema, role)) for role in set(create_required) - set(create_existing): - cursor.execute("grant create on schema {0} to {1}".format(schema, role)) + cursor.execute("grant create on schema {0} to {1}".format(schema, role)) def check(schema_facts, schema, usage_roles, create_roles, owner): schema_key = schema.lower() if schema_key not in schema_facts: - return False + return False if owner and owner.lower() == schema_facts[schema_key]['owner'].lower(): return False if cmp(sorted(usage_roles), sorted(schema_facts[schema_key]['usage_roles'])) != 0: diff --git a/lib/ansible/modules/database/vertica/vertica_user.py b/lib/ansible/modules/database/vertica/vertica_user.py index 99819c7f6c4..6afdbb8bbcf 100644 --- a/lib/ansible/modules/database/vertica/vertica_user.py +++ b/lib/ansible/modules/database/vertica/vertica_user.py @@ -195,7 +195,7 @@ def check(user_facts, user, profile, resource_pool, locked, password, expired, ldap, roles): user_key = user.lower() if user_key not in user_facts: - return False + return False if profile and profile != user_facts[user_key]['profile']: return False if resource_pool and resource_pool != user_facts[user_key]['resource_pool']: diff --git a/lib/ansible/modules/files/find.py b/lib/ansible/modules/files/find.py index 192f7cef43b..7d329bc9298 100644 --- a/lib/ansible/modules/files/find.py +++ b/lib/ansible/modules/files/find.py @@ -231,16 +231,16 @@ def contentfilter(fsname, pattern): return True try: - f = open(fsname) - prog = re.compile(pattern) - for line in f: - if prog.match (line): - f.close() - return True + f = open(fsname) + prog = re.compile(pattern) + for line in f: + if prog.match (line): + f.close() + return True - f.close() + f.close() except: - pass + pass return False @@ -337,7 +337,7 @@ def main(): fsname=os.path.normpath(os.path.join(root, fsobj)) if os.path.basename(fsname).startswith('.') and not params['hidden']: - continue + continue try: st = os.lstat(fsname) diff --git a/lib/ansible/modules/files/ini_file.py b/lib/ansible/modules/files/ini_file.py index bfc9f8537b0..303da2a5eb7 100644 --- a/lib/ansible/modules/files/ini_file.py +++ b/lib/ansible/modules/files/ini_file.py @@ -134,17 +134,17 @@ from ansible.module_utils.basic import AnsibleModule # match_opt def match_opt(option, line): - option = re.escape(option) - return re.match(' *%s( |\t)*=' % option, line) \ - or re.match('# *%s( |\t)*=' % option, line) \ - or re.match('; *%s( |\t)*=' % option, line) + option = re.escape(option) + return re.match(' *%s( |\t)*=' % option, line) \ + or re.match('# *%s( |\t)*=' % option, line) \ + or re.match('; *%s( |\t)*=' % option, line) # ============================================================== # match_active_opt def match_active_opt(option, line): - option = re.escape(option) - return re.match(' *%s( |\t)*=' % option, line) + option = re.escape(option) + return re.match(' *%s( |\t)*=' % option, line) # ============================================================== # do_ini diff --git a/lib/ansible/modules/files/synchronize.py b/lib/ansible/modules/files/synchronize.py index 4a7933adf1d..ce2585c8888 100644 --- a/lib/ansible/modules/files/synchronize.py +++ b/lib/ansible/modules/files/synchronize.py @@ -443,10 +443,10 @@ def main(): ssh_opts = '-S none' if not verify_host: - ssh_opts = '%s -o StrictHostKeyChecking=no' % ssh_opts + ssh_opts = '%s -o StrictHostKeyChecking=no' % ssh_opts if ssh_args: - ssh_opts = '%s %s' % (ssh_opts, ssh_args) + ssh_opts = '%s %s' % (ssh_opts, ssh_args) if source.startswith('"rsync://') and dest.startswith('"rsync://'): module.fail_json(msg='either src or dest must be a localhost', rc=1) diff --git a/lib/ansible/modules/files/unarchive.py b/lib/ansible/modules/files/unarchive.py index 57aa1fab0c9..779be1ee532 100644 --- a/lib/ansible/modules/files/unarchive.py +++ b/lib/ansible/modules/files/unarchive.py @@ -591,7 +591,7 @@ class TgzArchive(object): self.opts = module.params['extra_opts'] self.module = module if self.module.check_mode: - self.module.exit_json(skipped=True, msg="remote module (%s) does not support check mode when using gtar" % self.module._name) + self.module.exit_json(skipped=True, msg="remote module (%s) does not support check mode when using gtar" % self.module._name) self.excludes = [ path.rstrip('/') for path in self.module.params['exclude']] # Prefer gtar (GNU tar) as it supports the compression options -z, -j and -J self.cmd_path = self.module.get_bin_path('gtar', None) diff --git a/lib/ansible/modules/monitoring/datadog_monitor.py b/lib/ansible/modules/monitoring/datadog_monitor.py index 50a067d8a2a..2c3c3bd9af5 100644 --- a/lib/ansible/modules/monitoring/datadog_monitor.py +++ b/lib/ansible/modules/monitoring/datadog_monitor.py @@ -307,7 +307,7 @@ def delete_monitor(module): def mute_monitor(module): monitor = _get_monitor(module) if not monitor: - module.fail_json(msg="Monitor %s not found!" % module.params['name']) + module.fail_json(msg="Monitor %s not found!" % module.params['name']) elif monitor['options']['silenced']: module.fail_json(msg="Monitor is already muted. Datadog does not allow to modify muted alerts, consider unmuting it first.") elif (module.params['silenced'] is not None @@ -327,7 +327,7 @@ def mute_monitor(module): def unmute_monitor(module): monitor = _get_monitor(module) if not monitor: - module.fail_json(msg="Monitor %s not found!" % module.params['name']) + module.fail_json(msg="Monitor %s not found!" % module.params['name']) elif not monitor['options']['silenced']: module.exit_json(changed=False) try: diff --git a/lib/ansible/modules/monitoring/librato_annotation.py b/lib/ansible/modules/monitoring/librato_annotation.py index 3f3e2e35ccf..448ba1307b8 100644 --- a/lib/ansible/modules/monitoring/librato_annotation.py +++ b/lib/ansible/modules/monitoring/librato_annotation.py @@ -144,21 +144,21 @@ def post_annotation(module): def main(): - module = AnsibleModule( - argument_spec = dict( - user = dict(required=True), - api_key = dict(required=True), - name = dict(required=False), - title = dict(required=True), - source = dict(required=False), - description = dict(required=False), - start_time = dict(required=False, default=None, type='int'), - end_time = dict(require=False, default=None, type='int'), - links = dict(type='list') - ) - ) + module = AnsibleModule( + argument_spec = dict( + user = dict(required=True), + api_key = dict(required=True), + name = dict(required=False), + title = dict(required=True), + source = dict(required=False), + description = dict(required=False), + start_time = dict(required=False, default=None, type='int'), + end_time = dict(require=False, default=None, type='int'), + links = dict(type='list') + ) + ) - post_annotation(module) + post_annotation(module) from ansible.module_utils.basic import * from ansible.module_utils.urls import * diff --git a/lib/ansible/modules/monitoring/logicmonitor_facts.py b/lib/ansible/modules/monitoring/logicmonitor_facts.py index ff0954d2510..dbcd139159a 100644 --- a/lib/ansible/modules/monitoring/logicmonitor_facts.py +++ b/lib/ansible/modules/monitoring/logicmonitor_facts.py @@ -567,8 +567,8 @@ def selector(module): to take given the right parameters""" if module.params["target"] == "host": - target = Host(module.params, module) - target.site_facts() + target = Host(module.params, module) + target.site_facts() elif module.params["target"] == "hostgroup": # Validate target specific required parameters if module.params["fullpath"] is not None: diff --git a/lib/ansible/modules/monitoring/sensu_check.py b/lib/ansible/modules/monitoring/sensu_check.py index 9c8e702c144..63a38c6f739 100644 --- a/lib/ansible/modules/monitoring/sensu_check.py +++ b/lib/ansible/modules/monitoring/sensu_check.py @@ -286,29 +286,29 @@ def sensu_check(module, path, name, state='present', backup=False): reasons.append('`{opt}\' was removed'.format(opt=opt)) if module.params['custom']: - # Convert to json - custom_params = module.params['custom'] - overwrited_fields = set(custom_params.keys()) & set(simple_opts + ['type','subdue','subdue_begin','subdue_end']) - if overwrited_fields: - msg = 'You can\'t overwriting standard module parameters via "custom". You are trying overwrite: {opt}'.format(opt=list(overwrited_fields)) - module.fail_json(msg=msg) + # Convert to json + custom_params = module.params['custom'] + overwrited_fields = set(custom_params.keys()) & set(simple_opts + ['type','subdue','subdue_begin','subdue_end']) + if overwrited_fields: + msg = 'You can\'t overwriting standard module parameters via "custom". You are trying overwrite: {opt}'.format(opt=list(overwrited_fields)) + module.fail_json(msg=msg) - for k,v in custom_params.items(): - if k in config['checks'][name]: - if not config['checks'][name][k] == v: - changed = True - reasons.append('`custom param {opt}\' was changed'.format(opt=k)) - else: - changed = True - reasons.append('`custom param {opt}\' was added'.format(opt=k)) - check[k] = v - simple_opts += custom_params.keys() + for k,v in custom_params.items(): + if k in config['checks'][name]: + if not config['checks'][name][k] == v: + changed = True + reasons.append('`custom param {opt}\' was changed'.format(opt=k)) + else: + changed = True + reasons.append('`custom param {opt}\' was added'.format(opt=k)) + check[k] = v + simple_opts += custom_params.keys() # Remove obsolete custom params for opt in set(config['checks'][name].keys()) - set(simple_opts + ['type','subdue','subdue_begin','subdue_end']): - changed = True - reasons.append('`custom param {opt}\' was deleted'.format(opt=opt)) - del check[opt] + changed = True + reasons.append('`custom param {opt}\' was deleted'.format(opt=opt)) + del check[opt] if module.params['metric']: if 'type' not in check or check['type'] != 'metric': diff --git a/lib/ansible/modules/network/basics/uri.py b/lib/ansible/modules/network/basics/uri.py index 02ed27c74a6..0db1305b33c 100644 --- a/lib/ansible/modules/network/basics/uri.py +++ b/lib/ansible/modules/network/basics/uri.py @@ -405,7 +405,7 @@ def main(): body = json.dumps(body) lower_header_keys = [key.lower() for key in dict_headers] if 'content-type' not in lower_header_keys: - dict_headers['Content-Type'] = 'application/json' + dict_headers['Content-Type'] = 'application/json' # Grab all the http headers. Need this hack since passing multi-values is # currently a bit ugly. (e.g. headers='{"Content-Type":"application/json"}') diff --git a/lib/ansible/modules/network/cloudflare_dns.py b/lib/ansible/modules/network/cloudflare_dns.py index 87cc854cdde..e381fd2deff 100644 --- a/lib/ansible/modules/network/cloudflare_dns.py +++ b/lib/ansible/modules/network/cloudflare_dns.py @@ -514,10 +514,10 @@ class CloudflareAPI(object): def ensure_dns_record(self,**kwargs): params = {} for param in ['port','priority','proto','proxied','service','ttl','type','record','value','weight','zone']: - if param in kwargs: - params[param] = kwargs[param] - else: - params[param] = getattr(self,param) + if param in kwargs: + params[param] = kwargs[param] + else: + params[param] = getattr(self,param) search_value = params['value'] search_record = params['record'] diff --git a/lib/ansible/modules/network/cumulus/cl_license.py b/lib/ansible/modules/network/cumulus/cl_license.py index a0656e0abce..9316b580abe 100644 --- a/lib/ansible/modules/network/cumulus/cl_license.py +++ b/lib/ansible/modules/network/cumulus/cl_license.py @@ -112,10 +112,10 @@ CL_LICENSE_PATH='/usr/cumulus/bin/cl-license' def install_license(module): # license is not installed, install it - _url = module.params.get('src') - (_rc, out, _err) = module.run_command("%s -i %s" % (CL_LICENSE_PATH, _url)) - if _rc > 0: - module.fail_json(msg=_err) + _url = module.params.get('src') + (_rc, out, _err) = module.run_command("%s -i %s" % (CL_LICENSE_PATH, _url)) + if _rc > 0: + module.fail_json(msg=_err) def main(): diff --git a/lib/ansible/modules/network/dellos9/dellos9_facts.py b/lib/ansible/modules/network/dellos9/dellos9_facts.py index 8f211e6d215..015138f6b66 100644 --- a/lib/ansible/modules/network/dellos9/dellos9_facts.py +++ b/lib/ansible/modules/network/dellos9/dellos9_facts.py @@ -431,8 +431,8 @@ class Interfaces(FactsBase): match = re.search(r'Internet address is (\S+)', data) if match: if match.group(1) != "not": - addr, masklen = match.group(1).split('/') - return dict(address=addr, masklen=int(masklen)) + addr, masklen = match.group(1).split('/') + return dict(address=addr, masklen=int(masklen)) def parse_mtu(self, data): match = re.search(r'MTU (\d+)', data) @@ -463,7 +463,7 @@ class Interfaces(FactsBase): def parse_lineprotocol(self, data): match = re.search(r'line protocol is (\w+[ ]?\w*)\(?.*\)?$', data, re.M) if match: - return match.group(1) + return match.group(1) def parse_operstatus(self, data): match = re.search(r'^(?:.+) is (.+),', data, re.M) diff --git a/lib/ansible/modules/network/exoscale/exo_dns_record.py b/lib/ansible/modules/network/exoscale/exo_dns_record.py index c76c1c7a0fe..960cbf871dc 100644 --- a/lib/ansible/modules/network/exoscale/exo_dns_record.py +++ b/lib/ansible/modules/network/exoscale/exo_dns_record.py @@ -343,7 +343,7 @@ class ExoDnsRecord(ExoDns): self.result['diff']['before'] = record self.result['changed'] = True if not self.module.check_mode: - self.api_query("/domains/%s/records/%s" % (self.domain, record['record']['id']), "DELETE") + self.api_query("/domains/%s/records/%s" % (self.domain, record['record']['id']), "DELETE") return record def get_result(self, resource): diff --git a/lib/ansible/modules/network/f5/bigip_node.py b/lib/ansible/modules/network/f5/bigip_node.py index 08107f6e2ce..a40b5455295 100644 --- a/lib/ansible/modules/network/f5/bigip_node.py +++ b/lib/ansible/modules/network/f5/bigip_node.py @@ -342,7 +342,7 @@ def main(): if monitors: monitors = [] for monitor in module.params['monitors']: - monitors.append(fq_name(partition, monitor)) + monitors.append(fq_name(partition, monitor)) # sanity check user supplied values if state == 'absent' and host is not None: diff --git a/lib/ansible/modules/network/haproxy.py b/lib/ansible/modules/network/haproxy.py index df26da87a20..5bd5e4e72f0 100644 --- a/lib/ansible/modules/network/haproxy.py +++ b/lib/ansible/modules/network/haproxy.py @@ -186,7 +186,7 @@ WAIT_INTERVAL=5 ###################################################################### class TimeoutException(Exception): - pass + pass class HAProxy(object): """ @@ -356,8 +356,8 @@ class HAProxy(object): # Report change status if state_before != state_after: - self.command_results['changed'] = True - self.module.exit_json(**self.command_results) + self.command_results['changed'] = True + self.module.exit_json(**self.command_results) else: self.command_results['changed'] = False self.module.exit_json(**self.command_results) diff --git a/lib/ansible/modules/notification/flowdock.py b/lib/ansible/modules/notification/flowdock.py index a16d3041226..08049c05bcd 100644 --- a/lib/ansible/modules/notification/flowdock.py +++ b/lib/ansible/modules/notification/flowdock.py @@ -163,7 +163,7 @@ def main(): if type == 'chat': module.fail_json(msg="%s is not valid for the 'chat' type" % item) else: - params[item] = module.params[item] + params[item] = module.params[item] elif type == 'inbox': module.fail_json(msg="%s is required for the 'inbox' type" % item) diff --git a/lib/ansible/modules/notification/mail.py b/lib/ansible/modules/notification/mail.py index f6d113d40a5..d1b5f9994e4 100644 --- a/lib/ansible/modules/notification/mail.py +++ b/lib/ansible/modules/notification/mail.py @@ -285,7 +285,7 @@ def main(): e = get_exception() module.fail_json(rc=1, msg='Unable to start an encrypted session to %s:%s: %s' % (host, port, e)) else: - module.fail_json(rc=1, msg='Unable to Connect to %s:%s: %s' % (host, port, e)) + module.fail_json(rc=1, msg='Unable to Connect to %s:%s: %s' % (host, port, e)) if (secure == 'always'): diff --git a/lib/ansible/modules/packaging/language/cpanm.py b/lib/ansible/modules/packaging/language/cpanm.py index 59677698069..5fee9b3b5cb 100644 --- a/lib/ansible/modules/packaging/language/cpanm.py +++ b/lib/ansible/modules/packaging/language/cpanm.py @@ -140,14 +140,14 @@ def _is_package_installed(module, name, locallib, cpanm, version): os.environ["PERL5LIB"] = "%s/lib/perl5" % locallib cmd = "%s perl -e ' use %s" % (cmd, name) if version: - cmd = "%s %s;'" % (cmd, version) + cmd = "%s %s;'" % (cmd, version) else: - cmd = "%s;'" % cmd + cmd = "%s;'" % cmd res, stdout, stderr = module.run_command(cmd, check_rc=False) if res == 0: - return True + return True else: - return False + return False def _build_cmd_line(name, from_path, notest, locallib, mirror, mirror_only, installdeps, cpanm, use_sudo): # this code should use "%s" like everything else and just return early but not fixing all of it now. diff --git a/lib/ansible/modules/packaging/language/maven_artifact.py b/lib/ansible/modules/packaging/language/maven_artifact.py index dd9bf1539b4..727c171117b 100644 --- a/lib/ansible/modules/packaging/language/maven_artifact.py +++ b/lib/ansible/modules/packaging/language/maven_artifact.py @@ -265,11 +265,11 @@ class MavenDownloader: url_to_use = url parsed_url = urlparse(url) if parsed_url.scheme=='s3': - parsed_url = urlparse(url) - bucket_name = parsed_url.netloc - key_name = parsed_url.path[1:] - client = boto3.client('s3',aws_access_key_id=self.module.params.get('username', ''), aws_secret_access_key=self.module.params.get('password', '')) - url_to_use = client.generate_presigned_url('get_object',Params={'Bucket':bucket_name,'Key':key_name},ExpiresIn=10) + parsed_url = urlparse(url) + bucket_name = parsed_url.netloc + key_name = parsed_url.path[1:] + client = boto3.client('s3',aws_access_key_id=self.module.params.get('username', ''), aws_secret_access_key=self.module.params.get('password', '')) + url_to_use = client.generate_presigned_url('get_object',Params={'Bucket':bucket_name,'Key':key_name},ExpiresIn=10) req_timeout = self.module.params.get('timeout') diff --git a/lib/ansible/modules/packaging/os/dpkg_selections.py b/lib/ansible/modules/packaging/os/dpkg_selections.py index f26ad68f02d..22607cc2097 100644 --- a/lib/ansible/modules/packaging/os/dpkg_selections.py +++ b/lib/ansible/modules/packaging/os/dpkg_selections.py @@ -72,7 +72,7 @@ def main(): changed = current != selection if module.check_mode or not changed: - module.exit_json(changed=changed, before=current, after=selection) + module.exit_json(changed=changed, before=current, after=selection) module.run_command([dpkg, '--set-selections'], data="%s %s" % (name, selection), check_rc=True) module.exit_json(changed=changed, before=current, after=selection) diff --git a/lib/ansible/modules/packaging/os/pkgin.py b/lib/ansible/modules/packaging/os/pkgin.py index 4a51c079eb7..ff74eec84d2 100755 --- a/lib/ansible/modules/packaging/os/pkgin.py +++ b/lib/ansible/modules/packaging/os/pkgin.py @@ -318,7 +318,7 @@ def do_upgrade_packages(module, full=False): module.fail_json(msg="could not %s packages" % cmd) def upgrade_packages(module): - do_upgrade_packages(module) + do_upgrade_packages(module) def full_upgrade_packages(module): do_upgrade_packages(module, True) diff --git a/lib/ansible/modules/remote_management/foreman/katello.py b/lib/ansible/modules/remote_management/foreman/katello.py index 6d2bf446aea..4926e73a055 100644 --- a/lib/ansible/modules/remote_management/foreman/katello.py +++ b/lib/ansible/modules/remote_management/foreman/katello.py @@ -320,7 +320,7 @@ class NailGun(object): if len(repository) == 0: if 'releasever' in params: - reposet.enable(data={'basearch': params['basearch'], 'releasever': params['releasever']}) + reposet.enable(data={'basearch': params['basearch'], 'releasever': params['releasever']}) else: reposet.enable(data={'basearch': params['basearch']}) diff --git a/lib/ansible/modules/remote_management/stacki/stacki_host.py b/lib/ansible/modules/remote_management/stacki/stacki_host.py index d80e7d1f17c..7bae22c0e9d 100644 --- a/lib/ansible/modules/remote_management/stacki/stacki_host.py +++ b/lib/ansible/modules/remote_management/stacki/stacki_host.py @@ -134,9 +134,9 @@ class StackiHost: init_csrftoken = None for c in cookie_a: if "csrftoken" in c: - init_csrftoken = c.replace("csrftoken=", "") - init_csrftoken = init_csrftoken.rstrip("\r\n") - break + init_csrftoken = c.replace("csrftoken=", "") + init_csrftoken = init_csrftoken.rstrip("\r\n") + break # Make Header Dictionary with initial CSRF header = {'csrftoken': init_csrftoken, 'X-CSRFToken': init_csrftoken, diff --git a/lib/ansible/modules/system/firewalld.py b/lib/ansible/modules/system/firewalld.py index ec426829627..95063a10a1b 100644 --- a/lib/ansible/modules/system/firewalld.py +++ b/lib/ansible/modules/system/firewalld.py @@ -279,7 +279,7 @@ def set_port_disabled_permanent(zone, port, protocol): def get_source(zone, source): fw_zone, fw_settings = get_fw_zone_settings(zone) if source in fw_settings.getSources(): - return True + return True else: return False @@ -317,7 +317,7 @@ def get_interface_permanent(zone, interface): fw_zone, fw_settings = get_fw_zone_settings(zone) if interface in fw_settings.getInterfaces(): - return True + return True else: return False diff --git a/lib/ansible/modules/system/lvg.py b/lib/ansible/modules/system/lvg.py index ad15d50e258..756d5be464c 100644 --- a/lib/ansible/modules/system/lvg.py +++ b/lib/ansible/modules/system/lvg.py @@ -102,13 +102,13 @@ def parse_vgs(data): return vgs def find_mapper_device_name(module, dm_device): - dmsetup_cmd = module.get_bin_path('dmsetup', True) - mapper_prefix = '/dev/mapper/' - rc, dm_name, err = module.run_command("%s info -C --noheadings -o name %s" % (dmsetup_cmd, dm_device)) - if rc != 0: - module.fail_json(msg="Failed executing dmsetup command.", rc=rc, err=err) - mapper_device = mapper_prefix + dm_name.rstrip() - return mapper_device + dmsetup_cmd = module.get_bin_path('dmsetup', True) + mapper_prefix = '/dev/mapper/' + rc, dm_name, err = module.run_command("%s info -C --noheadings -o name %s" % (dmsetup_cmd, dm_device)) + if rc != 0: + module.fail_json(msg="Failed executing dmsetup command.", rc=rc, err=err) + mapper_device = mapper_prefix + dm_name.rstrip() + return mapper_device def parse_pvs(module, data): pvs = [] diff --git a/lib/ansible/modules/system/lvol.py b/lib/ansible/modules/system/lvol.py index 8718dfa9f0f..afe36839ce2 100644 --- a/lib/ansible/modules/system/lvol.py +++ b/lib/ansible/modules/system/lvol.py @@ -315,15 +315,15 @@ def main(): if not '%' in size: # LVCREATE(8) -L --size option unit if size[-1].lower() in 'bskmgtpe': - size_unit = size[-1].lower() - size = size[0:-1] + size_unit = size[-1].lower() + size = size[0:-1] try: - float(size) - if not size[0].isdigit(): - raise ValueError() + float(size) + if not size[0].isdigit(): + raise ValueError() except ValueError: - module.fail_json(msg="Bad size specification of '%s'" % size) + module.fail_json(msg="Bad size specification of '%s'" % size) # when no unit, megabytes by default if size_opt == 'l': diff --git a/lib/ansible/modules/system/osx_defaults.py b/lib/ansible/modules/system/osx_defaults.py index 340f203b395..4c2c26cc112 100644 --- a/lib/ansible/modules/system/osx_defaults.py +++ b/lib/ansible/modules/system/osx_defaults.py @@ -326,10 +326,10 @@ class OSXDefaults(object): # Current value matches the given value. Nothing need to be done. Arrays need extra care if self.type == "array" and self.current_value is not None and not self.array_add and \ set(self.current_value) == set(self.value): - return False + return False elif self.type == "array" and self.current_value is not None and self.array_add and \ len(list(set(self.value) - set(self.current_value))) == 0: - return False + return False elif self.current_value == self.value: return False diff --git a/lib/ansible/modules/system/ufw.py b/lib/ansible/modules/system/ufw.py index 4d5e3d01537..92cd06ca2ee 100644 --- a/lib/ansible/modules/system/ufw.py +++ b/lib/ansible/modules/system/ufw.py @@ -276,7 +276,7 @@ def main(): module.fail_json(msg="Not any of the command arguments %s given" % commands) if(params['interface'] is not None and params['direction'] is None): - module.fail_json(msg="Direction must be specified when creating a rule on an interface") + module.fail_json(msg="Direction must be specified when creating a rule on an interface") # Ensure ufw is available ufw_bin = module.get_bin_path('ufw', True) diff --git a/lib/ansible/modules/system/user.py b/lib/ansible/modules/system/user.py index 6ce4bad2479..bd1f0d0e64d 100644 --- a/lib/ansible/modules/system/user.py +++ b/lib/ansible/modules/system/user.py @@ -1419,8 +1419,8 @@ class SunOS(User): cmd.append(','.join(new_groups)) if self.comment is not None and info[4] != self.comment: - cmd.append('-c') - cmd.append(self.comment) + cmd.append('-c') + cmd.append(self.comment) if self.home is not None and info[5] != self.home: if self.move_home: @@ -1563,7 +1563,7 @@ class DarwinUser(User): if max_uid < current_uid: max_uid = current_uid if max_system_uid < current_uid and current_uid < 500: - max_system_uid = current_uid + max_system_uid = current_uid if system and (0 < max_system_uid < 499): return max_system_uid + 1 @@ -1923,8 +1923,8 @@ class AIX(User): cmd.append(','.join(groups)) if self.comment is not None and info[4] != self.comment: - cmd.append('-c') - cmd.append(self.comment) + cmd.append('-c') + cmd.append(self.comment) if self.home is not None and info[5] != self.home: if self.move_home: diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index 65c40b44da3..148b5f5f34a 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -395,9 +395,9 @@ class PlayContext(Base): # become legacy updates -- from commandline if not new_info.become_pass: if new_info.become_method == 'sudo' and new_info.sudo_pass: - setattr(new_info, 'become_pass', new_info.sudo_pass) + setattr(new_info, 'become_pass', new_info.sudo_pass) elif new_info.become_method == 'su' and new_info.su_pass: - setattr(new_info, 'become_pass', new_info.su_pass) + setattr(new_info, 'become_pass', new_info.su_pass) # become legacy updates -- from inventory file (inventory overrides # commandline) diff --git a/lib/ansible/playbook/playbook_include.py b/lib/ansible/playbook/playbook_include.py index 139ea2048ee..dc0ee076d4e 100644 --- a/lib/ansible/playbook/playbook_include.py +++ b/lib/ansible/playbook/playbook_include.py @@ -127,7 +127,7 @@ class PlaybookInclude(Base, Conditional, Taggable): ''' if v is None: - raise AnsibleParserError("include parameter is missing", obj=ds) + raise AnsibleParserError("include parameter is missing", obj=ds) # The include line must include at least one item, which is the filename # to include. Anything after that should be regarded as a parameter to the include diff --git a/lib/ansible/playbook/role/metadata.py b/lib/ansible/playbook/role/metadata.py index a9206605ade..0a77849490f 100644 --- a/lib/ansible/playbook/role/metadata.py +++ b/lib/ansible/playbook/role/metadata.py @@ -71,17 +71,17 @@ class RoleMetadata(Base): raise AnsibleParserError("Expected role dependencies to be a list.", obj=self._ds) for role_def in ds: - if isinstance(role_def, string_types) or 'role' in role_def or 'name' in role_def: - roles.append(role_def) - continue - try: + if isinstance(role_def, string_types) or 'role' in role_def or 'name' in role_def: + roles.append(role_def) + continue + try: # role_def is new style: { src: 'galaxy.role,version,name', other_vars: "here" } def_parsed = RoleRequirement.role_yaml_parse(role_def) if def_parsed.get('name'): role_def['name'] = def_parsed['name'] roles.append(role_def) - except AnsibleError as exc: - raise AnsibleParserError(str(exc), obj=role_def) + except AnsibleError as exc: + raise AnsibleParserError(str(exc), obj=role_def) current_role_path = None if self._owner: diff --git a/lib/ansible/playbook/taggable.py b/lib/ansible/playbook/taggable.py index 583983d0db1..3b8556010e0 100644 --- a/lib/ansible/playbook/taggable.py +++ b/lib/ansible/playbook/taggable.py @@ -82,7 +82,7 @@ class Taggable: should_run = False if 'always' in tags or 'all' in only_tags: - should_run = True + should_run = True elif not tags.isdisjoint(only_tags): should_run = True elif 'tagged' in only_tags and tags != self.untagged: diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 2e348972024..491ecba66db 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -452,9 +452,9 @@ class ActionBase(with_metaclass(ABCMeta, object)): if mystat.get('failed'): msg = mystat.get('module_stderr') if not msg: - msg = mystat.get('module_stdout') + msg = mystat.get('module_stdout') if not msg: - msg = mystat.get('msg') + msg = mystat.get('msg') raise AnsibleError('Failed to get information on remote file (%s): %s' % (path, msg)) if not mystat['stat']['exists']: diff --git a/lib/ansible/plugins/action/add_host.py b/lib/ansible/plugins/action/add_host.py index 369be10ef41..2b720f3d979 100644 --- a/lib/ansible/plugins/action/add_host.py +++ b/lib/ansible/plugins/action/add_host.py @@ -70,11 +70,11 @@ class ActionModule(ActionBase): new_groups = [] if groups: if isinstance(groups, list): - group_list = groups + group_list = groups elif isinstance(groups, string_types): - group_list = groups.split(",") + group_list = groups.split(",") else: - raise AnsibleError("Groups must be specfied as a list.", obj=self._task) + raise AnsibleError("Groups must be specfied as a list.", obj=self._task) for group_name in group_list: if group_name not in new_groups: diff --git a/lib/ansible/plugins/filter/ipaddr.py b/lib/ansible/plugins/filter/ipaddr.py index 4837f9d7f6c..39894d467c5 100644 --- a/lib/ansible/plugins/filter/ipaddr.py +++ b/lib/ansible/plugins/filter/ipaddr.py @@ -332,7 +332,7 @@ def ipaddr(value, query = '', version = False, alias = 'ipaddr'): _ret = [] for element in value: if ipaddr(element, str(query), version): - _ret.append(ipaddr(element, str(query), version)) + _ret.append(ipaddr(element, str(query), version)) if _ret: return _ret @@ -587,7 +587,7 @@ def nthhost(value, query=''): try: nth = int(query) if value.size > nth: - return value[nth] + return value[nth] except ValueError: return False diff --git a/lib/ansible/plugins/lookup/first_found.py b/lib/ansible/plugins/lookup/first_found.py index 1e6a17be8e0..8d495241aef 100644 --- a/lib/ansible/plugins/lookup/first_found.py +++ b/lib/ansible/plugins/lookup/first_found.py @@ -178,7 +178,7 @@ class LookupModule(LookupBase): except (AnsibleUndefinedVariable, UndefinedError): continue - # get subdir if set by task executor, default to files otherwise + # get subdir if set by task executor, default to files otherwise subdir = getattr(self, '_subdir', 'files') path = None path = self.find_file_in_search_path(variables, subdir, fn, ignore_missing=True) diff --git a/lib/ansible/plugins/lookup/hashi_vault.py b/lib/ansible/plugins/lookup/hashi_vault.py index 72378f5dbc1..cc171722625 100644 --- a/lib/ansible/plugins/lookup/hashi_vault.py +++ b/lib/ansible/plugins/lookup/hashi_vault.py @@ -102,9 +102,9 @@ class LookupModule(LookupBase): vault_conn = HashiVault(**vault_dict) for term in terms: - key = term.split()[0] - value = vault_conn.get() - ret.append(value) + key = term.split()[0] + value = vault_conn.get() + ret.append(value) return ret diff --git a/lib/ansible/plugins/lookup/mongodb.py b/lib/ansible/plugins/lookup/mongodb.py index ded9495a67c..08b7a892368 100644 --- a/lib/ansible/plugins/lookup/mongodb.py +++ b/lib/ansible/plugins/lookup/mongodb.py @@ -161,7 +161,7 @@ class LookupModule(LookupBase): ret.append(result) except ConnectionFailure as e: - raise AnsibleError('unable to connect to database: %s' % str(e)) + raise AnsibleError('unable to connect to database: %s' % str(e)) diff --git a/lib/ansible/plugins/strategy/__init__.py b/lib/ansible/plugins/strategy/__init__.py index afa7103020d..8b277638d65 100644 --- a/lib/ansible/plugins/strategy/__init__.py +++ b/lib/ansible/plugins/strategy/__init__.py @@ -466,11 +466,11 @@ class StrategyBase: # and if none were found, then we raise an error if not found: - msg = "The requested handler '%s' was not found in either the main handlers list nor in the listening handlers list" % handler_name - if C.ERROR_ON_MISSING_HANDLER: - raise AnsibleError(msg) - else: - display.warning(msg) + msg = "The requested handler '%s' was not found in either the main handlers list nor in the listening handlers list" % handler_name + if C.ERROR_ON_MISSING_HANDLER: + raise AnsibleError(msg) + else: + display.warning(msg) if 'add_host' in result_item: # this task added a new host (add_host module) diff --git a/lib/ansible/template/__init__.py b/lib/ansible/template/__init__.py index e3d7bc14bef..2704eb915b0 100644 --- a/lib/ansible/template/__init__.py +++ b/lib/ansible/template/__init__.py @@ -453,7 +453,7 @@ class Templar: try: self.template(data) except: - templatable = False + templatable = False return templatable def _contains_vars(self, data): diff --git a/lib/ansible/utils/color.py b/lib/ansible/utils/color.py index 1c1c0468015..f32a5300777 100644 --- a/lib/ansible/utils/color.py +++ b/lib/ansible/utils/color.py @@ -40,7 +40,7 @@ else: ANSIBLE_COLOR=False if C.ANSIBLE_FORCE_COLOR: - ANSIBLE_COLOR=True + ANSIBLE_COLOR=True # --- begin "pretty" # diff --git a/lib/ansible/vars/__init__.py b/lib/ansible/vars/__init__.py index 70dd6ad0e49..cc987315cda 100644 --- a/lib/ansible/vars/__init__.py +++ b/lib/ansible/vars/__init__.py @@ -301,7 +301,7 @@ class VariableManager: # the with_first_found mechanism. vars_file_list = vars_file_item if not isinstance(vars_file_list, list): - vars_file_list = [ vars_file_list ] + vars_file_list = [ vars_file_list ] # now we iterate through the (potential) files, and break out # as soon as we read one from the list. If none are found, we diff --git a/test/integration/cleanup_ec2.py b/test/integration/cleanup_ec2.py index 64178394a67..bee099633b3 100644 --- a/test/integration/cleanup_ec2.py +++ b/test/integration/cleanup_ec2.py @@ -43,7 +43,7 @@ def delete_autoscaling_group(get_func, attr, opts): if tmp_groups: tmp_group = tmp_groups[0] if not tmp_group.instances: - instances = False + instances = False time.sleep(10) group.delete() @@ -55,15 +55,15 @@ def delete_aws_eips(get_func, attr, opts): # the file might not be there if the integration test wasn't run try: - eip_log = open(opts.eip_log, 'r').read().splitlines() + eip_log = open(opts.eip_log, 'r').read().splitlines() except IOError: - print('%s not found.' % opts.eip_log) - return + print('%s not found.' % opts.eip_log) + return for item in get_func(): val = getattr(item, attr) if val in eip_log: - prompt_and_delete(item, "Delete matching %s? [y/n]: " % (item,), opts.assumeyes) + prompt_and_delete(item, "Delete matching %s? [y/n]: " % (item,), opts.assumeyes) def delete_aws_instances(reservation, opts): for list in reservation: diff --git a/test/integration/cleanup_gce.py b/test/integration/cleanup_gce.py index c807ebb81a6..4c36072bb85 100644 --- a/test/integration/cleanup_gce.py +++ b/test/integration/cleanup_gce.py @@ -63,15 +63,15 @@ if __name__ == '__main__': gce = gce_credentials.get_gce_driver(opts) try: - # Delete matching instances - delete_gce_resources(gce.list_nodes, 'name', opts) - # Delete matching snapshots - def get_snapshots(): - for volume in gce.list_volumes(): - for snapshot in gce.list_volume_snapshots(volume): - yield snapshot - delete_gce_resources(get_snapshots, 'name', opts) - # Delete matching disks - delete_gce_resources(gce.list_volumes, 'name', opts) + # Delete matching instances + delete_gce_resources(gce.list_nodes, 'name', opts) + # Delete matching snapshots + def get_snapshots(): + for volume in gce.list_volumes(): + for snapshot in gce.list_volume_snapshots(volume): + yield snapshot + delete_gce_resources(get_snapshots, 'name', opts) + # Delete matching disks + delete_gce_resources(gce.list_volumes, 'name', opts) except KeyboardInterrupt as e: print("\nExiting on user command.") diff --git a/test/integration/setup_gce.py b/test/integration/setup_gce.py index 8aa8babb2d3..2f346d0f408 100644 --- a/test/integration/setup_gce.py +++ b/test/integration/setup_gce.py @@ -24,7 +24,7 @@ def parse_args(): (opts, args) = parser.parse_args() gce_credentials.check_required(opts, parser) if not args: - parser.error("Missing required argument: name prefix") + parser.error("Missing required argument: name prefix") return (opts, args) if __name__ == '__main__': @@ -33,10 +33,10 @@ if __name__ == '__main__': gce = gce_credentials.get_gce_driver(opts) prefix = args[0].lower() try: - base_volume = gce.create_volume( - size=10, name=prefix+'-base', location='us-central1-a') - gce.create_volume_snapshot(base_volume, name=prefix+'-snapshot') - gce.create_volume( - size=10, name=prefix+'-extra', location='us-central1-a') + base_volume = gce.create_volume( + size=10, name=prefix+'-base', location='us-central1-a') + gce.create_volume_snapshot(base_volume, name=prefix+'-snapshot') + gce.create_volume( + size=10, name=prefix+'-extra', location='us-central1-a') except KeyboardInterrupt as e: print("\nExiting on user command.") diff --git a/test/sanity/pep8/legacy-files.txt b/test/sanity/pep8/legacy-files.txt index 23ec2543d69..0e8fb90f8dd 100644 --- a/test/sanity/pep8/legacy-files.txt +++ b/test/sanity/pep8/legacy-files.txt @@ -6,9 +6,6 @@ contrib/inventory/ec2.py contrib/inventory/mdt_dynamic_inventory.py contrib/inventory/openvz.py contrib/inventory/rax.py -contrib/inventory/softlayer.py -contrib/inventory/vbox.py -contrib/inventory/zone.py hacking/metadata-tool.py hacking/module_formatter.py lib/ansible/cli/__init__.py @@ -23,11 +20,8 @@ lib/ansible/executor/task_executor.py lib/ansible/galaxy/role.py lib/ansible/inventory/dir.py lib/ansible/inventory/script.py -lib/ansible/module_utils/azure_rm_common.py lib/ansible/module_utils/basic.py -lib/ansible/module_utils/docker_common.py lib/ansible/module_utils/ec2.py -lib/ansible/module_utils/eos.py lib/ansible/module_utils/f5.py lib/ansible/module_utils/facts.py lib/ansible/module_utils/known_hosts.py @@ -53,7 +47,6 @@ 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 lib/ansible/modules/cloud/amazon/ec2_lc.py -lib/ansible/modules/cloud/amazon/ec2_lc_facts.py lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py lib/ansible/modules/cloud/amazon/ec2_remote_facts.py lib/ansible/modules/cloud/amazon/ec2_scaling_policy.py @@ -61,7 +54,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.py lib/ansible/modules/cloud/amazon/ec2_vol_facts.py -lib/ansible/modules/cloud/amazon/ec2_vpc_dhcp_options.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 @@ -74,7 +66,6 @@ lib/ansible/modules/cloud/amazon/ec2_vpc_vgw_facts.py lib/ansible/modules/cloud/amazon/ec2_win_password.py lib/ansible/modules/cloud/amazon/ecs_service.py lib/ansible/modules/cloud/amazon/ecs_service_facts.py -lib/ansible/modules/cloud/amazon/ecs_task.py lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py lib/ansible/modules/cloud/amazon/elasticache.py lib/ansible/modules/cloud/amazon/iam.py @@ -98,7 +89,6 @@ lib/ansible/modules/cloud/amazon/sts_assume_role.py lib/ansible/modules/cloud/amazon/sts_session_token.py lib/ansible/modules/cloud/azure/azure.py lib/ansible/modules/cloud/azure/azure_rm_deployment.py -lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py lib/ansible/modules/cloud/azure/azure_rm_securitygroup.py lib/ansible/modules/cloud/azure/azure_rm_securitygroup_facts.py @@ -106,7 +96,6 @@ 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_firewall.py lib/ansible/modules/cloud/cloudstack/cs_host.py lib/ansible/modules/cloud/cloudstack/cs_instance.py lib/ansible/modules/cloud/cloudstack/cs_iso.py @@ -114,11 +103,8 @@ 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/docker/docker_image.py -lib/ansible/modules/cloud/docker/docker_service.py lib/ansible/modules/cloud/google/gc_storage.py lib/ansible/modules/cloud/google/gce_img.py -lib/ansible/modules/cloud/google/gce_net.py lib/ansible/modules/cloud/google/gce_tag.py lib/ansible/modules/cloud/google/gcpubsub.py lib/ansible/modules/cloud/google/gcpubsub_facts.py @@ -127,10 +113,8 @@ lib/ansible/modules/cloud/misc/proxmox.py lib/ansible/modules/cloud/misc/proxmox_kvm.py lib/ansible/modules/cloud/misc/proxmox_template.py lib/ansible/modules/cloud/misc/serverless.py -lib/ansible/modules/cloud/misc/xenserver_facts.py lib/ansible/modules/cloud/openstack/_nova_compute.py lib/ansible/modules/cloud/openstack/os_nova_host_aggregate.py -lib/ansible/modules/cloud/openstack/os_object.py lib/ansible/modules/cloud/packet/packet_device.py lib/ansible/modules/cloud/packet/packet_sshkey.py lib/ansible/modules/cloud/profitbricks/profitbricks.py @@ -146,9 +130,7 @@ lib/ansible/modules/cloud/webfaction/webfaction_mailbox.py lib/ansible/modules/cloud/webfaction/webfaction_site.py lib/ansible/modules/clustering/consul.py lib/ansible/modules/commands/script.py -lib/ansible/modules/crypto/openssl_publickey.py lib/ansible/modules/database/influxdb/influxdb_retention_policy.py -lib/ansible/modules/database/misc/mongodb_parameter.py lib/ansible/modules/database/misc/mongodb_user.py lib/ansible/modules/database/mssql/mssql_db.py lib/ansible/modules/database/mysql/mysql_db.py @@ -160,31 +142,25 @@ lib/ansible/modules/database/postgresql/postgresql_ext.py lib/ansible/modules/database/postgresql/postgresql_privs.py lib/ansible/modules/database/postgresql/postgresql_schema.py lib/ansible/modules/database/postgresql/postgresql_user.py -lib/ansible/modules/database/vertica/vertica_role.py lib/ansible/modules/database/vertica/vertica_schema.py lib/ansible/modules/database/vertica/vertica_user.py lib/ansible/modules/files/acl.py lib/ansible/modules/files/archive.py lib/ansible/modules/files/copy.py -lib/ansible/modules/files/find.py -lib/ansible/modules/files/ini_file.py 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/librato_annotation.py lib/ansible/modules/monitoring/logicmonitor.py lib/ansible/modules/monitoring/nagios.py lib/ansible/modules/monitoring/pagerduty_alert.py -lib/ansible/modules/monitoring/sensu_check.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/basics/uri.py lib/ansible/modules/network/cloudflare_dns.py lib/ansible/modules/network/dnsimple.py lib/ansible/modules/network/dnsmadeeasy.py @@ -263,12 +239,10 @@ lib/ansible/modules/notification/hall.py lib/ansible/modules/notification/sendgrid.py lib/ansible/modules/notification/sns.py lib/ansible/modules/packaging/language/composer.py -lib/ansible/modules/packaging/language/cpanm.py lib/ansible/modules/packaging/language/maven_artifact.py lib/ansible/modules/packaging/os/apt.py lib/ansible/modules/packaging/os/apt_key.py lib/ansible/modules/packaging/os/dnf.py -lib/ansible/modules/packaging/os/dpkg_selections.py lib/ansible/modules/packaging/os/homebrew.py lib/ansible/modules/packaging/os/openbsd_pkg.py lib/ansible/modules/packaging/os/opkg.py @@ -278,8 +252,6 @@ lib/ansible/modules/packaging/os/rhn_register.py lib/ansible/modules/packaging/os/swdepot.py lib/ansible/modules/packaging/os/yum.py lib/ansible/modules/packaging/os/zypper.py -lib/ansible/modules/remote_management/foreman/katello.py -lib/ansible/modules/remote_management/stacki/stacki_host.py lib/ansible/modules/source_control/github_hooks.py lib/ansible/modules/storage/netapp/netapp_e_amg.py lib/ansible/modules/storage/netapp/netapp_e_amg_sync.py @@ -301,7 +273,6 @@ 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/ufw.py lib/ansible/modules/system/user.py lib/ansible/modules/utilities/helper/meta.py lib/ansible/modules/utilities/logic/include.py @@ -336,13 +307,8 @@ lib/ansible/modules/windows/win_webpicmd.py lib/ansible/parsing/mod_args.py lib/ansible/playbook/attribute.py lib/ansible/playbook/block.py -lib/ansible/playbook/play_context.py -lib/ansible/playbook/playbook_include.py lib/ansible/playbook/role/__init__.py lib/ansible/playbook/role/metadata.py -lib/ansible/playbook/taggable.py -lib/ansible/plugins/action/__init__.py -lib/ansible/plugins/action/add_host.py lib/ansible/plugins/action/async.py lib/ansible/plugins/action/set_fact.py lib/ansible/plugins/action/set_stats.py @@ -359,8 +325,6 @@ 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/lookup/hashi_vault.py -lib/ansible/plugins/lookup/mongodb.py lib/ansible/plugins/shell/fish.py lib/ansible/plugins/shell/sh.py lib/ansible/plugins/strategy/__init__.py @@ -378,9 +342,6 @@ lib/ansible/utils/module_docs_fragments/ovirt.py lib/ansible/utils/module_docs_fragments/ovirt_facts.py lib/ansible/vars/__init__.py setup.py -test/integration/cleanup_ec2.py -test/integration/cleanup_gce.py -test/integration/setup_gce.py test/units/cli/test_galaxy.py test/units/errors/test_errors.py test/units/executor/test_playbook_executor.py diff --git a/test/units/cli/test_galaxy.py b/test/units/cli/test_galaxy.py index 3bc58c01ab7..99fc0637785 100644 --- a/test/units/cli/test_galaxy.py +++ b/test/units/cli/test_galaxy.py @@ -73,7 +73,7 @@ class TestGalaxy(unittest.TestCase): tar = tarfile.open(output_file, "w:gz") tar.add(source_dir, arcname=os.path.basename(source_dir)) except AttributeError: # tarfile obj. has no attribute __exit__ prior to python 2. 7 - pass + pass finally: # ensuring closure of tarfile obj tar.close() diff --git a/test/units/plugins/cache/test_cache.py b/test/units/plugins/cache/test_cache.py index c156414bd23..52d7d1a71c1 100644 --- a/test/units/plugins/cache/test_cache.py +++ b/test/units/plugins/cache/test_cache.py @@ -76,7 +76,7 @@ class TestAbstractClass(unittest.TestCase): def test_subclass_error(self): class CacheModule1(BaseCacheModule): - pass + pass with self.assertRaises(TypeError): CacheModule1() diff --git a/test/units/plugins/connection/test_connection.py b/test/units/plugins/connection/test_connection.py index 8659de110a8..dfcc3fbfdbe 100644 --- a/test/units/plugins/connection/test_connection.py +++ b/test/units/plugins/connection/test_connection.py @@ -52,7 +52,7 @@ class TestConnectionBaseClass(unittest.TestCase): def test_subclass_error(self): class ConnectionModule1(ConnectionBase): - pass + pass with self.assertRaises(TypeError): ConnectionModule1()