diff --git a/contrib/inventory/azure_rm.py b/contrib/inventory/azure_rm.py index 0232ce74fa..a5119748dc 100755 --- a/contrib/inventory/azure_rm.py +++ b/contrib/inventory/azure_rm.py @@ -446,7 +446,7 @@ class AzureInventory(object): def _parse_cli_args(self): # Parse command line arguments parser = argparse.ArgumentParser( - description='Produce an Ansible Inventory file for an Azure subscription') + description='Produce an Ansible Inventory file for an Azure subscription') parser.add_argument('--list', action='store_true', default=True, help='List instances (default: True)') parser.add_argument('--debug', action='store_true', default=False, diff --git a/contrib/inventory/cloudstack.py b/contrib/inventory/cloudstack.py index 23ae44fbc6..b5ecd8bd82 100755 --- a/contrib/inventory/cloudstack.py +++ b/contrib/inventory/cloudstack.py @@ -199,8 +199,8 @@ class CloudStackInventory(object): group_name = group['name'] if group_name and not group_name in data: data[group_name] = { - 'hosts': [] - } + 'hosts': [] + } hosts = self.cs.listVirtualMachines(projectid=project_id, domainid=domain_id) if not hosts: diff --git a/contrib/inventory/consul_io.py b/contrib/inventory/consul_io.py index 330d284911..12fb747a20 100755 --- a/contrib/inventory/consul_io.py +++ b/contrib/inventory/consul_io.py @@ -252,10 +252,10 @@ class ConsulInventory(object): ok = 'passing' == check['Status'] if ok: suffix = self.config.get_availability_suffix( - 'available_suffix', '_available') + 'available_suffix', '_available') else: suffix = self.config.get_availability_suffix( - 'unavailable_suffix', '_unavailable') + 'unavailable_suffix', '_unavailable') self.add_node_to_map(self.nodes_by_availability, service_name + suffix, node['Node']) diff --git a/contrib/inventory/digital_ocean.py b/contrib/inventory/digital_ocean.py index 9649a88aee..f76cf0c442 100755 --- a/contrib/inventory/digital_ocean.py +++ b/contrib/inventory/digital_ocean.py @@ -353,12 +353,12 @@ or environment variables (DO_API_TOKEN)\n''') def build_inventory(self): '''Build Ansible inventory of droplets''' self.inventory = { - 'all': { - 'hosts': [], - 'vars': self.group_variables - }, - '_meta': {'hostvars': {}} - } + 'all': { + 'hosts': [], + 'vars': self.group_variables + }, + '_meta': {'hostvars': {}} + } # add all droplets by id and name for droplet in self.data['droplets']: @@ -379,22 +379,22 @@ or environment variables (DO_API_TOKEN)\n''') # groups that are always present for group in [ - 'region_' + droplet['region']['slug'], - 'image_' + str(droplet['image']['id']), - 'size_' + droplet['size']['slug'], - 'distro_' + self.to_safe(droplet['image']['distribution']), - 'status_' + droplet['status'], + 'region_' + droplet['region']['slug'], + 'image_' + str(droplet['image']['id']), + 'size_' + droplet['size']['slug'], + 'distro_' + self.to_safe(droplet['image']['distribution']), + 'status_' + droplet['status'], - ]: + ]: if group not in self.inventory: self.inventory[group] = { 'hosts': [ ], 'vars': {} } self.inventory[group]['hosts'].append(dest) # groups that are not always present for group in [ - droplet['image']['slug'], - droplet['image']['name'] - ]: + droplet['image']['slug'], + droplet['image']['name'] + ]: if group: image = 'image_' + self.to_safe(group) if image not in self.inventory: diff --git a/contrib/inventory/docker.py b/contrib/inventory/docker.py index 0649cac4d1..167f3e93bc 100755 --- a/contrib/inventory/docker.py +++ b/contrib/inventory/docker.py @@ -676,7 +676,7 @@ class DockerInventory(object): # use hosts from config file for host in hosts_list: docker_host = host.get('host') or def_host or self._args.docker_host or \ - self._env_args.docker_host or DEFAULT_DOCKER_HOST + self._env_args.docker_host or DEFAULT_DOCKER_HOST api_version = host.get('version') or def_version or self._args.api_version or \ self._env_args.api_version or DEFAULT_DOCKER_API_VERSION tls_hostname = host.get('tls_hostname') or def_tls_hostname or self._args.tls_hostname or \ @@ -816,7 +816,7 @@ class DockerInventory(object): default_config = basename + '.yml' parser = argparse.ArgumentParser( - description='Return Ansible inventory for one or more Docker hosts.') + description='Return Ansible inventory for one or more Docker hosts.') parser.add_argument('--list', action='store_true', default=True, help='List all containers (default: True)') parser.add_argument('--debug', action='store_true', default=False, diff --git a/contrib/inventory/gce.py b/contrib/inventory/gce.py index fdb9fba884..5c5814635c 100755 --- a/contrib/inventory/gce.py +++ b/contrib/inventory/gce.py @@ -323,7 +323,7 @@ class GceInventory(object): ''' Command line argument processing ''' parser = argparse.ArgumentParser( - description='Produce an Ansible Inventory file based on GCE') + description='Produce an Ansible Inventory file based on GCE') parser.add_argument('--list', action='store_true', default=True, help='List instances (default: True)') parser.add_argument('--host', action='store', diff --git a/contrib/inventory/ssh_config.py b/contrib/inventory/ssh_config.py index 3ff7eb9658..ae41e5810f 100755 --- a/contrib/inventory/ssh_config.py +++ b/contrib/inventory/ssh_config.py @@ -109,7 +109,7 @@ def print_host(host): def get_args(args_list): parser = argparse.ArgumentParser( - description='ansible inventory script parsing .ssh/config') + description='ansible inventory script parsing .ssh/config') mutex_group = parser.add_mutually_exclusive_group(required=True) help_list = 'list all hosts from .ssh/config inventory' mutex_group.add_argument('--list', action='store_true', help=help_list) diff --git a/docs/api/conf.py b/docs/api/conf.py index cd76128fdc..83065598fb 100644 --- a/docs/api/conf.py +++ b/docs/api/conf.py @@ -230,17 +230,17 @@ htmlhelp_basename = 'Ansibledoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', + # The paper size ('letterpaper' or 'a4paper'). + #'papersize': 'letterpaper', -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', + # The font size ('10pt', '11pt' or '12pt'). + #'pointsize': '10pt', -# Additional stuff for the LaTeX preamble. -#'preamble': '', + # Additional stuff for the LaTeX preamble. + #'preamble': '', -# Latex figure (float) alignment -#'figure_align': 'htbp', + # Latex figure (float) alignment + #'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples diff --git a/docs/docsite/conf.py b/docs/docsite/conf.py index 9167ca35b2..acc3e8db53 100644 --- a/docs/docsite/conf.py +++ b/docs/docsite/conf.py @@ -203,7 +203,7 @@ htmlhelp_basename = 'Poseidodoc' # (source start file, target name, title, author, document class # [howto/manual]). latex_documents = [ - ('index', 'ansible.tex', 'Ansible 2.2 Documentation', AUTHOR, 'manual'), + ('index', 'ansible.tex', 'Ansible 2.2 Documentation', AUTHOR, 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/docs/docsite/rst/conf.py b/docs/docsite/rst/conf.py index 0c30e41ae1..a86eb2496e 100644 --- a/docs/docsite/rst/conf.py +++ b/docs/docsite/rst/conf.py @@ -203,7 +203,7 @@ htmlhelp_basename = 'Poseidodoc' # (source start file, target name, title, author, document class # [howto/manual]). latex_documents = [ - ('index', 'ansible.tex', 'Ansible 1.2 Documentation', + ('index', 'ansible.tex', 'Ansible 1.2 Documentation', AUTHOR, 'manual'), ] diff --git a/docs/docsite/rst/dev_guide/conf.py b/docs/docsite/rst/dev_guide/conf.py index 0e14a2c83d..1cd353db4c 100644 --- a/docs/docsite/rst/dev_guide/conf.py +++ b/docs/docsite/rst/dev_guide/conf.py @@ -238,21 +238,21 @@ htmlhelp_basename = 'dev_guidedoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples diff --git a/examples/scripts/uptime.py b/examples/scripts/uptime.py index be533527fa..c7d26cf5e9 100755 --- a/examples/scripts/uptime.py +++ b/examples/scripts/uptime.py @@ -48,11 +48,11 @@ def main(): # create play with tasks play_source = dict( - name = "Ansible Play", - hosts = host_list, - gather_facts = 'no', - tasks = [ dict(action=dict(module='command', args=dict(cmd='/usr/bin/uptime'))) ] - ) + name = "Ansible Play", + hosts = host_list, + gather_facts = 'no', + tasks = [ dict(action=dict(module='command', args=dict(cmd='/usr/bin/uptime'))) ] + ) play = Play().load(play_source, variable_manager=variable_manager, loader=loader) # actually run it @@ -60,12 +60,12 @@ def main(): callback = ResultsCollector() try: tqm = TaskQueueManager( - inventory=inventory, - variable_manager=variable_manager, - loader=loader, - options=options, - passwords=passwords, - ) + inventory=inventory, + variable_manager=variable_manager, + loader=loader, + options=options, + passwords=passwords, + ) tqm._stdout_callback = callback result = tqm.run(play) finally: diff --git a/hacking/tests/gen_distribution_version_testcase.py b/hacking/tests/gen_distribution_version_testcase.py index 775c30f8f9..7560c5fe0a 100755 --- a/hacking/tests/gen_distribution_version_testcase.py +++ b/hacking/tests/gen_distribution_version_testcase.py @@ -15,23 +15,23 @@ import json import sys filelist = [ - '/etc/oracle-release', - '/etc/slackware-version', - '/etc/redhat-release', - '/etc/vmware-release', - '/etc/openwrt_release', - '/etc/system-release', - '/etc/alpine-release', - '/etc/release', - '/etc/arch-release', - '/etc/os-release', - '/etc/SuSE-release', - '/etc/gentoo-release', - '/etc/os-release', - '/etc/lsb-release', - '/etc/altlinux-release', - '/etc/os-release', - '/etc/coreos/update.conf', + '/etc/oracle-release', + '/etc/slackware-version', + '/etc/redhat-release', + '/etc/vmware-release', + '/etc/openwrt_release', + '/etc/system-release', + '/etc/alpine-release', + '/etc/release', + '/etc/arch-release', + '/etc/os-release', + '/etc/SuSE-release', + '/etc/gentoo-release', + '/etc/os-release', + '/etc/lsb-release', + '/etc/altlinux-release', + '/etc/os-release', + '/etc/coreos/update.conf', ] fcont = {} diff --git a/lib/ansible/cli/adhoc.py b/lib/ansible/cli/adhoc.py index 4d053a3cf6..df855a32b6 100644 --- a/lib/ansible/cli/adhoc.py +++ b/lib/ansible/cli/adhoc.py @@ -187,15 +187,15 @@ class AdHocCLI(CLI): self._tqm = None try: self._tqm = TaskQueueManager( - inventory=inventory, - variable_manager=variable_manager, - loader=loader, - options=self.options, - passwords=passwords, - stdout_callback=cb, - run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS, - run_tree=run_tree, - ) + inventory=inventory, + variable_manager=variable_manager, + loader=loader, + options=self.options, + passwords=passwords, + stdout_callback=cb, + run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS, + run_tree=run_tree, + ) result = self._tqm.run(play) finally: diff --git a/lib/ansible/cli/console.py b/lib/ansible/cli/console.py index 291e4b5e6d..439c040d01 100644 --- a/lib/ansible/cli/console.py +++ b/lib/ansible/cli/console.py @@ -198,15 +198,15 @@ class ConsoleCLI(CLI, cmd.Cmd): self._tqm = None try: self._tqm = TaskQueueManager( - inventory=self.inventory, - variable_manager=self.variable_manager, - loader=self.loader, - options=self.options, - passwords=self.passwords, - stdout_callback=cb, - run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS, - run_tree=False, - ) + inventory=self.inventory, + variable_manager=self.variable_manager, + loader=self.loader, + options=self.options, + passwords=self.passwords, + stdout_callback=cb, + run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS, + run_tree=False, + ) result = self._tqm.run(play) finally: diff --git a/lib/ansible/compat/six/__init__.py b/lib/ansible/compat/six/__init__.py index f7185d6f12..473e2d4f1e 100644 --- a/lib/ansible/compat/six/__init__.py +++ b/lib/ansible/compat/six/__init__.py @@ -42,7 +42,7 @@ if _system_six: 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/executor/play_iterator.py b/lib/ansible/executor/play_iterator.py index 1e7775d3e2..e2f3dcfd13 100644 --- a/lib/ansible/executor/play_iterator.py +++ b/lib/ansible/executor/play_iterator.py @@ -177,7 +177,7 @@ class PlayIterator: setup_task.name = 'Gathering Facts' setup_task.tags = ['always'] setup_task.args = { - 'gather_subset': gather_subset, + 'gather_subset': gather_subset, } if gather_timeout: setup_task.args['gather_timeout'] = gather_timeout diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index dcc64489bc..1099c4ddfc 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -35,26 +35,26 @@ BOOLEANS = BOOLEANS_TRUE + BOOLEANS_FALSE SIZE_RANGES = { 'Y': 1<<80, 'Z': 1<<70, 'E': 1<<60, 'P': 1<<50, 'T': 1<<40, 'G': 1<<30, 'M': 1<<20, 'K': 1<<10, 'B': 1 } FILE_ATTRIBUTES = { - 'A': 'noatime', - 'a': 'append', - 'c': 'compressed', - 'C': 'nocow', - 'd': 'nodump', - 'D': 'dirsync', - 'e': 'extents', - 'E': 'encrypted', - 'h': 'blocksize', - 'i': 'immutable', - 'I': 'indexed', - 'j': 'journalled', - 'N': 'inline', - 's': 'zero', - 'S': 'synchronous', - 't': 'notail', - 'T': 'blockroot', - 'u': 'undelete', - 'X': 'compressedraw', - 'Z': 'compresseddirty', + 'A': 'noatime', + 'a': 'append', + 'c': 'compressed', + 'C': 'nocow', + 'd': 'nodump', + 'D': 'dirsync', + 'e': 'extents', + 'E': 'encrypted', + 'h': 'blocksize', + 'i': 'immutable', + 'I': 'indexed', + 'j': 'journalled', + 'N': 'inline', + 's': 'zero', + 'S': 'synchronous', + 't': 'notail', + 'T': 'blockroot', + 'u': 'undelete', + 'X': 'compressedraw', + 'Z': 'compresseddirty', } # ansible modules can be written in any language. To simplify @@ -728,19 +728,19 @@ class AnsibleModule(object): self._set_defaults(pre=True) self._CHECK_ARGUMENT_TYPES_DISPATCHER = { - 'str': self._check_type_str, - 'list': self._check_type_list, - 'dict': self._check_type_dict, - 'bool': self._check_type_bool, - 'int': self._check_type_int, - 'float': self._check_type_float, - 'path': self._check_type_path, - 'raw': self._check_type_raw, - 'jsonarg': self._check_type_jsonarg, - 'json': self._check_type_jsonarg, - 'bytes': self._check_type_bytes, - 'bits': self._check_type_bits, - } + 'str': self._check_type_str, + 'list': self._check_type_list, + 'dict': self._check_type_dict, + 'bool': self._check_type_bool, + 'int': self._check_type_int, + 'float': self._check_type_float, + 'path': self._check_type_path, + 'raw': self._check_type_raw, + 'jsonarg': self._check_type_jsonarg, + 'json': self._check_type_jsonarg, + 'bytes': self._check_type_bytes, + 'bits': self._check_type_bits, + } if not bypass_checks: self._check_required_arguments() self._check_argument_types() diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 616beff862..9522bfe86f 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -1078,22 +1078,22 @@ class LinuxHardware(Hardware): memstats['swap:used'] = memstats['swaptotal'] - memstats['swapfree'] self.facts['memory_mb'] = { - 'real' : { - 'total': memstats.get('memtotal'), - 'used': memstats.get('real:used'), - 'free': memstats.get('memfree'), - }, - 'nocache' : { - 'free': memstats.get('nocache:free'), - 'used': memstats.get('nocache:used'), - }, - 'swap' : { - 'total': memstats.get('swaptotal'), - 'free': memstats.get('swapfree'), - 'used': memstats.get('swap:used'), - 'cached': memstats.get('swapcached'), - }, - } + 'real' : { + 'total': memstats.get('memtotal'), + 'used': memstats.get('real:used'), + 'free': memstats.get('memfree'), + }, + 'nocache' : { + 'free': memstats.get('nocache:free'), + 'used': memstats.get('nocache:used'), + }, + 'swap' : { + 'total': memstats.get('swaptotal'), + 'free': memstats.get('swapfree'), + 'used': memstats.get('swap:used'), + 'cached': memstats.get('swapcached'), + }, + } def get_cpu_facts(self): i = 0 @@ -1212,15 +1212,15 @@ class LinuxHardware(Hardware): "CompactPCI", "AdvancedTCA", "Blade" ] DMI_DICT = { - 'bios_date': '/sys/devices/virtual/dmi/id/bios_date', - 'bios_version': '/sys/devices/virtual/dmi/id/bios_version', - 'form_factor': '/sys/devices/virtual/dmi/id/chassis_type', - 'product_name': '/sys/devices/virtual/dmi/id/product_name', - 'product_serial': '/sys/devices/virtual/dmi/id/product_serial', - 'product_uuid': '/sys/devices/virtual/dmi/id/product_uuid', - 'product_version': '/sys/devices/virtual/dmi/id/product_version', - 'system_vendor': '/sys/devices/virtual/dmi/id/sys_vendor' - } + 'bios_date': '/sys/devices/virtual/dmi/id/bios_date', + 'bios_version': '/sys/devices/virtual/dmi/id/bios_version', + 'form_factor': '/sys/devices/virtual/dmi/id/chassis_type', + 'product_name': '/sys/devices/virtual/dmi/id/product_name', + 'product_serial': '/sys/devices/virtual/dmi/id/product_serial', + 'product_uuid': '/sys/devices/virtual/dmi/id/product_uuid', + 'product_version': '/sys/devices/virtual/dmi/id/product_version', + 'system_vendor': '/sys/devices/virtual/dmi/id/sys_vendor' + } for (key,path) in DMI_DICT.items(): data = get_file_content(path) @@ -1239,15 +1239,15 @@ class LinuxHardware(Hardware): # Fall back to using dmidecode, if available dmi_bin = self.module.get_bin_path('dmidecode') DMI_DICT = { - 'bios_date': 'bios-release-date', - 'bios_version': 'bios-version', - 'form_factor': 'chassis-type', - 'product_name': 'system-product-name', - 'product_serial': 'system-serial-number', - 'product_uuid': 'system-uuid', - 'product_version': 'system-version', - 'system_vendor': 'system-manufacturer' - } + 'bios_date': 'bios-release-date', + 'bios_version': 'bios-version', + 'form_factor': 'chassis-type', + 'product_name': 'system-product-name', + 'product_serial': 'system-serial-number', + 'product_uuid': 'system-uuid', + 'product_version': 'system-version', + 'system_vendor': 'system-manufacturer' + } for (k, v) in DMI_DICT.items(): if dmi_bin is not None: (rc, out, err) = self.module.run_command('%s -s %s' % (dmi_bin, v)) diff --git a/lib/ansible/module_utils/gcp.py b/lib/ansible/module_utils/gcp.py index 87415b392e..4c1168b8d9 100644 --- a/lib/ansible/module_utils/gcp.py +++ b/lib/ansible/module_utils/gcp.py @@ -77,7 +77,7 @@ def _get_gcp_ansible_credentials(module): def _get_gcp_environ_var(var_name, default_value): """Wrapper around os.environ.get call.""" return os.environ.get( - var_name, default_value) + var_name, default_value) def _get_gcp_environment_credentials(service_account_email, credentials_file, project_id): """Helper to look in environment variables for credentials.""" @@ -315,7 +315,7 @@ def get_google_cloud_credentials(module, scopes=[]): credentials = credentials.with_scopes(scopes) else: credentials = google.auth.default( - scopes=scopes)[0] + scopes=scopes)[0] return (credentials, conn_params) except Exception as e: diff --git a/lib/ansible/module_utils/nxos.py b/lib/ansible/module_utils/nxos.py index 1f6d627405..0360747d89 100644 --- a/lib/ansible/module_utils/nxos.py +++ b/lib/ansible/module_utils/nxos.py @@ -103,7 +103,7 @@ class Nxapi(NxapiConfigMixin): command_type = self.OUTPUT_TO_COMMAND_TYPE[output] except KeyError: msg = 'invalid format, received %s, expected one of %s' % \ - (output, ','.join(self.OUTPUT_TO_COMMAND_TYPE.keys())) + (output, ','.join(self.OUTPUT_TO_COMMAND_TYPE.keys())) self._error(msg=msg) if isinstance(commands, (list, set, tuple)): diff --git a/lib/ansible/module_utils/redhat.py b/lib/ansible/module_utils/redhat.py index ed2a92956f..749c16f8f0 100644 --- a/lib/ansible/module_utils/redhat.py +++ b/lib/ansible/module_utils/redhat.py @@ -141,7 +141,7 @@ class Rhsm(RegistrationBase): # Quick version... if False: return os.path.isfile('/etc/pki/consumer/cert.pem') and \ - os.path.isfile('/etc/pki/consumer/key.pem') + os.path.isfile('/etc/pki/consumer/key.pem') args = ['subscription-manager', 'identity'] rc, stdout, stderr = self.module.run_command(args, check_rc=False) diff --git a/lib/ansible/modules/cloud/amazon/_ec2_vpc.py b/lib/ansible/modules/cloud/amazon/_ec2_vpc.py index 50aa45c064..491b508d1f 100644 --- a/lib/ansible/modules/cloud/amazon/_ec2_vpc.py +++ b/lib/ansible/modules/cloud/amazon/_ec2_vpc.py @@ -698,19 +698,19 @@ def terminate_vpc(module, vpc_conn, vpc_id=None, cidr=None): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - cidr_block = dict(), - instance_tenancy = dict(choices=['default', 'dedicated'], default='default'), - wait = dict(type='bool', default=False), - wait_timeout = dict(default=300), - dns_support = dict(type='bool', default=True), - dns_hostnames = dict(type='bool', default=True), - subnets = dict(type='list'), - vpc_id = dict(), - internet_gateway = dict(type='bool', default=False), - resource_tags = dict(type='dict', required=True), - route_tables = dict(type='list'), - state = dict(choices=['present', 'absent'], default='present'), - ) + cidr_block = dict(), + instance_tenancy = dict(choices=['default', 'dedicated'], default='default'), + wait = dict(type='bool', default=False), + wait_timeout = dict(default=300), + dns_support = dict(type='bool', default=True), + dns_hostnames = dict(type='bool', default=True), + subnets = dict(type='list'), + vpc_id = dict(), + internet_gateway = dict(type='bool', default=False), + resource_tags = dict(type='dict', required=True), + route_tables = dict(type='list'), + state = dict(choices=['present', 'absent'], default='present'), + ) ) module = AnsibleModule( diff --git a/lib/ansible/modules/cloud/amazon/aws_kms.py b/lib/ansible/modules/cloud/amazon/aws_kms.py index 58dabe496e..9e81c3632e 100644 --- a/lib/ansible/modules/cloud/amazon/aws_kms.py +++ b/lib/ansible/modules/cloud/amazon/aws_kms.py @@ -15,9 +15,9 @@ # along with Ansible. If not, see . ANSIBLE_METADATA = { - 'version': '1.0', - 'status': ['preview'], - 'supported_by': 'committer' + 'version': '1.0', + 'status': ['preview'], + 'supported_by': 'committer' } DOCUMENTATION = ''' @@ -236,14 +236,14 @@ def assert_policy_shape(policy): def main(): argument_spec = ansible.module_utils.ec2.ec2_argument_spec() argument_spec.update(dict( - mode = dict(choices=['grant', 'deny'], default='grant'), - key_alias = dict(required=False, type='str'), - key_arn = dict(required=False, type='str'), - role_name = dict(required=False, type='str'), - role_arn = dict(required=False, type='str'), - grant_types = dict(required=False, type='list'), - clean_invalid_entries = dict(type='bool', default=True), - ) + mode = dict(choices=['grant', 'deny'], default='grant'), + key_alias = dict(required=False, type='str'), + key_arn = dict(required=False, type='str'), + role_name = dict(required=False, type='str'), + role_arn = dict(required=False, type='str'), + grant_types = dict(required=False, type='list'), + clean_invalid_entries = dict(type='bool', default=True), + ) ) module = AnsibleModule( diff --git a/lib/ansible/modules/cloud/amazon/cloudformation.py b/lib/ansible/modules/cloud/amazon/cloudformation.py index 11633aeead..e58abd9277 100644 --- a/lib/ansible/modules/cloud/amazon/cloudformation.py +++ b/lib/ansible/modules/cloud/amazon/cloudformation.py @@ -390,18 +390,18 @@ def get_stack_facts(cfn, stack_name): def main(): argument_spec = ansible.module_utils.ec2.ec2_argument_spec() argument_spec.update(dict( - stack_name=dict(required=True), - template_parameters=dict(required=False, type='dict', default={}), - state=dict(default='present', choices=['present', 'absent']), - template=dict(default=None, required=False, type='path'), - notification_arns=dict(default=None, required=False), - stack_policy=dict(default=None, required=False), - disable_rollback=dict(default=False, type='bool'), - template_url=dict(default=None, required=False), - template_format=dict(default=None, choices=['json', 'yaml'], required=False), - role_arn=dict(default=None, required=False), - tags=dict(default=None, type='dict') - ) + stack_name=dict(required=True), + template_parameters=dict(required=False, type='dict', default={}), + state=dict(default='present', choices=['present', 'absent']), + template=dict(default=None, required=False, type='path'), + notification_arns=dict(default=None, required=False), + stack_policy=dict(default=None, required=False), + disable_rollback=dict(default=False, type='bool'), + template_url=dict(default=None, required=False), + template_format=dict(default=None, choices=['json', 'yaml'], required=False), + role_arn=dict(default=None, required=False), + tags=dict(default=None, type='dict') + ) ) module = AnsibleModule( @@ -413,7 +413,7 @@ def main(): # collect the parameters that are passed to boto3. Keeps us from having so many scalars floating around. stack_params = { - 'Capabilities': ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'], + 'Capabilities': ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'], } state = module.params['state'] stack_params['StackName'] = module.params['stack_name'] diff --git a/lib/ansible/modules/cloud/amazon/ec2.py b/lib/ansible/modules/cloud/amazon/ec2.py index 34a487f3f2..55ac11b529 100644 --- a/lib/ansible/modules/cloud/amazon/ec2.py +++ b/lib/ansible/modules/cloud/amazon/ec2.py @@ -1135,18 +1135,18 @@ def create_instances(module, ec2, vpc, override_count=None): if not spot_price: if assign_public_ip and private_ip: params.update(dict( - min_count = count_remaining, - max_count = count_remaining, - client_token = id, - placement_group = placement_group, + min_count = count_remaining, + max_count = count_remaining, + client_token = id, + placement_group = placement_group, )) else: params.update(dict( - min_count = count_remaining, - max_count = count_remaining, - client_token = id, - placement_group = placement_group, - private_ip_address = private_ip, + min_count = count_remaining, + max_count = count_remaining, + client_token = id, + placement_group = placement_group, + private_ip_address = private_ip, )) # For ordinary (not spot) instances, we can select 'stop' @@ -1537,56 +1537,56 @@ def restart_instances(module, ec2, instance_ids, state, instance_tags): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - key_name = dict(aliases = ['keypair']), - id = dict(), - group = dict(type='list', aliases=['groups']), - group_id = dict(type='list'), - zone = dict(aliases=['aws_zone', 'ec2_zone']), - instance_type = dict(aliases=['type']), - spot_price = dict(), - spot_type = dict(default='one-time', choices=["one-time", "persistent"]), - spot_launch_group = dict(), - image = dict(), - kernel = dict(), - count = dict(type='int', default='1'), - monitoring = dict(type='bool', default=False), - ramdisk = dict(), - wait = dict(type='bool', default=False), - wait_timeout = dict(default=300), - spot_wait_timeout = dict(default=600), - placement_group = dict(), - user_data = dict(), - instance_tags = dict(type='dict'), - vpc_subnet_id = dict(), - assign_public_ip = dict(type='bool', default=False), - private_ip = dict(), - instance_profile_name = dict(), - instance_ids = dict(type='list', aliases=['instance_id']), - source_dest_check = dict(type='bool', default=True), - termination_protection = dict(type='bool', default=None), - state = dict(default='present', choices=['present', 'absent', 'running', 'restarted', 'stopped']), - instance_initiated_shutdown_behavior=dict(default=None, choices=['stop', 'terminate']), - exact_count = dict(type='int', default=None), - count_tag = dict(), - volumes = dict(type='list'), - ebs_optimized = dict(type='bool', default=False), - tenancy = dict(default='default'), - network_interfaces = dict(type='list', aliases=['network_interface']) - ) + key_name = dict(aliases = ['keypair']), + id = dict(), + group = dict(type='list', aliases=['groups']), + group_id = dict(type='list'), + zone = dict(aliases=['aws_zone', 'ec2_zone']), + instance_type = dict(aliases=['type']), + spot_price = dict(), + spot_type = dict(default='one-time', choices=["one-time", "persistent"]), + spot_launch_group = dict(), + image = dict(), + kernel = dict(), + count = dict(type='int', default='1'), + monitoring = dict(type='bool', default=False), + ramdisk = dict(), + wait = dict(type='bool', default=False), + wait_timeout = dict(default=300), + spot_wait_timeout = dict(default=600), + placement_group = dict(), + user_data = dict(), + instance_tags = dict(type='dict'), + vpc_subnet_id = dict(), + assign_public_ip = dict(type='bool', default=False), + private_ip = dict(), + instance_profile_name = dict(), + instance_ids = dict(type='list', aliases=['instance_id']), + source_dest_check = dict(type='bool', default=True), + termination_protection = dict(type='bool', default=None), + state = dict(default='present', choices=['present', 'absent', 'running', 'restarted', 'stopped']), + instance_initiated_shutdown_behavior=dict(default=None, choices=['stop', 'terminate']), + exact_count = dict(type='int', default=None), + count_tag = dict(), + volumes = dict(type='list'), + ebs_optimized = dict(type='bool', default=False), + tenancy = dict(default='default'), + network_interfaces = dict(type='list', aliases=['network_interface']) + ) ) module = AnsibleModule( argument_spec=argument_spec, mutually_exclusive = [ - ['exact_count', 'count'], - ['exact_count', 'state'], - ['exact_count', 'instance_ids'], - ['network_interfaces', 'assign_public_ip'], - ['network_interfaces', 'group'], - ['network_interfaces', 'group_id'], - ['network_interfaces', 'private_ip'], - ['network_interfaces', 'vpc_subnet_id'], - ], + ['exact_count', 'count'], + ['exact_count', 'state'], + ['exact_count', 'instance_ids'], + ['network_interfaces', 'assign_public_ip'], + ['network_interfaces', 'group'], + ['network_interfaces', 'group_id'], + ['network_interfaces', 'private_ip'], + ['network_interfaces', 'vpc_subnet_id'], + ], ) if not HAS_BOTO: diff --git a/lib/ansible/modules/cloud/amazon/ec2_ami.py b/lib/ansible/modules/cloud/amazon/ec2_ami.py index 267d3187ff..d95d0b7305 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_ami.py +++ b/lib/ansible/modules/cloud/amazon/ec2_ami.py @@ -584,23 +584,23 @@ def update_image(module, ec2, image_id): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - instance_id = dict(), - image_id = dict(), - architecture = dict(default="x86_64"), - kernel_id = dict(), - virtualization_type = dict(default="hvm"), - root_device_name = dict(), - delete_snapshot = dict(default=False, type='bool'), - name = dict(), - wait = dict(type='bool', default=False), - wait_timeout = dict(default=900), - description = dict(default=""), - no_reboot = dict(default=False, type='bool'), - state = dict(default='present'), - device_mapping = dict(type='list'), - tags = dict(type='dict'), - launch_permissions = dict(type='dict') - ) + instance_id = dict(), + image_id = dict(), + architecture = dict(default="x86_64"), + kernel_id = dict(), + virtualization_type = dict(default="hvm"), + root_device_name = dict(), + delete_snapshot = dict(default=False, type='bool'), + name = dict(), + wait = dict(type='bool', default=False), + wait_timeout = dict(default=900), + description = dict(default=""), + no_reboot = dict(default=False, type='bool'), + state = dict(default='present'), + device_mapping = dict(type='list'), + tags = dict(type='dict'), + launch_permissions = dict(type='dict') + ) ) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/amazon/ec2_ami_copy.py b/lib/ansible/modules/cloud/amazon/ec2_ami_copy.py index 8d5363357a..01ca4d9bff 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_ami_copy.py +++ b/lib/ansible/modules/cloud/amazon/ec2_ami_copy.py @@ -173,9 +173,9 @@ def copy_image(module, ec2): ec2.get_waiter('image_available').wait(ImageIds=[image_id]) if module.params.get('tags'): ec2.create_tags( - Resources=[image_id], - Tags=[{'Key' : k, 'Value': v} for k,v in module.params.get('tags').items()] - ) + Resources=[image_id], + Tags=[{'Key' : k, 'Value': v} for k,v in module.params.get('tags').items()] + ) module.exit_json(changed=True, image_id=image_id) except WaiterError as we: diff --git a/lib/ansible/modules/cloud/amazon/ec2_ami_find.py b/lib/ansible/modules/cloud/amazon/ec2_ami_find.py index cd333050d1..07cedd8257 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_ami_find.py +++ b/lib/ansible/modules/cloud/amazon/ec2_ami_find.py @@ -298,27 +298,27 @@ def get_block_device_mapping(image): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - owner = dict(required=False, default=None), - ami_id = dict(required=False), - ami_tags = dict(required=False, type='dict', + owner = dict(required=False, default=None), + ami_id = dict(required=False), + ami_tags = dict(required=False, type='dict', aliases = ['search_tags', 'image_tags']), - architecture = dict(required=False), - hypervisor = dict(required=False), - is_public = dict(required=False, type='bool'), - name = dict(required=False), - platform = dict(required=False), - sort = dict(required=False, default=None, + architecture = dict(required=False), + hypervisor = dict(required=False), + is_public = dict(required=False, type='bool'), + name = dict(required=False), + platform = dict(required=False), + sort = dict(required=False, default=None, choices=['name', 'description', 'tag', 'architecture', 'block_device_mapping', 'creationDate', 'hypervisor', 'is_public', 'location', 'owner_id', 'platform', 'root_device_name', 'root_device_type', 'state', 'virtualization_type']), - sort_tag = dict(required=False), - sort_order = dict(required=False, default='ascending', + sort_tag = dict(required=False), + sort_order = dict(required=False, default='ascending', choices=['ascending', 'descending']), - sort_start = dict(required=False), - sort_end = dict(required=False), - state = dict(required=False, default='available'), - virtualization_type = dict(required=False), - no_result_action = dict(required=False, default='success', + sort_start = dict(required=False), + sort_end = dict(required=False), + state = dict(required=False, default='available'), + virtualization_type = dict(required=False), + no_result_action = dict(required=False, default='success', choices = ['success', 'fail']), - ) + ) ) module = AnsibleModule( diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py index 888e7183c8..fe1101167d 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py @@ -473,21 +473,21 @@ def create_autoscaling_group(connection, module): if len(launch_configs) == 0: module.fail_json(msg="No launch config found with name %s" % launch_config_name) ag = AutoScalingGroup( - group_name=group_name, - load_balancers=load_balancers, - availability_zones=availability_zones, - launch_config=launch_configs[0], - min_size=min_size, - max_size=max_size, - placement_group=placement_group, - desired_capacity=desired_capacity, - vpc_zone_identifier=vpc_zone_identifier, - connection=connection, - tags=asg_tags, - health_check_period=health_check_period, - health_check_type=health_check_type, - default_cooldown=default_cooldown, - termination_policies=termination_policies) + group_name=group_name, + load_balancers=load_balancers, + availability_zones=availability_zones, + launch_config=launch_configs[0], + min_size=min_size, + max_size=max_size, + placement_group=placement_group, + desired_capacity=desired_capacity, + vpc_zone_identifier=vpc_zone_identifier, + connection=connection, + tags=asg_tags, + health_check_period=health_check_period, + health_check_type=health_check_type, + default_cooldown=default_cooldown, + termination_policies=termination_policies) try: connection.create_auto_scaling_group(ag) diff --git a/lib/ansible/modules/cloud/amazon/ec2_elb.py b/lib/ansible/modules/cloud/amazon/ec2_elb.py index 27ed37b3a5..5b2aa819e3 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_elb.py +++ b/lib/ansible/modules/cloud/amazon/ec2_elb.py @@ -326,13 +326,13 @@ class ElbManager: def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - state={'required': True}, - instance_id={'required': True}, - ec2_elbs={'default': None, 'required': False, 'type':'list'}, - enable_availability_zone={'default': True, 'required': False, 'type': 'bool'}, - wait={'required': False, 'default': True, 'type': 'bool'}, - wait_timeout={'required': False, 'default': 0, 'type': 'int'} - ) + state={'required': True}, + instance_id={'required': True}, + ec2_elbs={'default': None, 'required': False, 'type':'list'}, + enable_availability_zone={'default': True, 'required': False, 'type': 'bool'}, + wait={'required': False, 'default': True, 'type': 'bool'}, + wait_timeout={'required': False, 'default': 0, 'type': 'int'} + ) ) module = AnsibleModule( diff --git a/lib/ansible/modules/cloud/amazon/ec2_elb_facts.py b/lib/ansible/modules/cloud/amazon/ec2_elb_facts.py index 710331fe80..017b28e01b 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_elb_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_elb_facts.py @@ -195,8 +195,8 @@ class ElbInformation(object): elb_info['instances_outofservice'] = [inst.instance_id for inst in instance_health if inst.state == 'OutOfService'] elb_info['instances_outofservice_count'] = len(elb_info['instances_outofservice']) elb_info['instances_inservice_percent'] = float(elb_info['instances_inservice_count'])/( - float(elb_info['instances_inservice_count']) + - float(elb_info['instances_outofservice_count']))*100 + float(elb_info['instances_inservice_count']) + + float(elb_info['instances_outofservice_count']))*100 return elb_info @@ -221,8 +221,8 @@ class ElbInformation(object): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - names={'default': [], 'type': 'list'} - ) + names={'default': [], 'type': 'list'} + ) ) module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py b/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py index 3c97a420fc..0a55354d7a 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py +++ b/lib/ansible/modules/cloud/amazon/ec2_elb_lb.py @@ -650,7 +650,7 @@ class ElbManager(object): status_achieved = False elb_interfaces = self.ec2_conn.get_all_network_interfaces( - filters={'attachment.instance-owner-id': 'amazon-elb', + filters={'attachment.instance-owner-id': 'amazon-elb', 'description': 'ELB {0}'.format(self.name) }) for x in range(0, max_retries): @@ -1227,29 +1227,29 @@ class ElbManager(object): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - state={'required': True, 'choices': ['present', 'absent']}, - name={'required': True}, - listeners={'default': None, 'required': False, 'type': 'list'}, - purge_listeners={'default': True, 'required': False, 'type': 'bool'}, - instance_ids={'default': None, 'required': False, 'type': 'list'}, - purge_instance_ids={'default': False, 'required': False, 'type': 'bool'}, - zones={'default': None, 'required': False, 'type': 'list'}, - purge_zones={'default': False, 'required': False, 'type': 'bool'}, - security_group_ids={'default': None, 'required': False, 'type': 'list'}, - security_group_names={'default': None, 'required': False, 'type': 'list'}, - health_check={'default': None, 'required': False, 'type': 'dict'}, - subnets={'default': None, 'required': False, 'type': 'list'}, - purge_subnets={'default': False, 'required': False, 'type': 'bool'}, - scheme={'default': 'internet-facing', 'required': False}, - connection_draining_timeout={'default': None, 'required': False}, - idle_timeout={'default': None, 'required': False}, - cross_az_load_balancing={'default': None, 'required': False}, - stickiness={'default': None, 'required': False, 'type': 'dict'}, - access_logs={'default': None, 'required': False, 'type': 'dict'}, - wait={'default': False, 'type': 'bool', 'required': False}, - wait_timeout={'default': 60, 'type': 'int', 'required': False}, - tags={'default': None, 'required': False, 'type': 'dict'} - ) + state={'required': True, 'choices': ['present', 'absent']}, + name={'required': True}, + listeners={'default': None, 'required': False, 'type': 'list'}, + purge_listeners={'default': True, 'required': False, 'type': 'bool'}, + instance_ids={'default': None, 'required': False, 'type': 'list'}, + purge_instance_ids={'default': False, 'required': False, 'type': 'bool'}, + zones={'default': None, 'required': False, 'type': 'list'}, + purge_zones={'default': False, 'required': False, 'type': 'bool'}, + security_group_ids={'default': None, 'required': False, 'type': 'list'}, + security_group_names={'default': None, 'required': False, 'type': 'list'}, + health_check={'default': None, 'required': False, 'type': 'dict'}, + subnets={'default': None, 'required': False, 'type': 'list'}, + purge_subnets={'default': False, 'required': False, 'type': 'bool'}, + scheme={'default': 'internet-facing', 'required': False}, + connection_draining_timeout={'default': None, 'required': False}, + idle_timeout={'default': None, 'required': False}, + cross_az_load_balancing={'default': None, 'required': False}, + stickiness={'default': None, 'required': False, 'type': 'dict'}, + access_logs={'default': None, 'required': False, 'type': 'dict'}, + wait={'default': False, 'type': 'bool', 'required': False}, + wait_timeout={'default': 60, 'type': 'int', 'required': False}, + tags={'default': None, 'required': False, 'type': 'dict'} + ) ) module = AnsibleModule( diff --git a/lib/ansible/modules/cloud/amazon/ec2_eni.py b/lib/ansible/modules/cloud/amazon/ec2_eni.py index aca78a459d..cc3a8be594 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_eni.py +++ b/lib/ansible/modules/cloud/amazon/ec2_eni.py @@ -532,12 +532,12 @@ def main(): module = AnsibleModule(argument_spec=argument_spec, mutually_exclusive=[ ['secondary_private_ip_addresses', 'secondary_private_ip_address_count'] - ], + ], required_if=([ ('state', 'present', ['subnet_id']), ('state', 'absent', ['eni_id']), ('attached', True, ['instance_id']) - ]) + ]) ) if not HAS_BOTO: diff --git a/lib/ansible/modules/cloud/amazon/ec2_facts.py b/lib/ansible/modules/cloud/amazon/ec2_facts.py index 4e0f7531fd..992766fd0d 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_facts.py @@ -176,8 +176,8 @@ def main(): argument_spec = url_argument_spec() module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, + argument_spec=argument_spec, + supports_check_mode=True, ) ec2_facts = Ec2Metadata(module).run() diff --git a/lib/ansible/modules/cloud/amazon/ec2_group.py b/lib/ansible/modules/cloud/amazon/ec2_group.py index cd63bfdefc..319fd0b654 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_group.py +++ b/lib/ansible/modules/cloud/amazon/ec2_group.py @@ -241,16 +241,16 @@ def get_target_from_rule(module, ec2, rule, name, group, groups, vpc_id): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - name=dict(type='str', required=True), - description=dict(type='str', required=True), - vpc_id=dict(type='str'), - rules=dict(type='list'), - rules_egress=dict(type='list'), - state = dict(default='present', type='str', choices=['present', 'absent']), - purge_rules=dict(default=True, required=False, type='bool'), - purge_rules_egress=dict(default=True, required=False, type='bool'), + name=dict(type='str', required=True), + description=dict(type='str', required=True), + vpc_id=dict(type='str'), + rules=dict(type='list'), + rules_egress=dict(type='list'), + state = dict(default='present', type='str', choices=['present', 'absent']), + purge_rules=dict(default=True, required=False, type='bool'), + purge_rules_egress=dict(default=True, required=False, type='bool'), - ) + ) ) module = AnsibleModule( argument_spec=argument_spec, @@ -427,12 +427,12 @@ def main(): if not module.check_mode: ec2.authorize_security_group_egress( - group_id=group.id, - ip_protocol=rule['proto'], - from_port=rule['from_port'], - to_port=rule['to_port'], - src_group_id=grantGroup, - cidr_ip=thisip) + group_id=group.id, + ip_protocol=rule['proto'], + from_port=rule['from_port'], + to_port=rule['to_port'], + src_group_id=grantGroup, + cidr_ip=thisip) changed = True elif vpc_id: # when using a vpc, but no egress rules are specified, @@ -462,12 +462,12 @@ def main(): grantGroup = groups[grant.group_id].id if not module.check_mode: ec2.revoke_security_group_egress( - group_id=group.id, - ip_protocol=rule.ip_protocol, - from_port=rule.from_port, - to_port=rule.to_port, - src_group_id=grantGroup, - cidr_ip=grant.cidr_ip) + group_id=group.id, + ip_protocol=rule.ip_protocol, + from_port=rule.from_port, + to_port=rule.to_port, + src_group_id=grantGroup, + cidr_ip=grant.cidr_ip) changed = True if group: diff --git a/lib/ansible/modules/cloud/amazon/ec2_key.py b/lib/ansible/modules/cloud/amazon/ec2_key.py index 90a68ec637..0a17145ca1 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_key.py +++ b/lib/ansible/modules/cloud/amazon/ec2_key.py @@ -108,12 +108,12 @@ import string def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - name=dict(required=True), - key_material=dict(required=False), - state = dict(default='present', choices=['present', 'absent']), - wait = dict(type='bool', default=False), - wait_timeout = dict(default=300), - ) + name=dict(required=True), + key_material=dict(required=False), + state = dict(default='present', choices=['present', 'absent']), + wait = dict(type='bool', default=False), + wait_timeout = dict(default=300), + ) ) module = AnsibleModule( argument_spec=argument_spec, diff --git a/lib/ansible/modules/cloud/amazon/ec2_lc.py b/lib/ansible/modules/cloud/amazon/ec2_lc.py index 34d289929c..32766d8634 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_lc.py +++ b/lib/ansible/modules/cloud/amazon/ec2_lc.py @@ -229,7 +229,7 @@ def create_launch_config(connection, module): result = dict( ((a[0], a[1]) for a in vars(launch_configs[0]).items() if a[0] not in ('connection', 'created_time', 'instance_monitoring', 'block_device_mappings')) - ) + ) result['created_time'] = str(launch_configs[0].created_time) # Looking at boto's launchconfig.py, it looks like this could be a boolean # value or an object with an enabled attribute. The enabled attribute diff --git a/lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py b/lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py index 984211bc27..6606b32d8f 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py +++ b/lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py @@ -261,7 +261,7 @@ def main(): insufficient_data_actions=dict(type='list'), ok_actions=dict(type='list'), state=dict(default='present', choices=['present', 'absent']), - ) + ) ) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/amazon/ec2_remote_facts.py b/lib/ansible/modules/cloud/amazon/ec2_remote_facts.py index 98ea16628f..5b580d4033 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_remote_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_remote_facts.py @@ -127,9 +127,9 @@ def get_instance_info(instance): 'requester_id': instance.requester_id, 'monitoring_state': instance.monitoring_state, 'placement': { - 'tenancy': instance._placement.tenancy, - 'zone': instance._placement.zone - }, + 'tenancy': instance._placement.tenancy, + 'zone': instance._placement.zone + }, 'ami_launch_index': instance.ami_launch_index, 'launch_time': instance.launch_time, 'hypervisor': instance.hypervisor, diff --git a/lib/ansible/modules/cloud/amazon/ec2_tag.py b/lib/ansible/modules/cloud/amazon/ec2_tag.py index 9f701a55d4..d27af699b8 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_tag.py +++ b/lib/ansible/modules/cloud/amazon/ec2_tag.py @@ -130,10 +130,10 @@ except ImportError: def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - resource = dict(required=True), - tags = dict(type='dict'), - state = dict(default='present', choices=['present', 'absent', 'list']), - ) + resource = dict(required=True), + tags = dict(type='dict'), + state = dict(default='present', choices=['present', 'absent', 'list']), + ) ) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/amazon/ec2_vol.py b/lib/ansible/modules/cloud/amazon/ec2_vol.py index a89b218f3a..59491277ba 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vol.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vol.py @@ -470,23 +470,23 @@ def get_volume_info(volume, state): attachment = volume.attach_data volume_info = { - 'create_time': volume.create_time, - 'encrypted': volume.encrypted, - 'id': volume.id, - 'iops': volume.iops, - 'size': volume.size, - 'snapshot_id': volume.snapshot_id, - 'status': volume.status, - 'type': volume.type, - 'zone': volume.zone, - 'attachment_set': { - 'attach_time': attachment.attach_time, - 'device': attachment.device, - 'instance_id': attachment.instance_id, - 'status': attachment.status - }, - 'tags': volume.tags - } + 'create_time': volume.create_time, + 'encrypted': volume.encrypted, + 'id': volume.id, + 'iops': volume.iops, + 'size': volume.size, + 'snapshot_id': volume.snapshot_id, + 'status': volume.status, + 'type': volume.type, + 'zone': volume.zone, + 'attachment_set': { + 'attach_time': attachment.attach_time, + 'device': attachment.device, + 'instance_id': attachment.instance_id, + 'status': attachment.status + }, + 'tags': volume.tags + } if hasattr(attachment, 'deleteOnTermination'): volume_info['attachment_set']['deleteOnTermination'] = attachment.deleteOnTermination @@ -496,20 +496,20 @@ def get_volume_info(volume, state): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - instance = dict(), - id = dict(), - name = dict(), - volume_size = dict(), - volume_type = dict(choices=['standard', 'gp2', 'io1', 'st1', 'sc1'], default='standard'), - iops = dict(), - encrypted = dict(type='bool', default=False), - kms_key_id = dict(), - device_name = dict(), - delete_on_termination = dict(type='bool', default=False), - zone = dict(aliases=['availability_zone', 'aws_zone', 'ec2_zone']), - snapshot = dict(), - state = dict(choices=['absent', 'present', 'list'], default='present') - ) + instance = dict(), + id = dict(), + name = dict(), + volume_size = dict(), + volume_type = dict(choices=['standard', 'gp2', 'io1', 'st1', 'sc1'], default='standard'), + iops = dict(), + encrypted = dict(type='bool', default=False), + kms_key_id = dict(), + device_name = dict(), + delete_on_termination = dict(type='bool', default=False), + zone = dict(aliases=['availability_zone', 'aws_zone', 'ec2_zone']), + snapshot = dict(), + state = dict(choices=['absent', 'present', 'list'], default='present') + ) ) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/amazon/ec2_vol_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vol_facts.py index ba5350789a..146154b07e 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vol_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vol_facts.py @@ -79,24 +79,24 @@ def get_volume_info(volume): attachment = volume.attach_data volume_info = { - 'create_time': volume.create_time, - 'id': volume.id, - 'encrypted': volume.encrypted, - 'iops': volume.iops, - 'size': volume.size, - 'snapshot_id': volume.snapshot_id, - 'status': volume.status, - 'type': volume.type, - 'zone': volume.zone, - 'region': volume.region.name, - 'attachment_set': { - 'attach_time': attachment.attach_time, - 'device': attachment.device, - 'instance_id': attachment.instance_id, - 'status': attachment.status - }, - 'tags': volume.tags - } + 'create_time': volume.create_time, + 'id': volume.id, + 'encrypted': volume.encrypted, + 'iops': volume.iops, + 'size': volume.size, + 'snapshot_id': volume.snapshot_id, + 'status': volume.status, + 'type': volume.type, + 'zone': volume.zone, + 'region': volume.region.name, + 'attachment_set': { + 'attach_time': attachment.attach_time, + 'device': attachment.device, + 'instance_id': attachment.instance_id, + 'status': attachment.status + }, + 'tags': volume.tags + } return volume_info diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_net.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_net.py index 7b7e0e4647..c041c51997 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_net.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_net.py @@ -186,16 +186,16 @@ def get_vpc_values(vpc_obj): def main(): argument_spec=ec2_argument_spec() argument_spec.update(dict( - name = dict(type='str', default=None, required=True), - cidr_block = dict(type='str', default=None, required=True), - tenancy = dict(choices=['default', 'dedicated'], default='default'), - dns_support = dict(type='bool', default=True), - dns_hostnames = dict(type='bool', default=True), - dhcp_opts_id = dict(type='str', default=None, required=False), - tags = dict(type='dict', required=False, default=None, aliases=['resource_tags']), - state = dict(choices=['present', 'absent'], default='present'), - multi_ok = dict(type='bool', default=False) - ) + name = dict(type='str', default=None, required=True), + cidr_block = dict(type='str', default=None, required=True), + tenancy = dict(choices=['default', 'dedicated'], default='default'), + dns_support = dict(type='bool', default=True), + dns_hostnames = dict(type='bool', default=True), + dhcp_opts_id = dict(type='str', default=None, required=False), + tags = dict(type='dict', required=False, default=None, aliases=['resource_tags']), + state = dict(choices=['present', 'absent'], default='present'), + multi_ok = dict(type='bool', default=False) + ) ) module = AnsibleModule( diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py index dc66d44586..d73806512a 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py @@ -150,7 +150,7 @@ def create_subnet(vpc_conn, vpc_id, cidr, az, check_mode): subnet = None else: raise AnsibleVPCSubnetCreationException( - 'Unable to create subnet {0}, error: {1}'.format(cidr, e)) + 'Unable to create subnet {0}, error: {1}'.format(cidr, e)) return subnet diff --git a/lib/ansible/modules/cloud/amazon/ec2_win_password.py b/lib/ansible/modules/cloud/amazon/ec2_win_password.py index bf89ea0ec8..d27157dac6 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_win_password.py +++ b/lib/ansible/modules/cloud/amazon/ec2_win_password.py @@ -106,12 +106,12 @@ except ImportError: def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - instance_id = dict(required=True), - key_file = dict(required=True), - key_passphrase = dict(no_log=True, default=None, required=False), - wait = dict(type='bool', default=False, required=False), - wait_timeout = dict(default=120, required=False), - ) + instance_id = dict(required=True), + key_file = dict(required=True), + key_passphrase = dict(no_log=True, default=None, required=False), + wait = dict(type='bool', default=False, required=False), + wait_timeout = dict(default=120, required=False), + ) ) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/amazon/ecs_service.py b/lib/ansible/modules/cloud/amazon/ecs_service.py index 4a85ff3c0e..9bf424e1d0 100644 --- a/lib/ansible/modules/cloud/amazon/ecs_service.py +++ b/lib/ansible/modules/cloud/amazon/ecs_service.py @@ -260,7 +260,7 @@ class EcsServiceManager: cluster=cluster_name, services=[ service_name - ]) + ]) msg = '' if len(response['failures'])>0: c = self.find_in_array(response['failures'], service_name, 'arn') diff --git a/lib/ansible/modules/cloud/amazon/elasticache.py b/lib/ansible/modules/cloud/amazon/elasticache.py index 24272549eb..22c4b4d4f5 100644 --- a/lib/ansible/modules/cloud/amazon/elasticache.py +++ b/lib/ansible/modules/cloud/amazon/elasticache.py @@ -483,22 +483,22 @@ class ElastiCacheManager(object): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - state ={'required': True, 'choices': ['present', 'absent', 'rebooted']}, - name ={'required': True}, - engine ={'required': False, 'default': 'memcached'}, - cache_engine_version ={'required': False}, - node_type ={'required': False, 'default': 'cache.m1.small'}, - num_nodes ={'required': False, 'default': None, 'type': 'int'}, - # alias for compat with the original PR 1950 - cache_parameter_group ={'required': False, 'default': None, 'aliases': ['parameter_group']}, - cache_port ={'required': False, 'type': 'int'}, - cache_subnet_group ={'required': False, 'default': None}, - cache_security_groups ={'required': False, 'default': [], 'type': 'list'}, - security_group_ids ={'required': False, 'default': [], 'type': 'list'}, - zone ={'required': False, 'default': None}, - wait ={'required': False, 'type' : 'bool', 'default': True}, - hard_modify ={'required': False, 'type': 'bool', 'default': False} - ) + state ={'required': True, 'choices': ['present', 'absent', 'rebooted']}, + name ={'required': True}, + engine ={'required': False, 'default': 'memcached'}, + cache_engine_version ={'required': False}, + node_type ={'required': False, 'default': 'cache.m1.small'}, + num_nodes ={'required': False, 'default': None, 'type': 'int'}, + # alias for compat with the original PR 1950 + cache_parameter_group ={'required': False, 'default': None, 'aliases': ['parameter_group']}, + cache_port ={'required': False, 'type': 'int'}, + cache_subnet_group ={'required': False, 'default': None}, + cache_security_groups ={'required': False, 'default': [], 'type': 'list'}, + security_group_ids ={'required': False, 'default': [], 'type': 'list'}, + zone ={'required': False, 'default': None}, + wait ={'required': False, 'type' : 'bool', 'default': True}, + hard_modify ={'required': False, 'type': 'bool', 'default': False} + ) ) module = AnsibleModule( diff --git a/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py b/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py index 1e5708c03e..1a3508bfcc 100644 --- a/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py +++ b/lib/ansible/modules/cloud/amazon/elasticache_subnet_group.py @@ -80,11 +80,11 @@ except ImportError: def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - state = dict(required=True, choices=['present', 'absent']), - name = dict(required=True), - description = dict(required=False), - subnets = dict(required=False, type='list'), - ) + state = dict(required=True, choices=['present', 'absent']), + name = dict(required=True), + description = dict(required=False), + subnets = dict(required=False, type='list'), + ) ) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/amazon/iam.py b/lib/ansible/modules/cloud/amazon/iam.py index 907c96af79..8b24b3feb3 100644 --- a/lib/ansible/modules/cloud/amazon/iam.py +++ b/lib/ansible/modules/cloud/amazon/iam.py @@ -297,9 +297,9 @@ def update_user(module, iam, name, new_name, new_path, key_state, key_count, key error_msg = boto_exception(err) if 'cannot be found' in error_msg and updated: current_keys, status = \ - [ck['access_key_id'] for ck in + [ck['access_key_id'] for ck in iam.get_all_access_keys(new_name).list_access_keys_result.access_key_metadata],\ - [ck['status'] for ck in + [ck['status'] for ck in iam.get_all_access_keys(new_name).list_access_keys_result.access_key_metadata] name = new_name else: diff --git a/lib/ansible/modules/cloud/amazon/iam_cert.py b/lib/ansible/modules/cloud/amazon/iam_cert.py index 9fc3678770..9b540a2046 100644 --- a/lib/ansible/modules/cloud/amazon/iam_cert.py +++ b/lib/ansible/modules/cloud/amazon/iam_cert.py @@ -129,9 +129,9 @@ def boto_exception(err): def cert_meta(iam, name): opath = iam.get_server_certificate(name).get_server_certificate_result.\ - server_certificate.\ - server_certificate_metadata.\ - path + server_certificate.\ + server_certificate_metadata.\ + path ocert = iam.get_server_certificate(name).get_server_certificate_result.\ server_certificate.\ certificate_body diff --git a/lib/ansible/modules/cloud/amazon/rds.py b/lib/ansible/modules/cloud/amazon/rds.py index d4ff306951..e820fc0520 100644 --- a/lib/ansible/modules/cloud/amazon/rds.py +++ b/lib/ansible/modules/cloud/amazon/rds.py @@ -694,7 +694,7 @@ def create_db_instance(module, conn): try: result = conn.create_db_instance(instance_name, module.params.get('size'), module.params.get('instance_type'), module.params.get('db_engine'), - module.params.get('username'), module.params.get('password'), **params) + module.params.get('username'), module.params.get('password'), **params) changed = True except RDSException as e: module.fail_json(msg="Failed to create instance: %s" % e.message) @@ -953,40 +953,40 @@ def validate_parameters(required_vars, valid_vars, module): # map to convert rds module options to boto rds and rds2 options optional_params = { - 'port': 'port', - 'db_name': 'db_name', - 'zone': 'availability_zone', - 'maint_window': 'preferred_maintenance_window', - 'backup_window': 'preferred_backup_window', - 'backup_retention': 'backup_retention_period', - 'multi_zone': 'multi_az', - 'engine_version': 'engine_version', - 'upgrade': 'auto_minor_version_upgrade', - 'subnet': 'db_subnet_group_name', - 'license_model': 'license_model', - 'option_group': 'option_group_name', - 'size': 'allocated_storage', - 'iops': 'iops', - 'new_instance_name': 'new_instance_id', - 'apply_immediately': 'apply_immediately', + 'port': 'port', + 'db_name': 'db_name', + 'zone': 'availability_zone', + 'maint_window': 'preferred_maintenance_window', + 'backup_window': 'preferred_backup_window', + 'backup_retention': 'backup_retention_period', + 'multi_zone': 'multi_az', + 'engine_version': 'engine_version', + 'upgrade': 'auto_minor_version_upgrade', + 'subnet': 'db_subnet_group_name', + 'license_model': 'license_model', + 'option_group': 'option_group_name', + 'size': 'allocated_storage', + 'iops': 'iops', + 'new_instance_name': 'new_instance_id', + 'apply_immediately': 'apply_immediately', } # map to convert rds module options to boto rds options optional_params_rds = { - 'db_engine': 'engine', - 'password': 'master_password', - 'parameter_group': 'param_group', - 'instance_type': 'instance_class', + 'db_engine': 'engine', + 'password': 'master_password', + 'parameter_group': 'param_group', + 'instance_type': 'instance_class', } # map to convert rds module options to boto rds2 options optional_params_rds2 = { - 'tags': 'tags', - 'publicly_accessible': 'publicly_accessible', - 'parameter_group': 'db_parameter_group_name', - 'character_set_name': 'character_set_name', - 'instance_type': 'db_instance_class', - 'password': 'master_user_password', - 'new_instance_name': 'new_db_instance_identifier', - 'force_failover': 'force_failover', + 'tags': 'tags', + 'publicly_accessible': 'publicly_accessible', + 'parameter_group': 'db_parameter_group_name', + 'character_set_name': 'character_set_name', + 'instance_type': 'db_instance_class', + 'password': 'master_user_password', + 'new_instance_name': 'new_db_instance_identifier', + 'force_failover': 'force_failover', } if has_rds2: optional_params.update(optional_params_rds2) @@ -1029,40 +1029,40 @@ def validate_parameters(required_vars, valid_vars, module): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - command = dict(choices=['create', 'replicate', 'delete', 'facts', 'modify', 'promote', 'snapshot', 'reboot', 'restore'], required=True), - instance_name = dict(required=False), - source_instance = dict(required=False), - db_engine = dict(choices=['mariadb', 'MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee', 'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex', 'sqlserver-web', 'postgres', 'aurora'], required=False), - size = dict(required=False), - instance_type = dict(aliases=['type'], required=False), - username = dict(required=False), - password = dict(no_log=True, required=False), - db_name = dict(required=False), - engine_version = dict(required=False), - parameter_group = dict(required=False), - license_model = dict(choices=['license-included', 'bring-your-own-license', 'general-public-license', 'postgresql-license'], required=False), - multi_zone = dict(type='bool', default=False), - iops = dict(required=False), - security_groups = dict(required=False), - vpc_security_groups = dict(type='list', required=False), - port = dict(required=False), - upgrade = dict(type='bool', default=False), - option_group = dict(required=False), - maint_window = dict(required=False), - backup_window = dict(required=False), - backup_retention = dict(required=False), - zone = dict(aliases=['aws_zone', 'ec2_zone'], required=False), - subnet = dict(required=False), - wait = dict(type='bool', default=False), - wait_timeout = dict(type='int', default=300), - snapshot = dict(required=False), - apply_immediately = dict(type='bool', default=False), - new_instance_name = dict(required=False), - tags = dict(type='dict', required=False), - publicly_accessible = dict(required=False), - character_set_name = dict(required=False), - force_failover = dict(type='bool', required=False, default=False) - ) + command = dict(choices=['create', 'replicate', 'delete', 'facts', 'modify', 'promote', 'snapshot', 'reboot', 'restore'], required=True), + instance_name = dict(required=False), + source_instance = dict(required=False), + db_engine = dict(choices=['mariadb', 'MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee', 'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex', 'sqlserver-web', 'postgres', 'aurora'], required=False), + size = dict(required=False), + instance_type = dict(aliases=['type'], required=False), + username = dict(required=False), + password = dict(no_log=True, required=False), + db_name = dict(required=False), + engine_version = dict(required=False), + parameter_group = dict(required=False), + license_model = dict(choices=['license-included', 'bring-your-own-license', 'general-public-license', 'postgresql-license'], required=False), + multi_zone = dict(type='bool', default=False), + iops = dict(required=False), + security_groups = dict(required=False), + vpc_security_groups = dict(type='list', required=False), + port = dict(required=False), + upgrade = dict(type='bool', default=False), + option_group = dict(required=False), + maint_window = dict(required=False), + backup_window = dict(required=False), + backup_retention = dict(required=False), + zone = dict(aliases=['aws_zone', 'ec2_zone'], required=False), + subnet = dict(required=False), + wait = dict(type='bool', default=False), + wait_timeout = dict(type='int', default=300), + snapshot = dict(required=False), + apply_immediately = dict(type='bool', default=False), + new_instance_name = dict(required=False), + tags = dict(type='dict', required=False), + publicly_accessible = dict(required=False), + character_set_name = dict(required=False), + force_failover = dict(type='bool', required=False, default=False) + ) ) module = AnsibleModule( @@ -1073,15 +1073,15 @@ def main(): module.fail_json(msg='boto required for this module') invocations = { - 'create': create_db_instance, - 'replicate': replicate_db_instance, - 'delete': delete_db_instance_or_snapshot, - 'facts': facts_db_instance_or_snapshot, - 'modify': modify_db_instance, - 'promote': promote_db_instance, - 'snapshot': snapshot_db_instance, - 'reboot': reboot_db_instance, - 'restore': restore_db_instance, + 'create': create_db_instance, + 'replicate': replicate_db_instance, + 'delete': delete_db_instance_or_snapshot, + 'facts': facts_db_instance_or_snapshot, + 'modify': modify_db_instance, + 'promote': promote_db_instance, + 'snapshot': snapshot_db_instance, + 'reboot': reboot_db_instance, + 'restore': restore_db_instance, } region, ec2_url, aws_connect_params = get_aws_connection_info(module) diff --git a/lib/ansible/modules/cloud/amazon/rds_param_group.py b/lib/ansible/modules/cloud/amazon/rds_param_group.py index 80cf4d60be..86eecdd0cb 100644 --- a/lib/ansible/modules/cloud/amazon/rds_param_group.py +++ b/lib/ansible/modules/cloud/amazon/rds_param_group.py @@ -219,13 +219,13 @@ def modify_group(group, params, immediate=False): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - state = dict(required=True, choices=['present', 'absent']), - name = dict(required=True), - engine = dict(required=False, choices=VALID_ENGINES), - description = dict(required=False), - params = dict(required=False, aliases=['parameters'], type='dict'), - immediate = dict(required=False, type='bool'), - ) + state = dict(required=True, choices=['present', 'absent']), + name = dict(required=True), + engine = dict(required=False, choices=VALID_ENGINES), + description = dict(required=False), + params = dict(required=False, aliases=['parameters'], type='dict'), + immediate = dict(required=False, type='bool'), + ) ) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/amazon/rds_subnet_group.py b/lib/ansible/modules/cloud/amazon/rds_subnet_group.py index cf7f7f8038..bcf3950d9e 100644 --- a/lib/ansible/modules/cloud/amazon/rds_subnet_group.py +++ b/lib/ansible/modules/cloud/amazon/rds_subnet_group.py @@ -84,11 +84,11 @@ except ImportError: def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - state = dict(required=True, choices=['present', 'absent']), - name = dict(required=True), - description = dict(required=False), - subnets = dict(required=False, type='list'), - ) + state = dict(required=True, choices=['present', 'absent']), + name = dict(required=True), + description = dict(required=False), + subnets = dict(required=False, type='list'), + ) ) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/amazon/redshift.py b/lib/ansible/modules/cloud/amazon/redshift.py index a1ae146a42..4208301b21 100644 --- a/lib/ansible/modules/cloud/amazon/redshift.py +++ b/lib/ansible/modules/cloud/amazon/redshift.py @@ -410,31 +410,31 @@ def modify_cluster(module, redshift): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - command = dict(choices=['create', 'facts', 'delete', 'modify'], required=True), - identifier = dict(required=True), - node_type = dict(choices=['ds1.xlarge', 'ds1.8xlarge', 'ds2.xlarge', 'ds2.8xlarge', 'dc1.large', 'dc1.8xlarge', 'dw1.xlarge', 'dw1.8xlarge', 'dw2.large', 'dw2.8xlarge'], required=False), - username = dict(required=False), - password = dict(no_log=True, required=False), - db_name = dict(require=False), - cluster_type = dict(choices=['multi-node', 'single-node', ], default='single-node'), - cluster_security_groups = dict(aliases=['security_groups'], type='list'), - vpc_security_group_ids = dict(aliases=['vpc_security_groups'], type='list'), - cluster_subnet_group_name = dict(aliases=['subnet']), - availability_zone = dict(aliases=['aws_zone', 'zone']), - preferred_maintenance_window = dict(aliases=['maintance_window', 'maint_window']), - cluster_parameter_group_name = dict(aliases=['param_group_name']), - automated_snapshot_retention_period = dict(aliases=['retention_period']), - port = dict(type='int'), - cluster_version = dict(aliases=['version'], choices=['1.0']), - allow_version_upgrade = dict(aliases=['version_upgrade'], type='bool', default=True), - number_of_nodes = dict(type='int'), - publicly_accessible = dict(type='bool', default=False), - encrypted = dict(type='bool', default=False), - elastic_ip = dict(required=False), - new_cluster_identifier = dict(aliases=['new_identifier']), - wait = dict(type='bool', default=False), - wait_timeout = dict(default=300), - ) + command = dict(choices=['create', 'facts', 'delete', 'modify'], required=True), + identifier = dict(required=True), + node_type = dict(choices=['ds1.xlarge', 'ds1.8xlarge', 'ds2.xlarge', 'ds2.8xlarge', 'dc1.large', 'dc1.8xlarge', 'dw1.xlarge', 'dw1.8xlarge', 'dw2.large', 'dw2.8xlarge'], required=False), + username = dict(required=False), + password = dict(no_log=True, required=False), + db_name = dict(require=False), + cluster_type = dict(choices=['multi-node', 'single-node', ], default='single-node'), + cluster_security_groups = dict(aliases=['security_groups'], type='list'), + vpc_security_group_ids = dict(aliases=['vpc_security_groups'], type='list'), + cluster_subnet_group_name = dict(aliases=['subnet']), + availability_zone = dict(aliases=['aws_zone', 'zone']), + preferred_maintenance_window = dict(aliases=['maintance_window', 'maint_window']), + cluster_parameter_group_name = dict(aliases=['param_group_name']), + automated_snapshot_retention_period = dict(aliases=['retention_period']), + port = dict(type='int'), + cluster_version = dict(aliases=['version'], choices=['1.0']), + allow_version_upgrade = dict(aliases=['version_upgrade'], type='bool', default=True), + number_of_nodes = dict(type='int'), + publicly_accessible = dict(type='bool', default=False), + encrypted = dict(type='bool', default=False), + elastic_ip = dict(required=False), + new_cluster_identifier = dict(aliases=['new_identifier']), + wait = dict(type='bool', default=False), + wait_timeout = dict(default=300), + ) ) module = AnsibleModule( diff --git a/lib/ansible/modules/cloud/amazon/route53.py b/lib/ansible/modules/cloud/amazon/route53.py index 67e09245e0..93f29f43ad 100644 --- a/lib/ansible/modules/cloud/amazon/route53.py +++ b/lib/ansible/modules/cloud/amazon/route53.py @@ -388,28 +388,28 @@ def invoke_with_throttling_retries(function_ref, *argv): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - command = dict(choices=['get', 'create', 'delete'], required=True), - zone = dict(required=True), - hosted_zone_id = dict(required=False, default=None), - record = dict(required=True), - ttl = dict(required=False, type='int', default=3600), - type = dict(choices=['A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'NS', 'SOA'], required=True), - alias = dict(required=False, type='bool'), - alias_hosted_zone_id = dict(required=False), - alias_evaluate_target_health = dict(required=False, type='bool', default=False), - value = dict(required=False), - overwrite = dict(required=False, type='bool'), - retry_interval = dict(required=False, default=500), - private_zone = dict(required=False, type='bool', default=False), - identifier = dict(required=False, default=None), - weight = dict(required=False, type='int'), - region = dict(required=False), - health_check = dict(required=False), - failover = dict(required=False,choices=['PRIMARY','SECONDARY']), - vpc_id = dict(required=False), - wait = dict(required=False, type='bool', default=False), - wait_timeout = dict(required=False, type='int', default=300), - ) + command = dict(choices=['get', 'create', 'delete'], required=True), + zone = dict(required=True), + hosted_zone_id = dict(required=False, default=None), + record = dict(required=True), + ttl = dict(required=False, type='int', default=3600), + type = dict(choices=['A', 'CNAME', 'MX', 'AAAA', 'TXT', 'PTR', 'SRV', 'SPF', 'NS', 'SOA'], required=True), + alias = dict(required=False, type='bool'), + alias_hosted_zone_id = dict(required=False), + alias_evaluate_target_health = dict(required=False, type='bool', default=False), + value = dict(required=False), + overwrite = dict(required=False, type='bool'), + retry_interval = dict(required=False, default=500), + private_zone = dict(required=False, type='bool', default=False), + identifier = dict(required=False, default=None), + weight = dict(required=False, type='int'), + region = dict(required=False), + health_check = dict(required=False), + failover = dict(required=False,choices=['PRIMARY','SECONDARY']), + vpc_id = dict(required=False), + wait = dict(required=False, type='bool', default=False), + wait_timeout = dict(required=False, type='int', default=300), + ) ) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/amazon/route53_health_check.py b/lib/ansible/modules/cloud/amazon/route53_health_check.py index 0070b3e288..09f864c5a4 100644 --- a/lib/ansible/modules/cloud/amazon/route53_health_check.py +++ b/lib/ansible/modules/cloud/amazon/route53_health_check.py @@ -275,16 +275,16 @@ def update_health_check(conn, health_check_id, health_check_version, health_chec def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - state = dict(choices=['present', 'absent'], default='present'), - ip_address = dict(), - port = dict(type='int'), - type = dict(required=True, choices=['HTTP', 'HTTPS', 'HTTP_STR_MATCH', 'HTTPS_STR_MATCH', 'TCP']), - resource_path = dict(), - fqdn = dict(), - string_match = dict(), - request_interval = dict(type='int', choices=[10, 30], default=30), - failure_threshold = dict(type='int', choices=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], default=3), - ) + state = dict(choices=['present', 'absent'], default='present'), + ip_address = dict(), + port = dict(type='int'), + type = dict(required=True, choices=['HTTP', 'HTTPS', 'HTTP_STR_MATCH', 'HTTPS_STR_MATCH', 'TCP']), + resource_path = dict(), + fqdn = dict(), + string_match = dict(), + request_interval = dict(type='int', choices=[10, 30], default=30), + failure_threshold = dict(type='int', choices=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], default=3), + ) ) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/amazon/route53_zone.py b/lib/ansible/modules/cloud/amazon/route53_zone.py index 758860f685..e4700c82ee 100644 --- a/lib/ansible/modules/cloud/amazon/route53_zone.py +++ b/lib/ansible/modules/cloud/amazon/route53_zone.py @@ -138,11 +138,11 @@ from ansible.module_utils.ec2 import ec2_argument_spec, get_aws_connection_info def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - zone=dict(required=True), - state=dict(default='present', choices=['present', 'absent']), - vpc_id=dict(default=None), - vpc_region=dict(default=None), - comment=dict(default=''))) + zone=dict(required=True), + state=dict(default='present', choices=['present', 'absent']), + vpc_id=dict(default=None), + vpc_region=dict(default=None), + comment=dict(default=''))) module = AnsibleModule(argument_spec=argument_spec) if not HAS_BOTO: diff --git a/lib/ansible/modules/cloud/amazon/s3.py b/lib/ansible/modules/cloud/amazon/s3.py index 5544b99074..4b09e32bfc 100755 --- a/lib/ansible/modules/cloud/amazon/s3.py +++ b/lib/ansible/modules/cloud/amazon/s3.py @@ -433,25 +433,25 @@ def is_walrus(s3_url): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - bucket = dict(required=True), - dest = dict(default=None), - encrypt = dict(default=True, type='bool'), - expiry = dict(default=600, aliases=['expiration']), - headers = dict(type='dict'), - marker = dict(default=None), - max_keys = dict(default=1000), - metadata = dict(type='dict'), - mode = dict(choices=['get', 'put', 'delete', 'create', 'geturl', 'getstr', 'delobj', 'list'], required=True), - object = dict(), - permission = dict(type='list', default=['private']), - version = dict(default=None), - overwrite = dict(aliases=['force'], default='always'), - prefix = dict(default=None), - retries = dict(aliases=['retry'], type='int', default=0), - s3_url = dict(aliases=['S3_URL']), - rgw = dict(default='no', type='bool'), - src = dict(), - ), + bucket = dict(required=True), + dest = dict(default=None), + encrypt = dict(default=True, type='bool'), + expiry = dict(default=600, aliases=['expiration']), + headers = dict(type='dict'), + marker = dict(default=None), + max_keys = dict(default=1000), + metadata = dict(type='dict'), + mode = dict(choices=['get', 'put', 'delete', 'create', 'geturl', 'getstr', 'delobj', 'list'], required=True), + object = dict(), + permission = dict(type='list', default=['private']), + version = dict(default=None), + overwrite = dict(aliases=['force'], default='always'), + prefix = dict(default=None), + retries = dict(aliases=['retry'], type='int', default=0), + s3_url = dict(aliases=['S3_URL']), + rgw = dict(default='no', type='bool'), + src = dict(), + ), ) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/amazon/s3_lifecycle.py b/lib/ansible/modules/cloud/amazon/s3_lifecycle.py index f981dfadb8..4cf69faea9 100644 --- a/lib/ansible/modules/cloud/amazon/s3_lifecycle.py +++ b/lib/ansible/modules/cloud/amazon/s3_lifecycle.py @@ -377,11 +377,11 @@ def main(): module = AnsibleModule(argument_spec=argument_spec, mutually_exclusive = [ - [ 'expiration_days', 'expiration_date' ], - [ 'expiration_days', 'transition_date' ], - [ 'transition_days', 'transition_date' ], - [ 'transition_days', 'expiration_date' ] - ] + [ 'expiration_days', 'expiration_date' ], + [ 'expiration_days', 'transition_date' ], + [ 'transition_days', 'transition_date' ], + [ 'transition_days', 'expiration_date' ] + ] ) if not HAS_BOTO: diff --git a/lib/ansible/modules/cloud/amazon/s3_sync.py b/lib/ansible/modules/cloud/amazon/s3_sync.py index 1547da4f6b..466183eb99 100644 --- a/lib/ansible/modules/cloud/amazon/s3_sync.py +++ b/lib/ansible/modules/cloud/amazon/s3_sync.py @@ -306,7 +306,7 @@ def gather_files(fileroot, include=None, exclude=None): 'chopped_path':chopped_path, 'modified_epoch': f_modified_epoch, 'bytes': f_size - }) + }) # dirpath = path *to* the directory # dirnames = subdirs *in* our directory # filenames @@ -428,7 +428,7 @@ def upload_files(s3, bucket, filelist, params): ret = [] for entry in filelist: args = { - 'ContentType': entry['mime_type'] + 'ContentType': entry['mime_type'] } if params.get('permission'): args['ACL'] = params['permission'] @@ -440,18 +440,18 @@ def upload_files(s3, bucket, filelist, params): def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - mode = dict(choices=['push'], default='push'), - file_change_strategy = dict(choices=['force','date_size','checksum'], default='date_size'), - bucket = dict(required=True), - key_prefix = dict(required=False, default=''), - file_root = dict(required=True, type='path'), - permission = dict(required=False, choices=['private', 'public-read', 'public-read-write', 'authenticated-read', 'aws-exec-read', 'bucket-owner-read', 'bucket-owner-full-control']), - retries = dict(required=False), - mime_map = dict(required=False, type='dict'), - exclude = dict(required=False, default=".*"), - include = dict(required=False, default="*"), - # future options: cache_control (string or map, perhaps), encoding, metadata, storage_class, retries - ) + mode = dict(choices=['push'], default='push'), + file_change_strategy = dict(choices=['force','date_size','checksum'], default='date_size'), + bucket = dict(required=True), + key_prefix = dict(required=False, default=''), + file_root = dict(required=True, type='path'), + permission = dict(required=False, choices=['private', 'public-read', 'public-read-write', 'authenticated-read', 'aws-exec-read', 'bucket-owner-read', 'bucket-owner-full-control']), + retries = dict(required=False), + mime_map = dict(required=False, type='dict'), + exclude = dict(required=False, default=".*"), + include = dict(required=False, default="*"), + # future options: cache_control (string or map, perhaps), encoding, metadata, storage_class, retries + ) ) module = AnsibleModule( diff --git a/lib/ansible/modules/cloud/amazon/s3_website.py b/lib/ansible/modules/cloud/amazon/s3_website.py index a47eee51fd..a26a2f311a 100644 --- a/lib/ansible/modules/cloud/amazon/s3_website.py +++ b/lib/ansible/modules/cloud/amazon/s3_website.py @@ -267,9 +267,9 @@ def main(): module = AnsibleModule( argument_spec=argument_spec, mutually_exclusive = [ - ['redirect_all_requests', 'suffix'], - ['redirect_all_requests', 'error_key'] - ]) + ['redirect_all_requests', 'suffix'], + ['redirect_all_requests', 'error_key'] + ]) if not HAS_BOTO3: module.fail_json(msg='boto3 required for this module') diff --git a/lib/ansible/modules/cloud/atomic/atomic_host.py b/lib/ansible/modules/cloud/atomic/atomic_host.py index ae4cb06e28..c0a6b9a47e 100644 --- a/lib/ansible/modules/cloud/atomic/atomic_host.py +++ b/lib/ansible/modules/cloud/atomic/atomic_host.py @@ -89,10 +89,10 @@ def core(module): def main(): module = AnsibleModule( - argument_spec = dict( - revision = dict(default='latest', required=False, aliases=["version"]), - ), - ) + argument_spec = dict( + revision = dict(default='latest', required=False, aliases=["version"]), + ), + ) # Verify that the platform is atomic host if not os.path.exists("/run/ostree-booted"): diff --git a/lib/ansible/modules/cloud/atomic/atomic_image.py b/lib/ansible/modules/cloud/atomic/atomic_image.py index 640af4f3a8..eb7bca874e 100644 --- a/lib/ansible/modules/cloud/atomic/atomic_image.py +++ b/lib/ansible/modules/cloud/atomic/atomic_image.py @@ -119,12 +119,12 @@ def core(module): def main(): module = AnsibleModule( - argument_spec = dict( - name = dict(default=None, required=True), - state = dict(default='latest', choices=['present', 'absent', 'latest']), - started = dict(default='yes', type='bool'), - ), - ) + argument_spec = dict( + name = dict(default=None, required=True), + state = dict(default='latest', choices=['present', 'absent', 'latest']), + started = dict(default='yes', type='bool'), + ), + ) # Verify that the platform supports atomic command rc, out, err = module.run_command('atomic -v', check_rc=False) diff --git a/lib/ansible/modules/cloud/cloudstack/cs_firewall.py b/lib/ansible/modules/cloud/cloudstack/cs_firewall.py index 160e58d472..22312cffd0 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_firewall.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_firewall.py @@ -299,9 +299,9 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack): def _icmp_match(self, rule, protocol, icmp_code, icmp_type): return protocol == 'icmp' \ - and protocol == rule['protocol'] \ - and icmp_code == rule['icmpcode'] \ - and icmp_type == rule['icmptype'] + and protocol == rule['protocol'] \ + and icmp_code == rule['icmpcode'] \ + and icmp_type == rule['icmptype'] def _type_cidr_match(self, rule, cidr): diff --git a/lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.py b/lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.py index 0bfa40746d..a54a599e09 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.py @@ -206,27 +206,27 @@ class AnsibleCloudStackSecurityGroupRule(AnsibleCloudStack): def _tcp_udp_match(self, rule, protocol, start_port, end_port): return protocol in ['tcp', 'udp'] \ - and protocol == rule['protocol'] \ - and start_port == int(rule['startport']) \ - and end_port == int(rule['endport']) + and protocol == rule['protocol'] \ + and start_port == int(rule['startport']) \ + and end_port == int(rule['endport']) def _icmp_match(self, rule, protocol, icmp_code, icmp_type): return protocol == 'icmp' \ - and protocol == rule['protocol'] \ - and icmp_code == int(rule['icmpcode']) \ - and icmp_type == int(rule['icmptype']) + and protocol == rule['protocol'] \ + and icmp_code == int(rule['icmpcode']) \ + and icmp_type == int(rule['icmptype']) def _ah_esp_gre_match(self, rule, protocol): return protocol in ['ah', 'esp', 'gre'] \ - and protocol == rule['protocol'] + and protocol == rule['protocol'] def _type_security_group_match(self, rule, security_group_name): return security_group_name \ - and 'securitygroupname' in rule \ - and security_group_name == rule['securitygroupname'] + and 'securitygroupname' in rule \ + and security_group_name == rule['securitygroupname'] def _type_cidr_match(self, rule, cidr): diff --git a/lib/ansible/modules/cloud/docker/_docker.py b/lib/ansible/modules/cloud/docker/_docker.py index e9b7f0af0d..4bad2b246b 100644 --- a/lib/ansible/modules/cloud/docker/_docker.py +++ b/lib/ansible/modules/cloud/docker/_docker.py @@ -682,26 +682,26 @@ class DockerManager(object): # docker-py version is a tuple of ints because we have to compare them # server APIVersion is passed to a docker-py function that takes strings _cap_ver_req = { - 'devices': ((0, 7, 0), '1.2'), - 'dns': ((0, 3, 0), '1.10'), - 'volumes_from': ((0, 3, 0), '1.10'), - 'restart_policy': ((0, 5, 0), '1.14'), - 'extra_hosts': ((0, 7, 0), '1.3.1'), - 'pid': ((1, 0, 0), '1.17'), - 'log_driver': ((1, 2, 0), '1.18'), - 'log_opt': ((1, 2, 0), '1.18'), - 'host_config': ((0, 7, 0), '1.15'), - 'cpu_set': ((0, 6, 0), '1.14'), - 'cap_add': ((0, 5, 0), '1.14'), - 'cap_drop': ((0, 5, 0), '1.14'), - 'read_only': ((1, 0, 0), '1.17'), - 'labels': ((1, 2, 0), '1.18'), - 'stop_timeout': ((0, 5, 0), '1.0'), - 'ulimits': ((1, 2, 0), '1.18'), - # Clientside only - 'insecure_registry': ((0, 5, 0), '0.0'), - 'env_file': ((1, 4, 0), '0.0') - } + 'devices': ((0, 7, 0), '1.2'), + 'dns': ((0, 3, 0), '1.10'), + 'volumes_from': ((0, 3, 0), '1.10'), + 'restart_policy': ((0, 5, 0), '1.14'), + 'extra_hosts': ((0, 7, 0), '1.3.1'), + 'pid': ((1, 0, 0), '1.17'), + 'log_driver': ((1, 2, 0), '1.18'), + 'log_opt': ((1, 2, 0), '1.18'), + 'host_config': ((0, 7, 0), '1.15'), + 'cpu_set': ((0, 6, 0), '1.14'), + 'cap_add': ((0, 5, 0), '1.14'), + 'cap_drop': ((0, 5, 0), '1.14'), + 'read_only': ((1, 0, 0), '1.17'), + 'labels': ((1, 2, 0), '1.18'), + 'stop_timeout': ((0, 5, 0), '1.0'), + 'ulimits': ((1, 2, 0), '1.18'), + # Clientside only + 'insecure_registry': ((0, 5, 0), '0.0'), + 'env_file': ((1, 4, 0), '0.0') + } def __init__(self, module): self.module = module diff --git a/lib/ansible/modules/cloud/docker/docker_container.py b/lib/ansible/modules/cloud/docker/docker_container.py index 8a3d35d032..a7686781ca 100644 --- a/lib/ansible/modules/cloud/docker/docker_container.py +++ b/lib/ansible/modules/cloud/docker/docker_container.py @@ -1475,10 +1475,10 @@ class Container(DockerBaseClass): else: expected_devices.append( dict( - CgroupPermissions=parts[2], - PathInContainer=parts[1], - PathOnHost=parts[0] - )) + CgroupPermissions=parts[2], + PathInContainer=parts[1], + PathOnHost=parts[0] + )) return expected_devices def _get_expected_entrypoint(self): diff --git a/lib/ansible/modules/cloud/google/gce_lb.py b/lib/ansible/modules/cloud/google/gce_lb.py index 1bcdcc24a9..7815102b81 100644 --- a/lib/ansible/modules/cloud/google/gce_lb.py +++ b/lib/ansible/modules/cloud/google/gce_lb.py @@ -225,7 +225,7 @@ def main(): try: gcelb = get_driver_lb(Provider_lb.GCE)(gce_driver=gce) gcelb.connection.user_agent_append("%s/%s" % ( - USER_AGENT_PRODUCT, USER_AGENT_VERSION)) + USER_AGENT_PRODUCT, USER_AGENT_VERSION)) except Exception as e: module.fail_json(msg=unexpected_error_msg(e), changed=False) diff --git a/lib/ansible/modules/cloud/google/gce_mig.py b/lib/ansible/modules/cloud/google/gce_mig.py index facc02bc7b..a05c32860b 100644 --- a/lib/ansible/modules/cloud/google/gce_mig.py +++ b/lib/ansible/modules/cloud/google/gce_mig.py @@ -829,7 +829,7 @@ def main(): if not autoscaler: module.fail_json(msg='Unable to fetch autoscaler %s to delete \ in zone: %s' % (params['autoscaling']['name'], params['zone']), - changed=False) + changed=False) changed = delete_autoscaler(autoscaler) json_output['deleted_autoscaler'] = changed diff --git a/lib/ansible/modules/cloud/google/gce_pd.py b/lib/ansible/modules/cloud/google/gce_pd.py index 7702075d0a..7d0e7237db 100644 --- a/lib/ansible/modules/cloud/google/gce_pd.py +++ b/lib/ansible/modules/cloud/google/gce_pd.py @@ -254,7 +254,7 @@ def main(): if instance_name and inst is None: module.fail_json(msg='Instance %s does not exist in zone %s' % ( - instance_name, zone), changed=False) + instance_name, zone), changed=False) if not disk: if image is not None and snapshot is not None: diff --git a/lib/ansible/modules/cloud/google/gce_tag.py b/lib/ansible/modules/cloud/google/gce_tag.py index 68e767562c..114c314f1b 100644 --- a/lib/ansible/modules/cloud/google/gce_tag.py +++ b/lib/ansible/modules/cloud/google/gce_tag.py @@ -182,10 +182,10 @@ def main(): project_id=dict(), ), mutually_exclusive=[ - [ 'instance_name', 'instance_pattern' ] + [ 'instance_name', 'instance_pattern' ] ], required_one_of=[ - [ 'instance_name', 'instance_pattern' ] + [ 'instance_name', 'instance_pattern' ] ] ) diff --git a/lib/ansible/modules/cloud/google/gcpubsub.py b/lib/ansible/modules/cloud/google/gcpubsub.py index 814e07e6cd..5004b290a9 100644 --- a/lib/ansible/modules/cloud/google/gcpubsub.py +++ b/lib/ansible/modules/cloud/google/gcpubsub.py @@ -226,17 +226,17 @@ def pull_messages(pull_params, sub): def main(): module = AnsibleModule(argument_spec=dict( - topic=dict(required=True), - state=dict(choices=['absent', 'present'], default='present'), - publish=dict(type='list', default=None), - subscription=dict(type='dict', default=None), - service_account_email=dict(), - credentials_file=dict(), - project_id=dict(), ),) + topic=dict(required=True), + state=dict(choices=['absent', 'present'], default='present'), + publish=dict(type='list', default=None), + subscription=dict(type='dict', default=None), + service_account_email=dict(), + credentials_file=dict(), + project_id=dict(), ),) if not HAS_PYTHON26: module.fail_json( - msg="GCE module requires python's 'ast' module, python v2.6+") + msg="GCE module requires python's 'ast' module, python v2.6+") if not HAS_GOOGLE_CLOUD_PUBSUB: module.fail_json(msg="Please install google-cloud-pubsub library.") @@ -307,7 +307,7 @@ def main(): if s.push_endpoint is not None: module.fail_json(msg="Cannot pull messages, push_endpoint is configured.") (json_output['pulled_messages'], changed) = pull_messages( - mod_params['subscription']['pull'], s) + mod_params['subscription']['pull'], s) # publish messages to the topic if mod_params['publish'] and len(mod_params['publish']) > 0: diff --git a/lib/ansible/modules/cloud/google/gcpubsub_facts.py b/lib/ansible/modules/cloud/google/gcpubsub_facts.py index 13134c9396..77c7289b85 100644 --- a/lib/ansible/modules/cloud/google/gcpubsub_facts.py +++ b/lib/ansible/modules/cloud/google/gcpubsub_facts.py @@ -102,16 +102,16 @@ def list_func(data, member='name'): def main(): module = AnsibleModule(argument_spec=dict( - view=dict(choices=['topics', 'subscriptions'], default='topics'), - topic=dict(required=False), - state=dict(choices=['list'], default='list'), - service_account_email=dict(), - credentials_file=dict(), - project_id=dict(), ),) + view=dict(choices=['topics', 'subscriptions'], default='topics'), + topic=dict(required=False), + state=dict(choices=['list'], default='list'), + service_account_email=dict(), + credentials_file=dict(), + project_id=dict(), ),) if not HAS_PYTHON26: module.fail_json( - msg="GCE module requires python's 'ast' module, python v2.6+") + msg="GCE module requires python's 'ast' module, python v2.6+") if not HAS_GOOGLE_CLOUD_PUBSUB: module.fail_json(msg="Please install google-cloud-pubsub library.") diff --git a/lib/ansible/modules/cloud/linode/linode.py b/lib/ansible/modules/cloud/linode/linode.py index d51eb3529d..97a1abd4e3 100644 --- a/lib/ansible/modules/cloud/linode/linode.py +++ b/lib/ansible/modules/cloud/linode/linode.py @@ -282,13 +282,13 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino size = servers[0]['TOTALHD'] - swap if ssh_pub_key: res = api.linode_disk_createfromdistribution( - LinodeId=linode_id, DistributionID=distribution, - rootPass=password, rootSSHKey=ssh_pub_key, - Label='%s data disk (lid: %s)' % (name, linode_id), Size=size) + LinodeId=linode_id, DistributionID=distribution, + rootPass=password, rootSSHKey=ssh_pub_key, + Label='%s data disk (lid: %s)' % (name, linode_id), Size=size) else: res = api.linode_disk_createfromdistribution( - LinodeId=linode_id, DistributionID=distribution, rootPass=password, - Label='%s data disk (lid: %s)' % (name, linode_id), Size=size) + LinodeId=linode_id, DistributionID=distribution, rootPass=password, + Label='%s data disk (lid: %s)' % (name, linode_id), Size=size) jobs.append(res['JobID']) # Create SWAP disk res = api.linode_disk_create(LinodeId=linode_id, Type='swap', diff --git a/lib/ansible/modules/cloud/misc/proxmox.py b/lib/ansible/modules/cloud/misc/proxmox.py index b492c96dac..6c727cd2e3 100644 --- a/lib/ansible/modules/cloud/misc/proxmox.py +++ b/lib/ansible/modules/cloud/misc/proxmox.py @@ -402,33 +402,33 @@ def umount_instance(module, proxmox, vm, vmid, timeout): def main(): module = AnsibleModule( - argument_spec = dict( - api_host = dict(required=True), - api_user = dict(required=True), - api_password = dict(no_log=True), - vmid = dict(required=False), - validate_certs = dict(type='bool', default='no'), - node = dict(), - pool = dict(), - password = dict(no_log=True), - hostname = dict(), - ostemplate = dict(), - disk = dict(type='str', default='3'), - cpus = dict(type='int', default=1), - memory = dict(type='int', default=512), - swap = dict(type='int', default=0), - netif = dict(type='dict'), - mounts = dict(type='dict'), - ip_address = dict(), - onboot = dict(type='bool', default='no'), - storage = dict(default='local'), - cpuunits = dict(type='int', default=1000), - nameserver = dict(), - searchdomain = dict(), - timeout = dict(type='int', default=30), - force = dict(type='bool', default='no'), - state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']), - ) + argument_spec = dict( + api_host = dict(required=True), + api_user = dict(required=True), + api_password = dict(no_log=True), + vmid = dict(required=False), + validate_certs = dict(type='bool', default='no'), + node = dict(), + pool = dict(), + password = dict(no_log=True), + hostname = dict(), + ostemplate = dict(), + disk = dict(type='str', default='3'), + cpus = dict(type='int', default=1), + memory = dict(type='int', default=512), + swap = dict(type='int', default=0), + netif = dict(type='dict'), + mounts = dict(type='dict'), + ip_address = dict(), + onboot = dict(type='bool', default='no'), + storage = dict(default='local'), + cpuunits = dict(type='int', default=1000), + nameserver = dict(), + searchdomain = dict(), + timeout = dict(type='int', default=30), + force = dict(type='bool', default='no'), + state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted']), + ) ) if not HAS_PROXMOXER: diff --git a/lib/ansible/modules/cloud/misc/proxmox_kvm.py b/lib/ansible/modules/cloud/misc/proxmox_kvm.py index 85b595317a..25d80fff69 100644 --- a/lib/ansible/modules/cloud/misc/proxmox_kvm.py +++ b/lib/ansible/modules/cloud/misc/proxmox_kvm.py @@ -795,71 +795,71 @@ def stop_vm(module, proxmox, vm, vmid, timeout, force): def main(): module = AnsibleModule( - argument_spec = dict( - acpi = dict(type='bool', default='yes'), - agent = dict(type='bool'), - args = dict(type='str', default=None), - api_host = dict(required=True), - api_user = dict(required=True), - api_password = dict(no_log=True), - autostart = dict(type='bool', default='no'), - balloon = dict(type='int',default=0), - bios = dict(choices=['seabios', 'ovmf']), - boot = dict(type='str', default='cnd'), - bootdisk = dict(type='str'), - cores = dict(type='int', default=1), - cpu = dict(type='str', default='kvm64'), - cpulimit = dict(type='int'), - cpuunits = dict(type='int', default=1000), - delete = dict(type='str'), - description = dict(type='str'), - digest = dict(type='str'), - force = dict(type='bool', default=None), - freeze = dict(type='bool'), - hostpci = dict(type='dict'), - hotplug = dict(type='str'), - hugepages = dict(choices=['any', '2', '1024']), - ide = dict(type='dict', default=None), - keyboard = dict(type='str'), - kvm = dict(type='bool', default='yes'), - localtime = dict(type='bool'), - lock = dict(choices=['migrate', 'backup', 'snapshot', 'rollback']), - machine = dict(type='str'), - memory = dict(type='int', default=512), - migrate_downtime = dict(type='int'), - migrate_speed = dict(type='int'), - name = dict(type='str'), - net = dict(type='dict'), - node = dict(), - numa = dict(type='dict'), - onboot = dict(type='bool', default='yes'), - ostype = dict(default='l26', choices=['other', 'wxp', 'w2k', 'w2k3', 'w2k8', 'wvista', 'win7', 'win8', 'l24', 'l26', 'solaris']), - parallel = dict(type='dict'), - protection = dict(type='bool'), - reboot = dict(type='bool'), - revert = dict(), - sata = dict(type='dict'), - scsi = dict(type='dict'), - scsihw = dict(choices=['lsi', 'lsi53c810', 'virtio-scsi-pci', 'virtio-scsi-single', 'megasas', 'pvscsi']), - serial = dict(type='dict'), - shares = dict(type='int'), - skiplock = dict(type='bool'), - smbios = dict(type='str'), - sockets = dict(type='int', default=1), - startdate = dict(type='str'), - startup = dict(), - state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted', 'current']), - tablet = dict(type='bool', default='no'), - tdf = dict(type='bool'), - template = dict(type='bool', default='no'), - timeout = dict(type='int', default=30), - validate_certs = dict(type='bool', default='no'), - vcpus = dict(type='int', default=None), - vga = dict(default='std', choices=['std', 'cirrus', 'vmware', 'qxl', 'serial0', 'serial1', 'serial2', 'serial3', 'qxl2', 'qxl3', 'qxl4']), - virtio = dict(type='dict', default=None), - vmid = dict(type='int', default=None), - watchdog = dict(), - ) + argument_spec = dict( + acpi = dict(type='bool', default='yes'), + agent = dict(type='bool'), + args = dict(type='str', default=None), + api_host = dict(required=True), + api_user = dict(required=True), + api_password = dict(no_log=True), + autostart = dict(type='bool', default='no'), + balloon = dict(type='int',default=0), + bios = dict(choices=['seabios', 'ovmf']), + boot = dict(type='str', default='cnd'), + bootdisk = dict(type='str'), + cores = dict(type='int', default=1), + cpu = dict(type='str', default='kvm64'), + cpulimit = dict(type='int'), + cpuunits = dict(type='int', default=1000), + delete = dict(type='str'), + description = dict(type='str'), + digest = dict(type='str'), + force = dict(type='bool', default=None), + freeze = dict(type='bool'), + hostpci = dict(type='dict'), + hotplug = dict(type='str'), + hugepages = dict(choices=['any', '2', '1024']), + ide = dict(type='dict', default=None), + keyboard = dict(type='str'), + kvm = dict(type='bool', default='yes'), + localtime = dict(type='bool'), + lock = dict(choices=['migrate', 'backup', 'snapshot', 'rollback']), + machine = dict(type='str'), + memory = dict(type='int', default=512), + migrate_downtime = dict(type='int'), + migrate_speed = dict(type='int'), + name = dict(type='str'), + net = dict(type='dict'), + node = dict(), + numa = dict(type='dict'), + onboot = dict(type='bool', default='yes'), + ostype = dict(default='l26', choices=['other', 'wxp', 'w2k', 'w2k3', 'w2k8', 'wvista', 'win7', 'win8', 'l24', 'l26', 'solaris']), + parallel = dict(type='dict'), + protection = dict(type='bool'), + reboot = dict(type='bool'), + revert = dict(), + sata = dict(type='dict'), + scsi = dict(type='dict'), + scsihw = dict(choices=['lsi', 'lsi53c810', 'virtio-scsi-pci', 'virtio-scsi-single', 'megasas', 'pvscsi']), + serial = dict(type='dict'), + shares = dict(type='int'), + skiplock = dict(type='bool'), + smbios = dict(type='str'), + sockets = dict(type='int', default=1), + startdate = dict(type='str'), + startup = dict(), + state = dict(default='present', choices=['present', 'absent', 'stopped', 'started', 'restarted', 'current']), + tablet = dict(type='bool', default='no'), + tdf = dict(type='bool'), + template = dict(type='bool', default='no'), + timeout = dict(type='int', default=30), + validate_certs = dict(type='bool', default='no'), + vcpus = dict(type='int', default=None), + vga = dict(default='std', choices=['std', 'cirrus', 'vmware', 'qxl', 'serial0', 'serial1', 'serial2', 'serial3', 'qxl2', 'qxl3', 'qxl4']), + virtio = dict(type='dict', default=None), + vmid = dict(type='int', default=None), + watchdog = dict(), + ) ) if not HAS_PROXMOXER: diff --git a/lib/ansible/modules/cloud/misc/proxmox_template.py b/lib/ansible/modules/cloud/misc/proxmox_template.py index 64c9b96cb6..e46a167fc9 100644 --- a/lib/ansible/modules/cloud/misc/proxmox_template.py +++ b/lib/ansible/modules/cloud/misc/proxmox_template.py @@ -179,20 +179,20 @@ def delete_template(module, proxmox, node, storage, content_type, template, time def main(): module = AnsibleModule( - argument_spec = dict( - api_host = dict(required=True), - api_user = dict(required=True), - api_password = dict(no_log=True), - validate_certs = dict(type='bool', default='no'), - node = dict(), - src = dict(), - template = dict(), - content_type = dict(default='vztmpl', choices=['vztmpl','iso']), - storage = dict(default='local'), - timeout = dict(type='int', default=30), - force = dict(type='bool', default='no'), - state = dict(default='present', choices=['present', 'absent']), - ) + argument_spec = dict( + api_host = dict(required=True), + api_user = dict(required=True), + api_password = dict(no_log=True), + validate_certs = dict(type='bool', default='no'), + node = dict(), + src = dict(), + template = dict(), + content_type = dict(default='vztmpl', choices=['vztmpl','iso']), + storage = dict(default='local'), + timeout = dict(type='int', default=30), + force = dict(type='bool', default='no'), + state = dict(default='present', choices=['present', 'absent']), + ) ) if not HAS_PROXMOXER: diff --git a/lib/ansible/modules/cloud/misc/virt.py b/lib/ansible/modules/cloud/misc/virt.py index 1a907ca174..4227aae43f 100644 --- a/lib/ansible/modules/cloud/misc/virt.py +++ b/lib/ansible/modules/cloud/misc/virt.py @@ -132,13 +132,13 @@ ALL_COMMANDS.extend(VM_COMMANDS) ALL_COMMANDS.extend(HOST_COMMANDS) VIRT_STATE_NAME_MAP = { - 0 : "running", - 1 : "running", - 2 : "running", - 3 : "paused", - 4 : "shutdown", - 5 : "shutdown", - 6 : "crashed" + 0 : "running", + 1 : "running", + 2 : "running", + 3 : "paused", + 4 : "shutdown", + 5 : "shutdown", + 6 : "crashed" } class VMNotFound(Exception): diff --git a/lib/ansible/modules/cloud/openstack/_glance_image.py b/lib/ansible/modules/cloud/openstack/_glance_image.py index d915da8a56..18b960bbf9 100644 --- a/lib/ansible/modules/cloud/openstack/_glance_image.py +++ b/lib/ansible/modules/cloud/openstack/_glance_image.py @@ -173,7 +173,7 @@ def _get_glance_client(module, kwargs): token = _ksclient.auth_token endpoint =_get_endpoint(module, _ksclient, kwargs.get('endpoint_type')) kwargs = { - 'token': token, + 'token': token, } try: client = glanceclient.Client('1', endpoint, **kwargs) @@ -194,12 +194,12 @@ def _glance_image_present(module, params, client): def _glance_image_create(module, params, client): kwargs = { - 'name': params.get('name'), - 'disk_format': params.get('disk_format'), - 'container_format': params.get('container_format'), - 'owner': params.get('owner'), - 'is_public': params.get('is_public'), - 'copy_from': params.get('copy_from'), + 'name': params.get('name'), + 'disk_format': params.get('disk_format'), + 'container_format': params.get('container_format'), + 'owner': params.get('owner'), + 'is_public': params.get('is_public'), + 'copy_from': params.get('copy_from'), } try: timeout = float(params.get('timeout')) diff --git a/lib/ansible/modules/cloud/openstack/_keystone_user.py b/lib/ansible/modules/cloud/openstack/_keystone_user.py index 202adc63f6..f563974d5f 100644 --- a/lib/ansible/modules/cloud/openstack/_keystone_user.py +++ b/lib/ansible/modules/cloud/openstack/_keystone_user.py @@ -332,19 +332,19 @@ def main(): argument_spec = openstack_argument_spec() argument_spec.update(dict( - tenant_description=dict(required=False), - email=dict(required=False), - user=dict(required=False), - tenant=dict(required=False), - password=dict(required=False), - role=dict(required=False), - state=dict(default='present', choices=['present', 'absent']), - endpoint=dict(required=False, + tenant_description=dict(required=False), + email=dict(required=False), + user=dict(required=False), + tenant=dict(required=False), + password=dict(required=False), + role=dict(required=False), + state=dict(default='present', choices=['present', 'absent']), + endpoint=dict(required=False, default="http://127.0.0.1:35357/v2.0"), - token=dict(required=False), - login_user=dict(required=False), - login_password=dict(required=False), - login_tenant_name=dict(required=False) + token=dict(required=False), + login_user=dict(required=False), + login_password=dict(required=False), + login_tenant_name=dict(required=False) )) # keystone operations themselves take an endpoint, not a keystone auth_url del(argument_spec['auth_url']) diff --git a/lib/ansible/modules/cloud/openstack/_nova_compute.py b/lib/ansible/modules/cloud/openstack/_nova_compute.py index 56252feea7..fd22545f37 100644 --- a/lib/ansible/modules/cloud/openstack/_nova_compute.py +++ b/lib/ansible/modules/cloud/openstack/_nova_compute.py @@ -428,12 +428,12 @@ def _create_server(module, nova): flavor_id = _get_flavor_id(module, nova) bootargs = [module.params['name'], image_id, flavor_id] bootkwargs = { - 'nics' : module.params['nics'], - 'meta' : module.params['meta'], - 'security_groups': module.params['security_groups'].split(','), - #userdata is unhyphenated in novaclient, but hyphenated here for consistency with the ec2 module: - 'userdata': module.params['user_data'], - 'config_drive': module.params['config_drive'], + 'nics' : module.params['nics'], + 'meta' : module.params['meta'], + 'security_groups': module.params['security_groups'].split(','), + #userdata is unhyphenated in novaclient, but hyphenated here for consistency with the ec2 module: + 'userdata': module.params['user_data'], + 'config_drive': module.params['config_drive'], } for optional_param in ('region_name', 'key_name', 'availability_zone', 'scheduler_hints'): diff --git a/lib/ansible/modules/cloud/openstack/_quantum_floating_ip.py b/lib/ansible/modules/cloud/openstack/_quantum_floating_ip.py index 6171a553ac..c6aee1f4eb 100644 --- a/lib/ansible/modules/cloud/openstack/_quantum_floating_ip.py +++ b/lib/ansible/modules/cloud/openstack/_quantum_floating_ip.py @@ -136,8 +136,8 @@ def _get_neutron_client(module, kwargs): token = _ksclient.auth_token endpoint = _get_endpoint(module, _ksclient) kwargs = { - 'token': token, - 'endpoint_url': endpoint + 'token': token, + 'endpoint_url': endpoint } try: neutron = client.Client('2.0', **kwargs) @@ -174,7 +174,7 @@ def _get_port_info(neutron, module, instance_id, internal_network_name=None): subnets = neutron.list_subnets(**kwargs) subnet_id = subnets['subnets'][0]['id'] kwargs = { - 'device_id': instance_id, + 'device_id': instance_id, } try: ports = neutron.list_ports(**kwargs) @@ -193,7 +193,7 @@ def _get_port_info(neutron, module, instance_id, internal_network_name=None): def _get_floating_ip(module, neutron, fixed_ip_address, network_name): kwargs = { - 'fixed_ip_address': fixed_ip_address + 'fixed_ip_address': fixed_ip_address } try: ips = neutron.list_floatingips(**kwargs) @@ -214,9 +214,9 @@ def _check_ips_network(neutron, net_id, network_name): def _create_floating_ip(neutron, module, port_id, net_id, fixed_ip): kwargs = { - 'port_id': port_id, - 'floating_network_id': net_id, - 'fixed_ip_address': fixed_ip + 'port_id': port_id, + 'floating_network_id': net_id, + 'fixed_ip_address': fixed_ip } try: result = neutron.create_floatingip({'floatingip': kwargs}) @@ -251,10 +251,10 @@ def main(): argument_spec = openstack_argument_spec() argument_spec.update(dict( - network_name = dict(required=True), - instance_name = dict(required=True), - state = dict(default='present', choices=['absent', 'present']), - internal_network_name = dict(default=None), + network_name = dict(required=True), + instance_name = dict(required=True), + state = dict(default='present', choices=['absent', 'present']), + internal_network_name = dict(default=None), )) module = AnsibleModule(argument_spec=argument_spec) 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 55bf1c0b35..090f65ef4d 100644 --- a/lib/ansible/modules/cloud/openstack/_quantum_floating_ip_associate.py +++ b/lib/ansible/modules/cloud/openstack/_quantum_floating_ip_associate.py @@ -125,8 +125,8 @@ def _get_neutron_client(module, kwargs): token = _ksclient.auth_token endpoint = _get_endpoint(module, _ksclient) kwargs = { - 'token': token, - 'endpoint_url': endpoint + 'token': token, + 'endpoint_url': endpoint } try: neutron = client.Client('2.0', **kwargs) @@ -191,9 +191,9 @@ def main(): argument_spec = openstack_argument_spec() argument_spec.update(dict( - ip_address = dict(required=True), - instance_name = dict(required=True), - state = dict(default='present', choices=['absent', 'present']) + ip_address = dict(required=True), + instance_name = dict(required=True), + state = dict(default='present', choices=['absent', 'present']) )) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/openstack/_quantum_network.py b/lib/ansible/modules/cloud/openstack/_quantum_network.py index 3a2c754b2e..ce31ff76dd 100644 --- a/lib/ansible/modules/cloud/openstack/_quantum_network.py +++ b/lib/ansible/modules/cloud/openstack/_quantum_network.py @@ -167,8 +167,8 @@ def _get_neutron_client(module, kwargs): token = _ksclient.auth_token endpoint = _get_endpoint(module, _ksclient) kwargs = { - 'token': token, - 'endpoint_url': endpoint + 'token': token, + 'endpoint_url': endpoint } try: neutron = client.Client('2.0', **kwargs) @@ -192,8 +192,8 @@ def _set_tenant_id(module): def _get_net_id(neutron, module): kwargs = { - 'tenant_id': _os_tenant_id, - 'name': module.params['name'], + 'tenant_id': _os_tenant_id, + 'name': module.params['name'], } try: networks = neutron.list_networks(**kwargs) @@ -251,15 +251,15 @@ def main(): argument_spec = openstack_argument_spec() argument_spec.update(dict( - name = dict(required=True), - tenant_name = dict(default=None), - provider_network_type = dict(default=None, choices=['local', 'vlan', 'flat', 'gre']), - provider_physical_network = dict(default=None), - provider_segmentation_id = dict(default=None), - router_external = dict(default=False, type='bool'), - shared = dict(default=False, type='bool'), - admin_state_up = dict(default=True, type='bool'), - state = dict(default='present', choices=['absent', 'present']) + name = dict(required=True), + tenant_name = dict(default=None), + provider_network_type = dict(default=None, choices=['local', 'vlan', 'flat', 'gre']), + provider_physical_network = dict(default=None), + provider_segmentation_id = dict(default=None), + router_external = dict(default=False, type='bool'), + shared = dict(default=False, type='bool'), + admin_state_up = dict(default=True, type='bool'), + state = dict(default='present', choices=['absent', 'present']) )) module = AnsibleModule(argument_spec=argument_spec) diff --git a/lib/ansible/modules/cloud/openstack/_quantum_router.py b/lib/ansible/modules/cloud/openstack/_quantum_router.py index 6726ca20a6..3ba05c9fde 100644 --- a/lib/ansible/modules/cloud/openstack/_quantum_router.py +++ b/lib/ansible/modules/cloud/openstack/_quantum_router.py @@ -129,8 +129,8 @@ def _get_neutron_client(module, kwargs): token = _ksclient.auth_token endpoint = _get_endpoint(module, _ksclient) kwargs = { - 'token': token, - 'endpoint_url': endpoint + 'token': token, + 'endpoint_url': endpoint } try: neutron = client.Client('2.0', **kwargs) @@ -154,8 +154,8 @@ def _set_tenant_id(module): def _get_router_id(module, neutron): kwargs = { - 'name': module.params['name'], - 'tenant_id': _os_tenant_id, + 'name': module.params['name'], + 'tenant_id': _os_tenant_id, } try: routers = neutron.list_routers(**kwargs) @@ -167,9 +167,9 @@ def _get_router_id(module, neutron): def _create_router(module, neutron): router = { - 'name': module.params['name'], - 'tenant_id': _os_tenant_id, - 'admin_state_up': module.params['admin_state_up'], + 'name': module.params['name'], + 'tenant_id': _os_tenant_id, + 'admin_state_up': module.params['admin_state_up'], } try: new_router = neutron.create_router(dict(router=router)) diff --git a/lib/ansible/modules/cloud/openstack/_quantum_router_gateway.py b/lib/ansible/modules/cloud/openstack/_quantum_router_gateway.py index 7568d297a6..68159985f3 100644 --- a/lib/ansible/modules/cloud/openstack/_quantum_router_gateway.py +++ b/lib/ansible/modules/cloud/openstack/_quantum_router_gateway.py @@ -123,8 +123,8 @@ def _get_neutron_client(module, kwargs): token = _ksclient.auth_token endpoint = _get_endpoint(module, _ksclient) kwargs = { - 'token': token, - 'endpoint_url': endpoint + 'token': token, + 'endpoint_url': endpoint } try: neutron = client.Client('2.0', **kwargs) @@ -134,7 +134,7 @@ def _get_neutron_client(module, kwargs): def _get_router_id(module, neutron): kwargs = { - 'name': module.params['router_name'], + 'name': module.params['router_name'], } try: routers = neutron.list_routers(**kwargs) @@ -191,9 +191,9 @@ def main(): argument_spec = openstack_argument_spec() argument_spec.update(dict( - router_name = dict(required=True), - network_name = dict(required=True), - state = dict(default='present', choices=['absent', 'present']), + router_name = dict(required=True), + network_name = dict(required=True), + state = dict(default='present', choices=['absent', 'present']), )) module = AnsibleModule(argument_spec=argument_spec) if not HAVE_DEPS: diff --git a/lib/ansible/modules/cloud/openstack/_quantum_router_interface.py b/lib/ansible/modules/cloud/openstack/_quantum_router_interface.py index 9af05b1b44..5460f427cb 100644 --- a/lib/ansible/modules/cloud/openstack/_quantum_router_interface.py +++ b/lib/ansible/modules/cloud/openstack/_quantum_router_interface.py @@ -132,8 +132,8 @@ def _get_neutron_client(module, kwargs): token = _ksclient.auth_token endpoint = _get_endpoint(module, _ksclient) kwargs = { - 'token': token, - 'endpoint_url': endpoint + 'token': token, + 'endpoint_url': endpoint } try: neutron = client.Client('2.0', **kwargs) @@ -171,8 +171,8 @@ def _get_router_id(module, neutron): def _get_subnet_id(module, neutron): subnet_id = None kwargs = { - 'tenant_id': _os_tenant_id, - 'name': module.params['subnet_name'], + 'tenant_id': _os_tenant_id, + 'name': module.params['subnet_name'], } try: subnets = neutron.list_subnets(**kwargs) @@ -184,8 +184,8 @@ def _get_subnet_id(module, neutron): def _get_port_id(neutron, module, router_id, subnet_id): kwargs = { - 'tenant_id': _os_tenant_id, - 'device_id': router_id, + 'tenant_id': _os_tenant_id, + 'device_id': router_id, } try: ports = neutron.list_ports(**kwargs) @@ -222,10 +222,10 @@ def _remove_interface_router(neutron, module, router_id, subnet_id): def main(): argument_spec = openstack_argument_spec() argument_spec.update(dict( - router_name = dict(required=True), - subnet_name = dict(required=True), - tenant_name = dict(default=None), - state = dict(default='present', choices=['absent', 'present']), + router_name = dict(required=True), + subnet_name = dict(required=True), + tenant_name = dict(default=None), + state = dict(default='present', choices=['absent', 'present']), )) module = AnsibleModule(argument_spec=argument_spec) if not HAVE_DEPS: diff --git a/lib/ansible/modules/cloud/openstack/_quantum_subnet.py b/lib/ansible/modules/cloud/openstack/_quantum_subnet.py index f59919a464..ab1a6d4140 100644 --- a/lib/ansible/modules/cloud/openstack/_quantum_subnet.py +++ b/lib/ansible/modules/cloud/openstack/_quantum_subnet.py @@ -168,8 +168,8 @@ def _get_neutron_client(module, kwargs): token = _ksclient.auth_token endpoint = _get_endpoint(module, _ksclient) kwargs = { - 'token': token, - 'endpoint_url': endpoint + 'token': token, + 'endpoint_url': endpoint } try: neutron = client.Client('2.0', **kwargs) @@ -227,14 +227,14 @@ def _get_subnet_id(module, neutron): def _create_subnet(module, neutron): neutron.format = 'json' subnet = { - 'name': module.params['name'], - 'ip_version': module.params['ip_version'], - 'enable_dhcp': module.params['enable_dhcp'], - 'tenant_id': _os_tenant_id, - 'gateway_ip': module.params['gateway_ip'], - 'dns_nameservers': module.params['dns_nameservers'], - 'network_id': _os_network_id, - 'cidr': module.params['cidr'], + 'name': module.params['name'], + 'ip_version': module.params['ip_version'], + 'enable_dhcp': module.params['enable_dhcp'], + 'tenant_id': _os_tenant_id, + 'gateway_ip': module.params['gateway_ip'], + 'dns_nameservers': module.params['dns_nameservers'], + 'network_id': _os_network_id, + 'cidr': module.params['cidr'], } if module.params['allocation_pool_start'] and module.params['allocation_pool_end']: allocation_pools = [ @@ -269,17 +269,17 @@ def main(): argument_spec = openstack_argument_spec() argument_spec.update(dict( - name = dict(required=True), - network_name = dict(required=True), - cidr = dict(required=True), - tenant_name = dict(default=None), - state = dict(default='present', choices=['absent', 'present']), - ip_version = dict(default='4', choices=['4', '6']), - enable_dhcp = dict(default='true', type='bool'), - gateway_ip = dict(default=None), - dns_nameservers = dict(default=None), - allocation_pool_start = dict(default=None), - allocation_pool_end = dict(default=None), + name = dict(required=True), + network_name = dict(required=True), + cidr = dict(required=True), + tenant_name = dict(default=None), + state = dict(default='present', choices=['absent', 'present']), + ip_version = dict(default='4', choices=['4', '6']), + enable_dhcp = dict(default='true', type='bool'), + gateway_ip = dict(default=None), + dns_nameservers = dict(default=None), + allocation_pool_start = dict(default=None), + allocation_pool_end = dict(default=None), )) module = AnsibleModule(argument_spec=argument_spec) if not HAVE_DEPS: diff --git a/lib/ansible/modules/cloud/openstack/os_auth.py b/lib/ansible/modules/cloud/openstack/os_auth.py index bcc95aaaa1..1d1aadb9f2 100644 --- a/lib/ansible/modules/cloud/openstack/os_auth.py +++ b/lib/ansible/modules/cloud/openstack/os_auth.py @@ -64,8 +64,8 @@ def main(): module.exit_json( changed=False, ansible_facts=dict( - auth_token=cloud.auth_token, - service_catalog=cloud.service_catalog)) + auth_token=cloud.auth_token, + service_catalog=cloud.service_catalog)) except shade.OpenStackCloudException as e: module.fail_json(msg=str(e)) diff --git a/lib/ansible/modules/cloud/openstack/os_quota.py b/lib/ansible/modules/cloud/openstack/os_quota.py index 0de7d1d322..407afe0e6a 100644 --- a/lib/ansible/modules/cloud/openstack/os_quota.py +++ b/lib/ansible/modules/cloud/openstack/os_quota.py @@ -345,9 +345,9 @@ def _system_state_change(module, project_quota_output): """ changes_required, quota_change_request = _system_state_change_details( - module, - project_quota_output - ) + module, + project_quota_output + ) if changes_required: return True @@ -452,9 +452,9 @@ def main(): module.exit_json(changed=_system_state_change(module, project_quota_output)) changes_required, quota_change_request = _system_state_change_details( - module, - project_quota_output - ) + module, + project_quota_output + ) if changes_required: for quota_type in quota_change_request.keys(): diff --git a/lib/ansible/modules/cloud/openstack/os_recordset.py b/lib/ansible/modules/cloud/openstack/os_recordset.py index 62fa856410..2a13a94fde 100644 --- a/lib/ansible/modules/cloud/openstack/os_recordset.py +++ b/lib/ansible/modules/cloud/openstack/os_recordset.py @@ -215,10 +215,10 @@ def main(): zone, pre_update_recordset) if changed: zone = cloud.update_recordset( - zone, name + '.' + zone, - records=records, - description=description, - ttl=ttl) + zone, name + '.' + zone, + records=records, + description=description, + ttl=ttl) module.exit_json(changed=changed, recordset=recordset) elif state == 'absent': diff --git a/lib/ansible/modules/cloud/openstack/os_zone.py b/lib/ansible/modules/cloud/openstack/os_zone.py index 51d59ec195..6174cb4ecc 100644 --- a/lib/ansible/modules/cloud/openstack/os_zone.py +++ b/lib/ansible/modules/cloud/openstack/os_zone.py @@ -212,9 +212,9 @@ def main(): masters, pre_update_zone) if changed: zone = cloud.update_zone( - name, email=email, - description=description, - ttl=ttl, masters=masters) + name, email=email, + description=description, + ttl=ttl, masters=masters) module.exit_json(changed=changed, zone=zone) elif state == 'absent': diff --git a/lib/ansible/modules/cloud/packet/packet_sshkey.py b/lib/ansible/modules/cloud/packet/packet_sshkey.py index b17ad7bf87..2d0d580ec6 100644 --- a/lib/ansible/modules/cloud/packet/packet_sshkey.py +++ b/lib/ansible/modules/cloud/packet/packet_sshkey.py @@ -202,7 +202,7 @@ def act_on_sshkeys(target_state, module, packet_conn): raise Exception(_msg) matching_sshkeys = [] new_key_response = packet_conn.create_ssh_key( - newkey['label'], newkey['key']) + newkey['label'], newkey['key']) changed = True matching_sshkeys.append(new_key_response) diff --git a/lib/ansible/modules/cloud/softlayer/sl_vm.py b/lib/ansible/modules/cloud/softlayer/sl_vm.py index bb76a203b3..63c5ebe5d7 100644 --- a/lib/ansible/modules/cloud/softlayer/sl_vm.py +++ b/lib/ansible/modules/cloud/softlayer/sl_vm.py @@ -260,9 +260,9 @@ except ImportError: def create_virtual_instance(module): instances = vsManager.list_instances( - hostname = module.params.get('hostname'), - domain = module.params.get('domain'), - datacenter = module.params.get('datacenter') + hostname = module.params.get('hostname'), + domain = module.params.get('domain'), + datacenter = module.params.get('datacenter') ) if instances: @@ -283,24 +283,24 @@ def create_virtual_instance(module): tags = ','.join(map(str, module.params.get('tags'))) instance = vsManager.create_instance( - hostname = module.params.get('hostname'), - domain = module.params.get('domain'), - cpus = module.params.get('cpus'), - memory = module.params.get('memory'), - hourly = module.params.get('hourly'), - datacenter = module.params.get('datacenter'), - os_code = module.params.get('os_code'), - image_id = module.params.get('image_id'), - local_disk = module.params.get('local_disk'), - disks = module.params.get('disks'), - ssh_keys = module.params.get('ssh_keys'), - nic_speed = module.params.get('nic_speed'), - private = module.params.get('private'), - public_vlan = module.params.get('public_vlan'), - private_vlan = module.params.get('private_vlan'), - dedicated = module.params.get('dedicated'), - post_uri = module.params.get('post_uri'), - tags = tags) + hostname = module.params.get('hostname'), + domain = module.params.get('domain'), + cpus = module.params.get('cpus'), + memory = module.params.get('memory'), + hourly = module.params.get('hourly'), + datacenter = module.params.get('datacenter'), + os_code = module.params.get('os_code'), + image_id = module.params.get('image_id'), + local_disk = module.params.get('local_disk'), + disks = module.params.get('disks'), + ssh_keys = module.params.get('ssh_keys'), + nic_speed = module.params.get('nic_speed'), + private = module.params.get('private'), + public_vlan = module.params.get('public_vlan'), + private_vlan = module.params.get('private_vlan'), + dedicated = module.params.get('dedicated'), + post_uri = module.params.get('post_uri'), + tags = tags) if instance is not None and instance['id'] > 0: return True, instance @@ -349,30 +349,30 @@ def cancel_instance(module): def main(): module = AnsibleModule( - argument_spec=dict( - instance_id=dict(), - hostname=dict(), - domain=dict(), - datacenter=dict(choices=DATACENTERS), - tags=dict(), - hourly=dict(type='bool', default=True), - private=dict(type='bool', default=False), - dedicated=dict(type='bool', default=False), - local_disk=dict(type='bool', default=True), - cpus=dict(type='int', choices=CPU_SIZES), - memory=dict(type='int', choices=MEMORY_SIZES), - disks=dict(type='list', default=[25]), - os_code=dict(), - image_id=dict(), - nic_speed=dict(type='int', choices=NIC_SPEEDS), - public_vlan=dict(), - private_vlan=dict(), - ssh_keys=dict(type='list', default=[]), - post_uri=dict(), - state=dict(default='present', choices=STATES), - wait=dict(type='bool', default=True), - wait_time=dict(type='int', default=600) - ) + argument_spec=dict( + instance_id=dict(), + hostname=dict(), + domain=dict(), + datacenter=dict(choices=DATACENTERS), + tags=dict(), + hourly=dict(type='bool', default=True), + private=dict(type='bool', default=False), + dedicated=dict(type='bool', default=False), + local_disk=dict(type='bool', default=True), + cpus=dict(type='int', choices=CPU_SIZES), + memory=dict(type='int', choices=MEMORY_SIZES), + disks=dict(type='list', default=[25]), + os_code=dict(), + image_id=dict(), + nic_speed=dict(type='int', choices=NIC_SPEEDS), + public_vlan=dict(), + private_vlan=dict(), + ssh_keys=dict(type='list', default=[]), + post_uri=dict(), + state=dict(default='present', choices=STATES), + wait=dict(type='bool', default=True), + wait_time=dict(type='int', default=600) + ) ) if not HAS_SL: diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest.py b/lib/ansible/modules/cloud/vmware/vmware_guest.py index d61f807093..ba59d74851 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest.py @@ -408,9 +408,9 @@ class PyVmomiDeviceHelper(object): @staticmethod def is_scsi_controller(device): return isinstance(device, vim.vm.device.VirtualLsiLogicController) or \ - isinstance(device, vim.vm.device.ParaVirtualSCSIController) or \ - isinstance(device, vim.vm.device.VirtualBusLogicController) or \ - isinstance(device, vim.vm.device.VirtualLsiLogicSASController) + isinstance(device, vim.vm.device.ParaVirtualSCSIController) or \ + isinstance(device, vim.vm.device.VirtualBusLogicController) or \ + isinstance(device, vim.vm.device.VirtualLsiLogicSASController) def create_scsi_disk(self, scsi_ctl, disk_index=None): diskspec = vim.vm.device.VirtualDeviceSpec() diff --git a/lib/ansible/modules/cloud/vmware/vmware_local_user_manager.py b/lib/ansible/modules/cloud/vmware/vmware_local_user_manager.py index ac52b57465..dff87c00ac 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_local_user_manager.py +++ b/lib/ansible/modules/cloud/vmware/vmware_local_user_manager.py @@ -91,8 +91,8 @@ class VMwareLocalUserManager(object): try: local_account_manager_states = { 'absent': { - 'present': self.state_remove_user, - 'absent': self.state_exit_unchanged, + 'present': self.state_remove_user, + 'absent': self.state_exit_unchanged, }, 'present': { 'present': self.state_update_user, diff --git a/lib/ansible/modules/cloud/webfaction/webfaction_site.py b/lib/ansible/modules/cloud/webfaction/webfaction_site.py index 7a28f40cdb..f4a81d6f52 100644 --- a/lib/ansible/modules/cloud/webfaction/webfaction_site.py +++ b/lib/ansible/modules/cloud/webfaction/webfaction_site.py @@ -178,8 +178,8 @@ def main(): if not module.check_mode: # If this isn't a dry run, create or modify the site result.update( - webfaction.create_website( - *positional_args + webfaction.create_website( + *positional_args ) if not existing_site else webfaction.update_website ( *positional_args ) diff --git a/lib/ansible/modules/clustering/consul.py b/lib/ansible/modules/clustering/consul.py index 8618dbbd4a..6caa5e9e50 100644 --- a/lib/ansible/modules/clustering/consul.py +++ b/lib/ansible/modules/clustering/consul.py @@ -366,18 +366,18 @@ 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'), - ) + 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): @@ -578,7 +578,7 @@ def main(): register_with_consul(module) except ConnectionError as e: module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % ( - module.params.get('host'), module.params.get('port'), str(e))) + module.params.get('host'), module.params.get('port'), str(e))) except Exception as e: module.fail_json(msg=str(e)) diff --git a/lib/ansible/modules/clustering/consul_acl.py b/lib/ansible/modules/clustering/consul_acl.py index 43f953c7b5..b9d09ba22c 100644 --- a/lib/ansible/modules/clustering/consul_acl.py +++ b/lib/ansible/modules/clustering/consul_acl.py @@ -223,7 +223,7 @@ def load_rules_for_token(module, consul_api, token): except Exception as e: module.fail_json( msg="Could not load rule list from retrieved rule data %s, %s" % ( - token, e)) + token, e)) return json_to_rules(module, loaded) @@ -357,7 +357,7 @@ def main(): execute(module) except ConnectionError as e: module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % ( - module.params.get('host'), module.params.get('port'), str(e))) + module.params.get('host'), module.params.get('port'), str(e))) except Exception as e: module.fail_json(msg=str(e)) diff --git a/lib/ansible/modules/clustering/consul_kv.py b/lib/ansible/modules/clustering/consul_kv.py index 3f5cb9a4c8..04ff8a86f8 100644 --- a/lib/ansible/modules/clustering/consul_kv.py +++ b/lib/ansible/modules/clustering/consul_kv.py @@ -282,7 +282,7 @@ def main(): execute(module) except ConnectionError as e: module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % ( - module.params.get('host'), module.params.get('port'), str(e))) + module.params.get('host'), module.params.get('port'), str(e))) except Exception as e: module.fail_json(msg=str(e)) diff --git a/lib/ansible/modules/clustering/consul_session.py b/lib/ansible/modules/clustering/consul_session.py index e2c23c45dc..c1cafb3bbf 100644 --- a/lib/ansible/modules/clustering/consul_session.py +++ b/lib/ansible/modules/clustering/consul_session.py @@ -173,7 +173,7 @@ def lookup_sessions(module): node = module.params.get('node') if not node: module.fail_json( - msg="node name is required to retrieve sessions for node") + msg="node name is required to retrieve sessions for node") sessions = consul_client.session.node(node, dc=datacenter) module.exit_json(changed=True, node=node, @@ -182,7 +182,7 @@ def lookup_sessions(module): session_id = module.params.get('id') if not session_id: module.fail_json( - msg="session_id is required to retrieve indvidual session info") + msg="session_id is required to retrieve indvidual session info") session_by_id = consul_client.session.info(session_id, dc=datacenter) module.exit_json(changed=True, @@ -276,7 +276,7 @@ def main(): execute(module) except ConnectionError as e: module.fail_json(msg='Could not connect to consul agent at %s:%s, error was %s' % ( - module.params.get('host'), module.params.get('port'), str(e))) + module.params.get('host'), module.params.get('port'), str(e))) except Exception as e: module.fail_json(msg=str(e)) diff --git a/lib/ansible/modules/commands/command.py b/lib/ansible/modules/commands/command.py index 6c0c56edfd..4081c8c95d 100644 --- a/lib/ansible/modules/commands/command.py +++ b/lib/ansible/modules/commands/command.py @@ -136,13 +136,13 @@ def main(): # hence don't copy this one if you are looking to build others! module = AnsibleModule( argument_spec=dict( - _raw_params = dict(), - _uses_shell = dict(type='bool', default=False), - chdir = dict(type='path'), - executable = dict(), - creates = dict(type='path'), - removes = dict(type='path'), - warn = dict(type='bool', default=True), + _raw_params = dict(), + _uses_shell = dict(type='bool', default=False), + chdir = dict(type='path'), + executable = dict(), + creates = dict(type='path'), + removes = dict(type='path'), + warn = dict(type='bool', default=True), ) ) diff --git a/lib/ansible/modules/database/misc/mongodb_user.py b/lib/ansible/modules/database/misc/mongodb_user.py index a438761e23..afff477ea4 100644 --- a/lib/ansible/modules/database/misc/mongodb_user.py +++ b/lib/ansible/modules/database/misc/mongodb_user.py @@ -285,8 +285,8 @@ def load_mongocnf(): try: config.readfp(open(mongocnf)) creds = dict( - user=config.get('client', 'user'), - password=config.get('client', 'pass') + user=config.get('client', 'user'), + password=config.get('client', 'pass') ) except (ConfigParser.NoOptionError, IOError): return False diff --git a/lib/ansible/modules/database/misc/redis.py b/lib/ansible/modules/database/misc/redis.py index 078a46ea20..e217e71686 100644 --- a/lib/ansible/modules/database/misc/redis.py +++ b/lib/ansible/modules/database/misc/redis.py @@ -218,11 +218,11 @@ def main(): if mode == "slave": # Only need data if we want to be slave if not master_host: module.fail_json( - msg='In slave mode master host must be provided') + msg='In slave mode master host must be provided') if not master_port: module.fail_json( - msg='In slave mode master port must be provided') + msg='In slave mode master port must be provided') #Connect and check r = redis.StrictRedis(host=login_host, @@ -281,7 +281,7 @@ def main(): if mode == "db": if db is None: module.fail_json( - msg="In db mode the db number must be provided") + msg="In db mode the db number must be provided") #Connect and check r = redis.StrictRedis(host=login_host, diff --git a/lib/ansible/modules/database/misc/riak.py b/lib/ansible/modules/database/misc/riak.py index e35e08d925..050d0c3659 100644 --- a/lib/ansible/modules/database/misc/riak.py +++ b/lib/ansible/modules/database/misc/riak.py @@ -131,16 +131,16 @@ def main(): module = AnsibleModule( argument_spec=dict( - command=dict(required=False, default=None, choices=[ - 'ping', 'kv_test', 'join', 'plan', 'commit']), - config_dir=dict(default='/etc/riak', type='path'), - http_conn=dict(required=False, default='127.0.0.1:8098'), - target_node=dict(default='riak@127.0.0.1', required=False), - wait_for_handoffs=dict(default=False, type='int'), - wait_for_ring=dict(default=False, type='int'), - wait_for_service=dict( - required=False, default=None, choices=['kv']), - validate_certs = dict(default='yes', type='bool')) + command=dict(required=False, default=None, choices=[ + 'ping', 'kv_test', 'join', 'plan', 'commit']), + config_dir=dict(default='/etc/riak', type='path'), + http_conn=dict(required=False, default='127.0.0.1:8098'), + target_node=dict(default='riak@127.0.0.1', required=False), + wait_for_handoffs=dict(default=False, type='int'), + wait_for_ring=dict(default=False, type='int'), + wait_for_service=dict( + required=False, default=None, choices=['kv']), + validate_certs = dict(default='yes', type='bool')) ) diff --git a/lib/ansible/modules/database/mysql/mysql_replication.py b/lib/ansible/modules/database/mysql/mysql_replication.py index 837d2b5117..db196648e8 100644 --- a/lib/ansible/modules/database/mysql/mysql_replication.py +++ b/lib/ansible/modules/database/mysql/mysql_replication.py @@ -199,7 +199,7 @@ def changemaster(cursor, chm, chm_params): def main(): module = AnsibleModule( - argument_spec = dict( + argument_spec = dict( login_user=dict(default=None), login_password=dict(default=None, no_log=True), login_host=dict(default="localhost"), diff --git a/lib/ansible/modules/database/mysql/mysql_variables.py b/lib/ansible/modules/database/mysql/mysql_variables.py index 506ff705d5..722bcc6d84 100644 --- a/lib/ansible/modules/database/mysql/mysql_variables.py +++ b/lib/ansible/modules/database/mysql/mysql_variables.py @@ -123,7 +123,7 @@ def setvariable(cursor, mysqlvar, value): def main(): module = AnsibleModule( - argument_spec = dict( + argument_spec = dict( login_user=dict(default=None), login_password=dict(default=None, no_log=True), login_host=dict(default="localhost"), diff --git a/lib/ansible/modules/database/postgresql/postgresql_db.py b/lib/ansible/modules/database/postgresql/postgresql_db.py index 67dcf6eeaf..767a4d136c 100755 --- a/lib/ansible/modules/database/postgresql/postgresql_db.py +++ b/lib/ansible/modules/database/postgresql/postgresql_db.py @@ -309,7 +309,7 @@ def main(): .extensions .ISOLATION_LEVEL_AUTOCOMMIT) cursor = db_connection.cursor( - cursor_factory=psycopg2.extras.DictCursor) + cursor_factory=psycopg2.extras.DictCursor) except TypeError: e = get_exception() diff --git a/lib/ansible/modules/database/postgresql/postgresql_ext.py b/lib/ansible/modules/database/postgresql/postgresql_ext.py index 6ca9b3434e..ac10525171 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_ext.py +++ b/lib/ansible/modules/database/postgresql/postgresql_ext.py @@ -164,7 +164,7 @@ def main(): .extensions .ISOLATION_LEVEL_AUTOCOMMIT) cursor = db_connection.cursor( - cursor_factory=psycopg2.extras.DictCursor) + cursor_factory=psycopg2.extras.DictCursor) except Exception: e = get_exception() module.fail_json(msg="unable to connect to database: %s" % e) diff --git a/lib/ansible/modules/database/postgresql/postgresql_schema.py b/lib/ansible/modules/database/postgresql/postgresql_schema.py index cf321e998a..82b3562c86 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_schema.py +++ b/lib/ansible/modules/database/postgresql/postgresql_schema.py @@ -228,7 +228,7 @@ def main(): .extensions .ISOLATION_LEVEL_AUTOCOMMIT) cursor = db_connection.cursor( - cursor_factory=psycopg2.extras.DictCursor) + cursor_factory=psycopg2.extras.DictCursor) except Exception: e = get_exception() module.fail_json(msg="unable to connect to database: %s" %(text, str(e))) diff --git a/lib/ansible/modules/files/lineinfile.py b/lib/ansible/modules/files/lineinfile.py index fc85ee8cf2..c62effec3e 100644 --- a/lib/ansible/modules/files/lineinfile.py +++ b/lib/ansible/modules/files/lineinfile.py @@ -216,7 +216,7 @@ def write_changes(module, b_lines, dest): if valid: module.atomic_move(tmpfile, to_native(os.path.realpath(to_bytes(dest, errors='surrogate_or_strict')), errors='surrogate_or_strict'), - unsafe_writes=module.params['unsafe_writes']) + unsafe_writes=module.params['unsafe_writes']) def check_file_attrs(module, changed, message, diff): diff --git a/lib/ansible/modules/files/stat.py b/lib/ansible/modules/files/stat.py index 8cccae1d68..3bf849c562 100644 --- a/lib/ansible/modules/files/stat.py +++ b/lib/ansible/modules/files/stat.py @@ -423,7 +423,7 @@ def format_output(module, path, st): ('st_rsize', 'real_size'), ('st_creator', 'creator'), ('st_type', 'file_type'), - ]: + ]: if hasattr(st, other[0]): output[other[1]] = getattr(st, other[0]) diff --git a/lib/ansible/modules/messaging/rabbitmq_binding.py b/lib/ansible/modules/messaging/rabbitmq_binding.py index 446d7d8536..5bf60eff0d 100644 --- a/lib/ansible/modules/messaging/rabbitmq_binding.py +++ b/lib/ansible/modules/messaging/rabbitmq_binding.py @@ -196,14 +196,14 @@ def main(): ) r = requests.post( - url, - auth = (module.params['login_user'],module.params['login_password']), - headers = { "content-type": "application/json"}, - data = json.dumps({ - "routing_key": module.params['routing_key'], - "arguments": module.params['arguments'] + url, + auth = (module.params['login_user'],module.params['login_password']), + headers = { "content-type": "application/json"}, + data = json.dumps({ + "routing_key": module.params['routing_key'], + "arguments": module.params['arguments'] }) - ) + ) elif module.params['state'] == 'absent': r = requests.delete( url, auth = (module.params['login_user'],module.params['login_password'])) diff --git a/lib/ansible/modules/messaging/rabbitmq_exchange.py b/lib/ansible/modules/messaging/rabbitmq_exchange.py index a5e1e353da..bf3545800e 100644 --- a/lib/ansible/modules/messaging/rabbitmq_exchange.py +++ b/lib/ansible/modules/messaging/rabbitmq_exchange.py @@ -189,17 +189,17 @@ def main(): if change_required: if module.params['state'] == 'present': r = requests.put( - url, - auth = (module.params['login_user'],module.params['login_password']), - headers = { "content-type": "application/json"}, - data = json.dumps({ - "durable": module.params['durable'], - "auto_delete": module.params['auto_delete'], - "internal": module.params['internal'], - "type": module.params['exchange_type'], - "arguments": module.params['arguments'] + url, + auth = (module.params['login_user'],module.params['login_password']), + headers = { "content-type": "application/json"}, + data = json.dumps({ + "durable": module.params['durable'], + "auto_delete": module.params['auto_delete'], + "internal": module.params['internal'], + "type": module.params['exchange_type'], + "arguments": module.params['arguments'] }) - ) + ) elif module.params['state'] == 'absent': r = requests.delete( url, auth = (module.params['login_user'],module.params['login_password'])) diff --git a/lib/ansible/modules/messaging/rabbitmq_queue.py b/lib/ansible/modules/messaging/rabbitmq_queue.py index 6b49fea9f0..8cfcefe60a 100644 --- a/lib/ansible/modules/messaging/rabbitmq_queue.py +++ b/lib/ansible/modules/messaging/rabbitmq_queue.py @@ -237,15 +237,15 @@ def main(): if change_required: if module.params['state'] == 'present': r = requests.put( - url, - auth = (module.params['login_user'],module.params['login_password']), - headers = { "content-type": "application/json"}, - data = json.dumps({ - "durable": module.params['durable'], - "auto_delete": module.params['auto_delete'], - "arguments": module.params['arguments'] + url, + auth = (module.params['login_user'],module.params['login_password']), + headers = { "content-type": "application/json"}, + data = json.dumps({ + "durable": module.params['durable'], + "auto_delete": module.params['auto_delete'], + "arguments": module.params['arguments'] }) - ) + ) elif module.params['state'] == 'absent': r = requests.delete( url, auth = (module.params['login_user'],module.params['login_password'])) diff --git a/lib/ansible/modules/monitoring/boundary_meter.py b/lib/ansible/modules/monitoring/boundary_meter.py index 7ec661e769..e4d635fb24 100644 --- a/lib/ansible/modules/monitoring/boundary_meter.py +++ b/lib/ansible/modules/monitoring/boundary_meter.py @@ -248,11 +248,11 @@ def main(): module = AnsibleModule( argument_spec=dict( - state=dict(required=True, choices=['present', 'absent']), - name=dict(required=False), - apikey=dict(required=True), - apiid=dict(required=True), - validate_certs = dict(default='yes', type='bool'), + state=dict(required=True, choices=['present', 'absent']), + name=dict(required=False), + apikey=dict(required=True), + apiid=dict(required=True), + validate_certs = dict(default='yes', type='bool'), ) ) diff --git a/lib/ansible/modules/monitoring/librato_annotation.py b/lib/ansible/modules/monitoring/librato_annotation.py index cadade1ef4..3f3e2e35cc 100644 --- a/lib/ansible/modules/monitoring/librato_annotation.py +++ b/lib/ansible/modules/monitoring/librato_annotation.py @@ -146,16 +146,16 @@ 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') - ) + 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) diff --git a/lib/ansible/modules/monitoring/logicmonitor.py b/lib/ansible/modules/monitoring/logicmonitor.py index ca00652524..96a4c70f22 100644 --- a/lib/ansible/modules/monitoring/logicmonitor.py +++ b/lib/ansible/modules/monitoring/logicmonitor.py @@ -32,8 +32,8 @@ try: # Look for simplejson if that's the case try: if ( - not isinstance(json.loads, types.FunctionType) or - not isinstance(json.dumps, types.FunctionType) + not isinstance(json.loads, types.FunctionType) or + not isinstance(json.dumps, types.FunctionType) ): raise ImportError except AttributeError: diff --git a/lib/ansible/modules/monitoring/logicmonitor_facts.py b/lib/ansible/modules/monitoring/logicmonitor_facts.py index 39521a2b42..ff0954d251 100644 --- a/lib/ansible/modules/monitoring/logicmonitor_facts.py +++ b/lib/ansible/modules/monitoring/logicmonitor_facts.py @@ -29,8 +29,8 @@ try: # Look for simplejson if that's the case try: if ( - not isinstance(json.loads, types.FunctionType) or - not isinstance(json.dumps, types.FunctionType) + not isinstance(json.loads, types.FunctionType) or + not isinstance(json.dumps, types.FunctionType) ): raise ImportError except AttributeError: diff --git a/lib/ansible/modules/monitoring/pagerduty.py b/lib/ansible/modules/monitoring/pagerduty.py index 0331155a7b..3e8dd0eebd 100644 --- a/lib/ansible/modules/monitoring/pagerduty.py +++ b/lib/ansible/modules/monitoring/pagerduty.py @@ -259,17 +259,17 @@ def main(): module = AnsibleModule( argument_spec=dict( - state=dict(required=True, choices=['running', 'started', 'ongoing', 'absent']), - name=dict(required=True), - user=dict(required=False), - passwd=dict(required=False), - token=dict(required=False), - service=dict(required=False, type='list', aliases=["services"]), - requester_id=dict(required=False), - hours=dict(default='1', required=False), - minutes=dict(default='0', required=False), - desc=dict(default='Created by Ansible', required=False), - validate_certs = dict(default='yes', type='bool'), + state=dict(required=True, choices=['running', 'started', 'ongoing', 'absent']), + name=dict(required=True), + user=dict(required=False), + passwd=dict(required=False), + token=dict(required=False), + service=dict(required=False, type='list', aliases=["services"]), + requester_id=dict(required=False), + hours=dict(default='1', required=False), + minutes=dict(default='0', required=False), + desc=dict(default='Created by Ansible', required=False), + validate_certs = dict(default='yes', type='bool'), ) ) diff --git a/lib/ansible/modules/monitoring/pagerduty_alert.py b/lib/ansible/modules/monitoring/pagerduty_alert.py index 48d81c7e7a..189b0ea586 100644 --- a/lib/ansible/modules/monitoring/pagerduty_alert.py +++ b/lib/ansible/modules/monitoring/pagerduty_alert.py @@ -189,10 +189,10 @@ def main(): incident_key = module.params['incident_key'] state_event_dict = { - 'triggered': 'trigger', - 'acknowledged': 'acknowledge', - 'resolved': 'resolve' - } + 'triggered': 'trigger', + 'acknowledged': 'acknowledge', + 'resolved': 'resolve' + } event_type = state_event_dict[state] diff --git a/lib/ansible/modules/monitoring/pingdom.py b/lib/ansible/modules/monitoring/pingdom.py index a4b77def8c..213f548a4d 100644 --- a/lib/ansible/modules/monitoring/pingdom.py +++ b/lib/ansible/modules/monitoring/pingdom.py @@ -125,11 +125,11 @@ def main(): module = AnsibleModule( argument_spec=dict( - state=dict(required=True, choices=['running', 'paused', 'started', 'stopped']), - checkid=dict(required=True), - uid=dict(required=True), - passwd=dict(required=True), - key=dict(required=True) + state=dict(required=True, choices=['running', 'paused', 'started', 'stopped']), + checkid=dict(required=True), + uid=dict(required=True), + passwd=dict(required=True), + key=dict(required=True) ) ) diff --git a/lib/ansible/modules/monitoring/statusio_maintenance.py b/lib/ansible/modules/monitoring/statusio_maintenance.py index 557e3dee89..c468064081 100644 --- a/lib/ansible/modules/monitoring/statusio_maintenance.py +++ b/lib/ansible/modules/monitoring/statusio_maintenance.py @@ -201,7 +201,7 @@ def get_api_auth_headers(api_id, api_key, url, statuspage): try: response = open_url( - url + "/v2/component/list/" + statuspage, headers=headers) + url + "/v2/component/list/" + statuspage, headers=headers) data = json.loads(response.read()) if data['status']['message'] == 'Authentication failed': return 1, None, None, "Authentication failed: " \ @@ -265,7 +265,7 @@ def get_date_time(start_date, start_time, minutes): try: # Work out end date/time based on minutes date_time_start = datetime.datetime.strptime( - start_time + start_date, '%H:%M%m/%d/%Y') + start_time + start_date, '%H:%M%m/%d/%Y') delta = date_time_start + datetime.timedelta(minutes=minutes) returned_date.append(delta.strftime("%m/%d/%Y")) returned_date.append(delta.strftime("%H:%M")) @@ -296,25 +296,25 @@ def create_maintenance(auth_headers, url, statuspage, host_ids, container_id.append(val['container_id']) try: values = json.dumps({ - "statuspage_id": statuspage, - "components": component_id, - "containers": container_id, - "all_infrastructure_affected": str(int(all_infrastructure_affected)), - "automation": str(int(automation)), - "maintenance_name": title, - "maintenance_details": desc, - "date_planned_start": returned_dates[0], - "time_planned_start": returned_dates[1], - "date_planned_end": returned_dates[2], - "time_planned_end": returned_dates[3], - "maintenance_notify_now": str(int(maintenance_notify_now)), - "maintenance_notify_72_hr": str(int(maintenance_notify_72_hr)), - "maintenance_notify_24_hr": str(int(maintenance_notify_24_hr)), - "maintenance_notify_1_hr": str(int(maintenance_notify_1_hr)) - }) + "statuspage_id": statuspage, + "components": component_id, + "containers": container_id, + "all_infrastructure_affected": str(int(all_infrastructure_affected)), + "automation": str(int(automation)), + "maintenance_name": title, + "maintenance_details": desc, + "date_planned_start": returned_dates[0], + "time_planned_start": returned_dates[1], + "date_planned_end": returned_dates[2], + "time_planned_end": returned_dates[3], + "maintenance_notify_now": str(int(maintenance_notify_now)), + "maintenance_notify_72_hr": str(int(maintenance_notify_72_hr)), + "maintenance_notify_24_hr": str(int(maintenance_notify_24_hr)), + "maintenance_notify_1_hr": str(int(maintenance_notify_1_hr)) + }) response = open_url( - url + "/v2/maintenance/schedule", data=values, - headers=auth_headers) + url + "/v2/maintenance/schedule", data=values, + headers=auth_headers) data = json.loads(response.read()) if data["status"]["error"] == "yes": @@ -332,9 +332,9 @@ def delete_maintenance(auth_headers, url, statuspage, maintenance_id): "maintenance_id": maintenance_id, }) response = open_url( - url=url + "/v2/maintenance/delete", - data=values, - headers=auth_headers) + url=url + "/v2/maintenance/delete", + data=values, + headers=auth_headers) data = json.loads(response.read()) if data["status"]["error"] == "yes": return 1, None, "Invalid maintenance_id" @@ -411,7 +411,7 @@ def main(): if minutes or start_time and start_date: (rc, returned_date, error) = get_date_time( - start_date, start_time, minutes) + start_date, start_time, minutes) if rc != 0: module.fail_json(msg="Failed to set date/time: %s" % error) @@ -438,11 +438,11 @@ def main(): module.exit_json(changed=True) else: (rc, _, error) = create_maintenance( - auth_headers, url, statuspage, host_ids, - all_infrastructure_affected, automation, - title, desc, returned_date, maintenance_notify_now, - maintenance_notify_72_hr, maintenance_notify_24_hr, - maintenance_notify_1_hr) + auth_headers, url, statuspage, host_ids, + all_infrastructure_affected, automation, + title, desc, returned_date, maintenance_notify_now, + maintenance_notify_72_hr, maintenance_notify_24_hr, + maintenance_notify_1_hr) if rc == 0: module.exit_json(changed=True, result="Successfully created " "maintenance") @@ -464,15 +464,15 @@ def main(): module.exit_json(changed=True) else: (rc, _, error) = delete_maintenance( - auth_headers, url, statuspage, maintenance_id) + auth_headers, url, statuspage, maintenance_id) if rc == 0: module.exit_json( - changed=True, - result="Successfully deleted maintenance" + changed=True, + result="Successfully deleted maintenance" ) else: module.fail_json( - msg="Failed to delete maintenance: %s" % error) + msg="Failed to delete maintenance: %s" % error) from ansible.module_utils.basic import * from ansible.module_utils.urls import * diff --git a/lib/ansible/modules/network/cloudflare_dns.py b/lib/ansible/modules/network/cloudflare_dns.py index 14b142c1a1..87cc854cdd 100644 --- a/lib/ansible/modules/network/cloudflare_dns.py +++ b/lib/ansible/modules/network/cloudflare_dns.py @@ -628,16 +628,16 @@ def main(): ), supports_check_mode = True, required_if = ([ - ('state','present',['record','type']), - ('type','MX',['priority','value']), - ('type','SRV',['port','priority','proto','service','value','weight']), - ('type','A',['value']), - ('type','AAAA',['value']), - ('type','CNAME',['value']), - ('type','TXT',['value']), - ('type','NS',['value']), - ('type','SPF',['value']) - ] + ('state','present',['record','type']), + ('type','MX',['priority','value']), + ('type','SRV',['port','priority','proto','service','value','weight']), + ('type','A',['value']), + ('type','AAAA',['value']), + ('type','CNAME',['value']), + ('type','TXT',['value']), + ('type','NS',['value']), + ('type','SPF',['value']) + ] ), required_one_of = ( [['record','value','type']] diff --git a/lib/ansible/modules/network/nxos/nxos_aaa_server.py b/lib/ansible/modules/network/nxos/nxos_aaa_server.py index 964854d073..f106ba42c9 100644 --- a/lib/ansible/modules/network/nxos/nxos_aaa_server.py +++ b/lib/ansible/modules/network/nxos/nxos_aaa_server.py @@ -391,7 +391,7 @@ def get_aaa_server_info(server_type, module): aaa_regex = '.*{0}-server\skey\s\d\s+(?P\S+).*'.format(server_type) server_body = execute_show_command( - server_command, module, command_type='cli_show_ascii')[0] + server_command, module, command_type='cli_show_ascii')[0] split_server = server_body.splitlines() @@ -403,11 +403,11 @@ def get_aaa_server_info(server_type, module): aaa_server_info['deadtime'] = line.split(':')[1] request_body = execute_show_command( - request_command, module, command_type='cli_show_ascii')[0] + request_command, module, command_type='cli_show_ascii')[0] aaa_server_info['directed_request'] = request_body.replace('\n', '') key_body = execute_show_command( - global_key_command, module, command_type='cli_show_ascii')[0] + global_key_command, module, command_type='cli_show_ascii')[0] try: match_global_key = re.match(aaa_regex, key_body, re.DOTALL) @@ -480,15 +480,15 @@ def default_aaa_server(existing, params, server_type): def main(): argument_spec = dict( - server_type=dict(type='str', + server_type=dict(type='str', choices=['radius', 'tacacs'], required=True), - global_key=dict(type='str'), - encrypt_type=dict(type='str', choices=['0', '7']), - deadtime=dict(type='str'), - server_timeout=dict(type='str'), - directed_request=dict(type='str', + global_key=dict(type='str'), + encrypt_type=dict(type='str', choices=['0', '7']), + deadtime=dict(type='str'), + server_timeout=dict(type='str'), + directed_request=dict(type='str', choices=['enabled', 'disabled', 'default']), - state=dict(choices=['default', 'present'], default='present'), + state=dict(choices=['default', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -522,7 +522,7 @@ def main(): raise ValueError except ValueError: module.fail_json( - msg='deadtime must be an integer between 0 and 1440') + msg='deadtime must be an integer between 0 and 1440') if server_timeout: try: @@ -533,7 +533,7 @@ def main(): msg='server_timeout must be an integer between 1 and 60') delta = dict(set(proposed.items()).difference( - existing.items())) + existing.items())) if delta: command = config_aaa_server(delta, server_type) if command: diff --git a/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py b/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py index dafd197018..1faf21ce23 100644 --- a/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py +++ b/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py @@ -485,15 +485,15 @@ def config_aaa_host(server_type, address, params, clear=False): def main(): argument_spec = dict( - server_type=dict(choices=['radius', 'tacacs'], required=True), - address=dict(type='str', required=True), - key=dict(type='str'), - encrypt_type=dict(type='str', choices=['0', '7']), - host_timeout=dict(type='str'), - auth_port=dict(type='str'), - acct_port=dict(type='str'), - tacacs_port=dict(type='str'), - state=dict(choices=['absent', 'present'], default='present'), + server_type=dict(choices=['radius', 'tacacs'], required=True), + address=dict(type='str', required=True), + key=dict(type='str'), + encrypt_type=dict(type='str', choices=['0', '7']), + host_timeout=dict(type='str'), + auth_port=dict(type='str'), + acct_port=dict(type='str'), + tacacs_port=dict(type='str'), + state=dict(choices=['absent', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -543,7 +543,7 @@ def main(): msg='host_timeout must be an integer between 1 and 60') delta = dict( - set(proposed.items()).difference(existing.items())) + set(proposed.items()).difference(existing.items())) if delta: union = existing.copy() union.update(delta) @@ -553,10 +553,10 @@ def main(): elif state == 'absent': intersect = dict( - set(proposed.items()).intersection(existing.items())) + set(proposed.items()).intersection(existing.items())) if intersect.get('address') and intersect.get('server_type'): command = 'no {0}-server host {1}'.format( - intersect.get('server_type'), intersect.get('address')) + intersect.get('server_type'), intersect.get('address')) commands.append(command) cmds = flatten_list(commands) diff --git a/lib/ansible/modules/network/nxos/nxos_acl.py b/lib/ansible/modules/network/nxos/nxos_acl.py index a27b8e43ec..bdf00b1a31 100644 --- a/lib/ansible/modules/network/nxos/nxos_acl.py +++ b/lib/ansible/modules/network/nxos/nxos_acl.py @@ -641,49 +641,49 @@ def execute_config_command(commands, module): def main(): argument_spec = dict( - seq=dict(required=False, type='str'), - name=dict(required=True, type='str'), - action=dict(required=False, choices=['remark', 'permit', 'deny']), - remark=dict(required=False, type='str'), - proto=dict(required=False, type='str'), - src=dict(required=False, type='str'), - src_port_op=dict(required=False), - src_port1=dict(required=False, type='str'), - src_port2=dict(required=False, type='str'), - dest=dict(required=False, type='str'), - dest_port_op=dict(required=False), - dest_port1=dict(required=False, type='str'), - dest_port2=dict(required=False, type='str'), - log=dict(required=False, choices=['enable']), - urg=dict(required=False, choices=['enable']), - ack=dict(required=False, choices=['enable']), - psh=dict(required=False, choices=['enable']), - rst=dict(required=False, choices=['enable']), - syn=dict(required=False, choices=['enable']), - fragments=dict(required=False, choices=['enable']), - fin=dict(required=False, choices=['enable']), - established=dict(required=False, choices=['enable']), - time_range=dict(required=False), - precedence=dict(required=False, choices=['critical', 'flash', + seq=dict(required=False, type='str'), + name=dict(required=True, type='str'), + action=dict(required=False, choices=['remark', 'permit', 'deny']), + remark=dict(required=False, type='str'), + proto=dict(required=False, type='str'), + src=dict(required=False, type='str'), + src_port_op=dict(required=False), + src_port1=dict(required=False, type='str'), + src_port2=dict(required=False, type='str'), + dest=dict(required=False, type='str'), + dest_port_op=dict(required=False), + dest_port1=dict(required=False, type='str'), + dest_port2=dict(required=False, type='str'), + log=dict(required=False, choices=['enable']), + urg=dict(required=False, choices=['enable']), + ack=dict(required=False, choices=['enable']), + psh=dict(required=False, choices=['enable']), + rst=dict(required=False, choices=['enable']), + syn=dict(required=False, choices=['enable']), + fragments=dict(required=False, choices=['enable']), + fin=dict(required=False, choices=['enable']), + established=dict(required=False, choices=['enable']), + time_range=dict(required=False), + precedence=dict(required=False, choices=['critical', 'flash', 'flash-override', 'immediate', 'internet', 'network', 'priority', 'routine']), - dscp=dict(required=False, choices=['af11', 'af12', 'af13', 'af21', + dscp=dict(required=False, choices=['af11', 'af12', 'af13', 'af21', 'af22', 'af23', 'af31', 'af32', 'af33', 'af41', 'af42', 'af43', 'cs1', 'cs2', 'cs3', 'cs4', 'cs5', 'cs6', 'cs7', 'default', 'ef']), - state=dict(choices=['absent', 'present', 'delete_acl'], + state=dict(choices=['absent', 'present', 'delete_acl'], default='present'), - protocol=dict(choices=['http', 'https'], default='http'), - host=dict(required=True), - username=dict(type='str'), - password=dict(no_log=True, type='str'), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + protocol=dict(choices=['http', 'https'], default='http'), + host=dict(required=True), + username=dict(type='str'), + password=dict(no_log=True, type='str'), + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_acl_interface.py b/lib/ansible/modules/network/nxos/nxos_acl_interface.py index e9dbcb3fe0..8dd74922b3 100644 --- a/lib/ansible/modules/network/nxos/nxos_acl_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_acl_interface.py @@ -466,14 +466,14 @@ def execute_config_command(commands, module): def main(): argument_spec = dict( - name=dict(required=False, type='str'), - interface=dict(required=True), - direction=dict(required=True, choices=['egress', 'ingress']), - state=dict(choices=['absent', 'present'], + name=dict(required=False, type='str'), + interface=dict(required=True), + direction=dict(required=True, choices=['egress', 'ingress']), + state=dict(choices=['absent', 'present'], default='present'), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_bgp.py b/lib/ansible/modules/network/nxos/nxos_bgp.py index a1d99ba102..e30c80645b 100644 --- a/lib/ansible/modules/network/nxos/nxos_bgp.py +++ b/lib/ansible/modules/network/nxos/nxos_bgp.py @@ -787,8 +787,8 @@ def state_present(module, existing, proposed, candidate): commands.append('{0} {1}'.format(key, peer_string)) elif key.startswith('timers bgp'): command = 'timers bgp {0} {1}'.format( - proposed['timer_bgp_keepalive'], - proposed['timer_bgp_hold']) + proposed['timer_bgp_keepalive'], + proposed['timer_bgp_hold']) if command not in commands: commands.append(command) else: @@ -857,50 +857,50 @@ def fix_commands(commands): def main(): argument_spec = dict( - asn=dict(required=True, type='str'), - vrf=dict(required=False, type='str', default='default'), - bestpath_always_compare_med=dict(required=False, type='bool'), - bestpath_aspath_multipath_relax=dict(required=False, type='bool'), - bestpath_compare_neighborid=dict(required=False, type='bool'), - bestpath_compare_routerid=dict(required=False, type='bool'), - bestpath_cost_community_ignore=dict(required=False, type='bool'), - bestpath_med_confed=dict(required=False, type='bool'), - bestpath_med_missing_as_worst=dict(required=False, type='bool'), - bestpath_med_non_deterministic=dict(required=False, type='bool'), - cluster_id=dict(required=False, type='str'), - confederation_id=dict(required=False, type='str'), - confederation_peers=dict(required=False, type='str'), - disable_policy_batching=dict(required=False, type='bool'), - disable_policy_batching_ipv4_prefix_list=dict(required=False, type='str'), - disable_policy_batching_ipv6_prefix_list=dict(required=False, type='str'), - enforce_first_as=dict(required=False, type='bool'), - event_history_cli=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), - event_history_detail=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), - event_history_events=dict(required=False, choices=['true', 'false', 'default' 'size_small', 'size_medium', 'size_large', 'size_disable']), - event_history_periodic=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), - fast_external_fallover=dict(required=False, type='bool'), - flush_routes=dict(required=False, type='bool'), - graceful_restart=dict(required=False, type='bool'), - graceful_restart_helper=dict(required=False, type='bool'), - graceful_restart_timers_restart=dict(required=False, type='str'), - graceful_restart_timers_stalepath_time=dict(required=False, type='str'), - isolate=dict(required=False, type='bool'), - local_as=dict(required=False, type='str'), - log_neighbor_changes=dict(required=False, type='bool'), - maxas_limit=dict(required=False, type='str'), - neighbor_down_fib_accelerate=dict(required=False, type='bool'), - reconnect_interval=dict(required=False, type='str'), - router_id=dict(required=False, type='str'), - shutdown=dict(required=False, type='bool'), - suppress_fib_pending=dict(required=False, type='bool'), - timer_bestpath_limit=dict(required=False, type='str'), - timer_bgp_hold=dict(required=False, type='str'), - timer_bgp_keepalive=dict(required=False, type='str'), - state=dict(choices=['present', 'absent'], default='present', + asn=dict(required=True, type='str'), + vrf=dict(required=False, type='str', default='default'), + bestpath_always_compare_med=dict(required=False, type='bool'), + bestpath_aspath_multipath_relax=dict(required=False, type='bool'), + bestpath_compare_neighborid=dict(required=False, type='bool'), + bestpath_compare_routerid=dict(required=False, type='bool'), + bestpath_cost_community_ignore=dict(required=False, type='bool'), + bestpath_med_confed=dict(required=False, type='bool'), + bestpath_med_missing_as_worst=dict(required=False, type='bool'), + bestpath_med_non_deterministic=dict(required=False, type='bool'), + cluster_id=dict(required=False, type='str'), + confederation_id=dict(required=False, type='str'), + confederation_peers=dict(required=False, type='str'), + disable_policy_batching=dict(required=False, type='bool'), + disable_policy_batching_ipv4_prefix_list=dict(required=False, type='str'), + disable_policy_batching_ipv6_prefix_list=dict(required=False, type='str'), + enforce_first_as=dict(required=False, type='bool'), + event_history_cli=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), + event_history_detail=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), + event_history_events=dict(required=False, choices=['true', 'false', 'default' 'size_small', 'size_medium', 'size_large', 'size_disable']), + event_history_periodic=dict(required=False, choices=['true', 'false', 'default', 'size_small', 'size_medium', 'size_large', 'size_disable']), + fast_external_fallover=dict(required=False, type='bool'), + flush_routes=dict(required=False, type='bool'), + graceful_restart=dict(required=False, type='bool'), + graceful_restart_helper=dict(required=False, type='bool'), + graceful_restart_timers_restart=dict(required=False, type='str'), + graceful_restart_timers_stalepath_time=dict(required=False, type='str'), + isolate=dict(required=False, type='bool'), + local_as=dict(required=False, type='str'), + log_neighbor_changes=dict(required=False, type='bool'), + maxas_limit=dict(required=False, type='str'), + neighbor_down_fib_accelerate=dict(required=False, type='bool'), + reconnect_interval=dict(required=False, type='str'), + router_id=dict(required=False, type='str'), + shutdown=dict(required=False, type='bool'), + suppress_fib_pending=dict(required=False, type='bool'), + timer_bestpath_limit=dict(required=False, type='str'), + timer_bgp_hold=dict(required=False, type='str'), + timer_bgp_keepalive=dict(required=False, type='str'), + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, required_together=[['timer_bgp_hold', @@ -909,46 +909,46 @@ def main(): state = module.params['state'] args = [ - "asn", - "bestpath_always_compare_med", - "bestpath_aspath_multipath_relax", - "bestpath_compare_neighborid", - "bestpath_compare_routerid", - "bestpath_cost_community_ignore", - "bestpath_med_confed", - "bestpath_med_missing_as_worst", - "bestpath_med_non_deterministic", - "cluster_id", - "confederation_id", - "confederation_peers", - "disable_policy_batching", - "disable_policy_batching_ipv4_prefix_list", - "disable_policy_batching_ipv6_prefix_list", - "enforce_first_as", - "event_history_cli", - "event_history_detail", - "event_history_events", - "event_history_periodic", - "fast_external_fallover", - "flush_routes", - "graceful_restart", - "graceful_restart_helper", - "graceful_restart_timers_restart", - "graceful_restart_timers_stalepath_time", - "isolate", - "local_as", - "log_neighbor_changes", - "maxas_limit", - "neighbor_down_fib_accelerate", - "reconnect_interval", - "router_id", - "shutdown", - "suppress_fib_pending", - "timer_bestpath_limit", - "timer_bgp_hold", - "timer_bgp_keepalive", - "vrf" - ] + "asn", + "bestpath_always_compare_med", + "bestpath_aspath_multipath_relax", + "bestpath_compare_neighborid", + "bestpath_compare_routerid", + "bestpath_cost_community_ignore", + "bestpath_med_confed", + "bestpath_med_missing_as_worst", + "bestpath_med_non_deterministic", + "cluster_id", + "confederation_id", + "confederation_peers", + "disable_policy_batching", + "disable_policy_batching_ipv4_prefix_list", + "disable_policy_batching_ipv6_prefix_list", + "enforce_first_as", + "event_history_cli", + "event_history_detail", + "event_history_events", + "event_history_periodic", + "fast_external_fallover", + "flush_routes", + "graceful_restart", + "graceful_restart_helper", + "graceful_restart_timers_restart", + "graceful_restart_timers_stalepath_time", + "isolate", + "local_as", + "log_neighbor_changes", + "maxas_limit", + "neighbor_down_fib_accelerate", + "reconnect_interval", + "router_id", + "shutdown", + "suppress_fib_pending", + "timer_bestpath_limit", + "timer_bgp_hold", + "timer_bgp_keepalive", + "vrf" + ] if module.params['vrf'] != 'default': for param, inserted_value in module.params.items(): diff --git a/lib/ansible/modules/network/nxos/nxos_bgp_af.py b/lib/ansible/modules/network/nxos/nxos_bgp_af.py index a8ca2cd993..36fa5f3721 100644 --- a/lib/ansible/modules/network/nxos/nxos_bgp_af.py +++ b/lib/ansible/modules/network/nxos/nxos_bgp_af.py @@ -506,11 +506,11 @@ PARAM_TO_COMMAND_KEYMAP = { 'vrf': 'vrf' } DAMPENING_PARAMS = [ - 'dampening_half_time', - 'dampening_suppress_time', - 'dampening_reuse_time', - 'dampening_max_suppress_time' - ] + 'dampening_half_time', + 'dampening_suppress_time', + 'dampening_reuse_time', + 'dampening_max_suppress_time' + ] def invoke(name, *args, **kwargs): @@ -543,11 +543,11 @@ def get_custom_list_value(config, arg, module): copy_attributes = False inject_map_command = ('inject-map {0} exist-map {1} ' 'copy-attributes'.format( - inject_group['inject_map'], - inject_group['exist_map'])) + inject_group['inject_map'], + inject_group['exist_map'])) REGEX = re.compile(r'\s+{0}\s*$'.format( - inject_map_command), re.M) + inject_map_command), re.M) try: if REGEX.search(config): copy_attributes = True @@ -574,7 +574,7 @@ def get_custom_list_value(config, arg, module): elif arg == 'redistribute': RED_REGEX = re.compile(r'(?:{0}\s)(?P.*)$'.format( - PARAM_TO_COMMAND_KEYMAP[arg]), re.M) + PARAM_TO_COMMAND_KEYMAP[arg]), re.M) for line in splitted_config: value = [] redistribute_group = {} @@ -585,7 +585,7 @@ def get_custom_list_value(config, arg, module): value.pop(1) elif len(value) == 4: value = ['{0} {1}'.format( - value[0], value[1]), value[3]] + value[0], value[1]), value[3]] value_list.append(value) return value_list @@ -611,7 +611,7 @@ def get_custom_string_value(config, arg, module): elif arg.startswith('dampening'): REGEX = re.compile(r'(?:{0}\s)(?P.*)$'.format( - PARAM_TO_COMMAND_KEYMAP[arg]), re.M) + PARAM_TO_COMMAND_KEYMAP[arg]), re.M) if arg == 'dampen_igp_metric' or arg == 'dampening_routemap': value = '' if PARAM_TO_COMMAND_KEYMAP[arg] in config: @@ -774,10 +774,10 @@ def default_existing(existing_value, key, value): for network in existing_value: if len(network) == 2: commands.append('no network {0} route-map {1}'.format( - network[0], network[1])) + network[0], network[1])) elif len(network) == 1: commands.append('no network {0}'.format( - network[0])) + network[0])) elif key == 'inject-map': for maps in existing_value: @@ -787,7 +787,7 @@ def default_existing(existing_value, key, value): elif len(maps) == 3: commands.append('no inject-map {0} exist-map {1} ' 'copy-attributes'.format( - maps[0], maps[1])) + maps[0], maps[1])) else: commands.append('no {0} {1}'.format(key, existing_value)) return commands @@ -818,7 +818,7 @@ def get_inject_map_command(existing, key, value): if maps not in existing_maps: if len(maps) == 2: command = ('inject-map {0} exist-map {1}'.format( - maps[0], maps[1])) + maps[0], maps[1])) elif len(maps) == 3: command = ('inject-map {0} exist-map {1} ' 'copy-attributes'.format(maps[0], @@ -835,7 +835,7 @@ def get_redistribute_command(existing, key, value): for each_rule in existing_rule: if rule[0] in each_rule: command = 'no {0} {1} route-map {2}'.format( - key, each_rule[0], each_rule[1]) + key, each_rule[0], each_rule[1]) commands.append(command) else: command = '{0} {1} route-map {2}'.format(key, rule[0], rule[1]) @@ -877,7 +877,7 @@ def state_present(module, existing, proposed, candidate): for key, value in proposed_commands.items(): if key == 'address-family': addr_family_command = "address-family {0} {1}".format( - module.params['afi'], module.params['safi']) + module.params['afi'], module.params['safi']) if addr_family_command not in commands: commands.append(addr_family_command) @@ -949,48 +949,48 @@ def state_absent(module, existing, proposed, candidate): parents.append('vrf {0}'.format(module.params['vrf'])) commands.append('no address-family {0} {1}'.format( - module.params['afi'], module.params['safi'])) + module.params['afi'], module.params['safi'])) candidate.add(commands, parents=parents) def main(): argument_spec = dict( - asn=dict(required=True, type='str'), - vrf=dict(required=False, type='str', default='default'), - safi=dict(required=True, type='str', choices=['unicast','multicast', 'evpn']), - afi=dict(required=True, type='str', choices=['ipv4','ipv6', 'vpnv4', 'vpnv6', 'l2vpn']), - additional_paths_install=dict(required=False, type='bool'), - additional_paths_receive=dict(required=False, type='bool'), - additional_paths_selection=dict(required=False, type='str'), - additional_paths_send=dict(required=False, type='bool'), - advertise_l2vpn_evpn=dict(required=False, type='bool'), - client_to_client=dict(required=False, type='bool'), - dampen_igp_metric=dict(required=False, type='str'), - dampening_state=dict(required=False, type='bool'), - dampening_half_time=dict(required=False, type='str'), - dampening_max_suppress_time=dict(required=False, type='str'), - dampening_reuse_time=dict(required=False, type='str'), - dampening_routemap=dict(required=False, type='str'), - dampening_suppress_time=dict(required=False, type='str'), - default_information_originate=dict(required=False, type='bool'), - default_metric=dict(required=False, type='str'), - distance_ebgp=dict(required=False, type='str'), - distance_ibgp=dict(required=False, type='str'), - distance_local=dict(required=False, type='str'), - inject_map=dict(required=False, type='list'), - maximum_paths=dict(required=False, type='str'), - maximum_paths_ibgp=dict(required=False, type='str'), - networks=dict(required=False, type='list'), - next_hop_route_map=dict(required=False, type='str'), - redistribute=dict(required=False, type='list'), - suppress_inactive=dict(required=False, type='bool'), - table_map=dict(required=False, type='str'), - table_map_filter=dict(required=False, type='bool'), - state=dict(choices=['present', 'absent'], default='present', + asn=dict(required=True, type='str'), + vrf=dict(required=False, type='str', default='default'), + safi=dict(required=True, type='str', choices=['unicast','multicast', 'evpn']), + afi=dict(required=True, type='str', choices=['ipv4','ipv6', 'vpnv4', 'vpnv6', 'l2vpn']), + additional_paths_install=dict(required=False, type='bool'), + additional_paths_receive=dict(required=False, type='bool'), + additional_paths_selection=dict(required=False, type='str'), + additional_paths_send=dict(required=False, type='bool'), + advertise_l2vpn_evpn=dict(required=False, type='bool'), + client_to_client=dict(required=False, type='bool'), + dampen_igp_metric=dict(required=False, type='str'), + dampening_state=dict(required=False, type='bool'), + dampening_half_time=dict(required=False, type='str'), + dampening_max_suppress_time=dict(required=False, type='str'), + dampening_reuse_time=dict(required=False, type='str'), + dampening_routemap=dict(required=False, type='str'), + dampening_suppress_time=dict(required=False, type='str'), + default_information_originate=dict(required=False, type='bool'), + default_metric=dict(required=False, type='str'), + distance_ebgp=dict(required=False, type='str'), + distance_ibgp=dict(required=False, type='str'), + distance_local=dict(required=False, type='str'), + inject_map=dict(required=False, type='list'), + maximum_paths=dict(required=False, type='str'), + maximum_paths_ibgp=dict(required=False, type='str'), + networks=dict(required=False, type='list'), + next_hop_route_map=dict(required=False, type='str'), + redistribute=dict(required=False, type='list'), + suppress_inactive=dict(required=False, type='bool'), + table_map=dict(required=False, type='str'), + table_map_filter=dict(required=False, type='bool'), + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, required_together=[DAMPENING_PARAMS, @@ -1017,38 +1017,38 @@ def main(): ' table_map_filter filter.') args = [ - "additional_paths_install", - "additional_paths_receive", - "additional_paths_selection", - "additional_paths_send", - "advertise_l2vpn_evpn", - "afi", - "asn", - "client_to_client", - "dampen_igp_metric", - "dampening_half_time", - "dampening_max_suppress_time", - "dampening_reuse_time", - "dampening_suppress_time", - "dampening_routemap", - "dampening_state", - "default_information_originate", - "default_metric", - "distance_ebgp", - "distance_ibgp", - "distance_local", - "inject_map", - "maximum_paths", - "maximum_paths_ibgp", - "networks", - "next_hop_route_map", - "redistribute", - "safi", - "suppress_inactive", - "table_map", - "table_map_filter", - "vrf" - ] + "additional_paths_install", + "additional_paths_receive", + "additional_paths_selection", + "additional_paths_send", + "advertise_l2vpn_evpn", + "afi", + "asn", + "client_to_client", + "dampen_igp_metric", + "dampening_half_time", + "dampening_max_suppress_time", + "dampening_reuse_time", + "dampening_suppress_time", + "dampening_routemap", + "dampening_state", + "default_information_originate", + "default_metric", + "distance_ebgp", + "distance_ibgp", + "distance_local", + "inject_map", + "maximum_paths", + "maximum_paths_ibgp", + "networks", + "next_hop_route_map", + "redistribute", + "safi", + "suppress_inactive", + "table_map", + "table_map_filter", + "vrf" + ] existing = invoke('get_existing', module, args) diff --git a/lib/ansible/modules/network/nxos/nxos_bgp_neighbor.py b/lib/ansible/modules/network/nxos/nxos_bgp_neighbor.py index f22fd6ccff..cffc80db13 100644 --- a/lib/ansible/modules/network/nxos/nxos_bgp_neighbor.py +++ b/lib/ansible/modules/network/nxos/nxos_bgp_neighbor.py @@ -653,34 +653,34 @@ def state_absent(module, existing, proposed, candidate): def main(): argument_spec = dict( - asn=dict(required=True, type='str'), - vrf=dict(required=False, type='str', default='default'), - neighbor=dict(required=True, type='str'), - description=dict(required=False, type='str'), - capability_negotiation=dict(required=False, type='bool'), - connected_check=dict(required=False, type='bool'), - dynamic_capability=dict(required=False, type='bool'), - ebgp_multihop=dict(required=False, type='str'), - local_as=dict(required=False, type='str'), - log_neighbor_changes=dict(required=False, type='str', choices=['enable', 'disable', 'inherit']), - low_memory_exempt=dict(required=False, type='bool'), - maximum_peers=dict(required=False, type='str'), - pwd=dict(required=False, type='str'), - pwd_type=dict(required=False, type='str', choices=['cleartext', '3des', 'cisco_type_7', 'default']), - remote_as=dict(required=False, type='str'), - remove_private_as=dict(required=False, type='str', choices=['enable', 'disable', 'all', 'replace-as']), - shutdown=dict(required=False, type='str'), - suppress_4_byte_as=dict(required=False, type='bool'), - timers_keepalive=dict(required=False, type='str'), - timers_holdtime=dict(required=False, type='str'), - transport_passive_only=dict(required=False, type='bool'), - update_source=dict(required=False, type='str'), - m_facts=dict(required=False, default=False, type='bool'), - state=dict(choices=['present', 'absent'], default='present', + asn=dict(required=True, type='str'), + vrf=dict(required=False, type='str', default='default'), + neighbor=dict(required=True, type='str'), + description=dict(required=False, type='str'), + capability_negotiation=dict(required=False, type='bool'), + connected_check=dict(required=False, type='bool'), + dynamic_capability=dict(required=False, type='bool'), + ebgp_multihop=dict(required=False, type='str'), + local_as=dict(required=False, type='str'), + log_neighbor_changes=dict(required=False, type='str', choices=['enable', 'disable', 'inherit']), + low_memory_exempt=dict(required=False, type='bool'), + maximum_peers=dict(required=False, type='str'), + pwd=dict(required=False, type='str'), + pwd_type=dict(required=False, type='str', choices=['cleartext', '3des', 'cisco_type_7', 'default']), + remote_as=dict(required=False, type='str'), + remove_private_as=dict(required=False, type='str', choices=['enable', 'disable', 'all', 'replace-as']), + shutdown=dict(required=False, type='str'), + suppress_4_byte_as=dict(required=False, type='bool'), + timers_keepalive=dict(required=False, type='str'), + timers_holdtime=dict(required=False, type='str'), + transport_passive_only=dict(required=False, type='bool'), + update_source=dict(required=False, type='str'), + m_facts=dict(required=False, default=False, type='bool'), + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, required_together=[['timer_bgp_hold', @@ -692,29 +692,29 @@ def main(): module.params['pwd_type'] = '0' args = [ - 'asn', - 'capability_negotiation', - 'connected_check', - 'description', - 'dynamic_capability', - 'ebgp_multihop', - 'local_as', - 'log_neighbor_changes', - 'low_memory_exempt', - 'maximum_peers', - 'neighbor', - 'pwd', - 'pwd_type', - 'remote_as', - 'remove_private_as', - 'shutdown', - 'suppress_4_byte_as', - 'timers_keepalive', - 'timers_holdtime', - 'transport_passive_only', - 'update_source', - 'vrf' - ] + 'asn', + 'capability_negotiation', + 'connected_check', + 'description', + 'dynamic_capability', + 'ebgp_multihop', + 'local_as', + 'log_neighbor_changes', + 'low_memory_exempt', + 'maximum_peers', + 'neighbor', + 'pwd', + 'pwd_type', + 'remote_as', + 'remove_private_as', + 'shutdown', + 'suppress_4_byte_as', + 'timers_keepalive', + 'timers_holdtime', + 'transport_passive_only', + 'update_source', + 'vrf' + ] existing = invoke('get_existing', module, args) if existing.get('asn'): diff --git a/lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py b/lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py index faca1b1532..a93796ecc8 100644 --- a/lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py +++ b/lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py @@ -684,7 +684,7 @@ def get_existing(module, args): parents.append('neighbor {0}'.format(module.params['neighbor'])) parents.append('address-family {0} {1}'.format( - module.params['afi'], module.params['safi'])) + module.params['afi'], module.params['safi'])) config = netcfg.get_section(parents) if config: @@ -722,7 +722,7 @@ def apply_key_map(key_map, table): def get_address_family_command(key, value, module): command = "address-family {0} {1}".format( - module.params['afi'], module.params['safi']) + module.params['afi'], module.params['safi']) return command @@ -746,13 +746,13 @@ def get_capability_additional_paths_send_command(key, value, module): def get_advertise_map_exist_command(key, value, module): command = 'advertise-map {0} exist-map {1}'.format( - value[0], value[1]) + value[0], value[1]) return command def get_advertise_map_non_exist_command(key, value, module): command = 'advertise-map {0} non-exist-map {1}'.format( - value[0], value[1]) + value[0], value[1]) return command @@ -846,7 +846,7 @@ def get_default_command(key, value, existing_commands): command = 'no route-map {0} out'.format(existing_value) elif key.startswith('maximum-prefix'): command = 'no maximum-prefix {0}'.format( - existing_commands.get('maximum-prefix')) + existing_commands.get('maximum-prefix')) elif key == 'allowas-in max': command = ['no allowas-in {0}'.format(existing_value)] command.append('allowas-in') @@ -936,11 +936,11 @@ def state_present(module, existing, proposed, candidate): candidate.add(commands, parents=parents) elif len(commands) > 1: af_command = 'address-family {0} {1}'.format( - module.params['afi'], module.params['safi']) + module.params['afi'], module.params['safi']) if af_command in commands: commands.remove(af_command) parents.append('address-family {0} {1}'.format( - module.params['afi'], module.params['safi'])) + module.params['afi'], module.params['safi'])) candidate.add(commands, parents=parents) @@ -952,57 +952,57 @@ def state_absent(module, existing, proposed, candidate): parents.append('neighbor {0}'.format(module.params['neighbor'])) commands.append('no address-family {0} {1}'.format( - module.params['afi'], module.params['safi'])) + module.params['afi'], module.params['safi'])) candidate.add(commands, parents=parents) def main(): argument_spec = dict( - asn=dict(required=True, type='str'), - vrf=dict(required=False, type='str', default='default'), - neighbor=dict(required=True, type='str'), - afi=dict(required=True, type='str'), - safi=dict(required=True, type='str'), - additional_paths_receive=dict(required=False, type='str', + asn=dict(required=True, type='str'), + vrf=dict(required=False, type='str', default='default'), + neighbor=dict(required=True, type='str'), + afi=dict(required=True, type='str'), + safi=dict(required=True, type='str'), + additional_paths_receive=dict(required=False, type='str', choices=['enable', 'disable', 'inherit']), - additional_paths_send=dict(required=False, type='str', + additional_paths_send=dict(required=False, type='str', choices=['enable', 'disable', 'inherit']), - advertise_map_exist=dict(required=False, type='list'), - advertise_map_non_exist=dict(required=False, type='list'), - allowas_in=dict(required=False, type='bool'), - allowas_in_max=dict(required=False, type='str'), - as_override=dict(required=False, type='bool'), - default_originate=dict(required=False, type='bool'), - default_originate_route_map=dict(required=False, type='str'), - filter_list_in=dict(required=False, type='str'), - filter_list_out=dict(required=False, type='str'), - max_prefix_limit=dict(required=False, type='str'), - max_prefix_interval=dict(required=False, type='str'), - max_prefix_threshold=dict(required=False, type='str'), - max_prefix_warning=dict(required=False, type='bool'), - next_hop_self=dict(required=False, type='bool'), - next_hop_third_party=dict(required=False, type='bool'), - prefix_list_in=dict(required=False, type='str'), - prefix_list_out=dict(required=False, type='str'), - route_map_in=dict(required=False, type='str'), - route_map_out=dict(required=False, type='str'), - route_reflector_client=dict(required=False, type='bool'), - send_community=dict(required=False, choices=['none', + advertise_map_exist=dict(required=False, type='list'), + advertise_map_non_exist=dict(required=False, type='list'), + allowas_in=dict(required=False, type='bool'), + allowas_in_max=dict(required=False, type='str'), + as_override=dict(required=False, type='bool'), + default_originate=dict(required=False, type='bool'), + default_originate_route_map=dict(required=False, type='str'), + filter_list_in=dict(required=False, type='str'), + filter_list_out=dict(required=False, type='str'), + max_prefix_limit=dict(required=False, type='str'), + max_prefix_interval=dict(required=False, type='str'), + max_prefix_threshold=dict(required=False, type='str'), + max_prefix_warning=dict(required=False, type='bool'), + next_hop_self=dict(required=False, type='bool'), + next_hop_third_party=dict(required=False, type='bool'), + prefix_list_in=dict(required=False, type='str'), + prefix_list_out=dict(required=False, type='str'), + route_map_in=dict(required=False, type='str'), + route_map_out=dict(required=False, type='str'), + route_reflector_client=dict(required=False, type='bool'), + send_community=dict(required=False, choices=['none', 'both', 'extended', 'standard', 'default']), - soft_reconfiguration_in=dict(required=False, type='str', + soft_reconfiguration_in=dict(required=False, type='str', choices=['enable', 'always', 'inherit']), - soo=dict(required=False, type='str'), - suppress_inactive=dict(required=False, type='bool'), - unsuppress_map=dict(required=False, type='str'), - weight=dict(required=False, type='str'), - state=dict(choices=['present', 'absent'], default='present', + soo=dict(required=False, type='str'), + suppress_inactive=dict(required=False, type='bool'), + unsuppress_map=dict(required=False, type='str'), + weight=dict(required=False, type='str'), + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, mutually_exclusive=[['advertise_map_exist', @@ -1021,40 +1021,40 @@ def main(): module.fail_json(msg='SOO is only allowed in non-default VRF') args = [ - 'afi', - 'asn', - 'neighbor', - 'additional_paths_receive', - 'additional_paths_send', - 'advertise_map_exist', - 'advertise_map_non_exist', - 'allowas_in', - 'allowas_in_max', - 'as_override', - 'default_originate', - 'default_originate_route_map', - 'filter_list_in', - 'filter_list_out', - 'max_prefix_limit', - 'max_prefix_interval', - 'max_prefix_threshold', - 'max_prefix_warning', - 'next_hop_self', - 'next_hop_third_party', - 'prefix_list_in', - 'prefix_list_out', - 'route_map_in', - 'route_map_out', - 'soft_reconfiguration_in', - 'soo', - 'suppress_inactive', - 'unsuppress_map', - 'weight', - 'route_reflector_client', - 'safi', - 'send_community', - 'vrf' - ] + 'afi', + 'asn', + 'neighbor', + 'additional_paths_receive', + 'additional_paths_send', + 'advertise_map_exist', + 'advertise_map_non_exist', + 'allowas_in', + 'allowas_in_max', + 'as_override', + 'default_originate', + 'default_originate_route_map', + 'filter_list_in', + 'filter_list_out', + 'max_prefix_limit', + 'max_prefix_interval', + 'max_prefix_threshold', + 'max_prefix_warning', + 'next_hop_self', + 'next_hop_third_party', + 'prefix_list_in', + 'prefix_list_out', + 'route_map_in', + 'route_map_out', + 'soft_reconfiguration_in', + 'soo', + 'suppress_inactive', + 'unsuppress_map', + 'weight', + 'route_reflector_client', + 'safi', + 'send_community', + 'vrf' + ] existing = invoke('get_existing', module, args) if existing.get('asn'): diff --git a/lib/ansible/modules/network/nxos/nxos_evpn_global.py b/lib/ansible/modules/network/nxos/nxos_evpn_global.py index ed4a6a636c..0838061715 100644 --- a/lib/ansible/modules/network/nxos/nxos_evpn_global.py +++ b/lib/ansible/modules/network/nxos/nxos_evpn_global.py @@ -281,10 +281,10 @@ def get_commands(module, existing, proposed, candidate): def main(): argument_spec = dict( - nv_overlay_evpn=dict(required=True, type='bool'), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + nv_overlay_evpn=dict(required=True, type='bool'), + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_evpn_vni.py b/lib/ansible/modules/network/nxos/nxos_evpn_vni.py index e70d933acd..b6c8c6160e 100644 --- a/lib/ansible/modules/network/nxos/nxos_evpn_vni.py +++ b/lib/ansible/modules/network/nxos/nxos_evpn_vni.py @@ -409,28 +409,28 @@ def execute_config(module, candidate): def main(): argument_spec = dict( - vni=dict(required=True, type='str'), - route_distinguisher=dict(required=False, type='str'), - route_target_both=dict(required=False, type='list'), - route_target_import=dict(required=False, type='list'), - route_target_export=dict(required=False, type='list'), - state=dict(choices=['present', 'absent'], default='present', + vni=dict(required=True, type='str'), + route_distinguisher=dict(required=False, type='str'), + route_target_both=dict(required=False, type='list'), + route_target_import=dict(required=False, type='list'), + route_target_export=dict(required=False, type='list'), + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) state = module.params['state'] args = [ - 'vni', - 'route_distinguisher', - 'route_target_both', - 'route_target_import', - 'route_target_export' - ] + 'vni', + 'route_distinguisher', + 'route_target_both', + 'route_target_import', + 'route_target_export' + ] existing = invoke('get_existing', module, args) end_state = existing @@ -461,9 +461,9 @@ def main(): 'It is highly recommended to use a task ' '(with default as value) to explicitly ' 'unconfigure it.'.format( - existing['route_distinguisher'])) + existing['route_distinguisher'])) remove_commands = ['no rd {0}'.format( - existing['route_distinguisher'])] + existing['route_distinguisher'])] candidate.add(remove_commands, parents=parents) result = execute_config(module, candidate) diff --git a/lib/ansible/modules/network/nxos/nxos_feature.py b/lib/ansible/modules/network/nxos/nxos_feature.py index d69eb49986..1bbeb11b0e 100644 --- a/lib/ansible/modules/network/nxos/nxos_feature.py +++ b/lib/ansible/modules/network/nxos/nxos_feature.py @@ -405,36 +405,36 @@ def validate_feature(module, mode='show'): feature_to_be_mapped = { 'show': { - 'nv overlay': 'nve', - 'vn-segment-vlan-based': 'vnseg_vlan', - 'hsrp': 'hsrp_engine', - 'fabric multicast': 'fabric_mcast', - 'scp-server': 'scpServer', - 'sftp-server': 'sftpServer', - 'sla responder': 'sla_responder', - 'sla sender': 'sla_sender', - 'ssh': 'sshServer', - 'tacacs+': 'tacacs', - 'telnet': 'telnetServer', - 'ethernet-link-oam': 'elo', - 'port-security': 'eth_port_sec' - }, + 'nv overlay': 'nve', + 'vn-segment-vlan-based': 'vnseg_vlan', + 'hsrp': 'hsrp_engine', + 'fabric multicast': 'fabric_mcast', + 'scp-server': 'scpServer', + 'sftp-server': 'sftpServer', + 'sla responder': 'sla_responder', + 'sla sender': 'sla_sender', + 'ssh': 'sshServer', + 'tacacs+': 'tacacs', + 'telnet': 'telnetServer', + 'ethernet-link-oam': 'elo', + 'port-security': 'eth_port_sec' + }, 'config': { - 'nve': 'nv overlay', - 'vnseg_vlan': 'vn-segment-vlan-based', - 'hsrp_engine': 'hsrp', - 'fabric_mcast': 'fabric multicast', - 'scpServer': 'scp-server', - 'sftpServer': 'sftp-server', - 'sla_sender': 'sla sender', - 'sla_responder': 'sla responder', - 'sshServer': 'ssh', - 'tacacs': 'tacacs+', - 'telnetServer': 'telnet', - 'elo': 'ethernet-link-oam', - 'eth_port_sec': 'port-security' - } - } + 'nve': 'nv overlay', + 'vnseg_vlan': 'vn-segment-vlan-based', + 'hsrp_engine': 'hsrp', + 'fabric_mcast': 'fabric multicast', + 'scpServer': 'scp-server', + 'sftpServer': 'sftp-server', + 'sla_sender': 'sla sender', + 'sla_responder': 'sla responder', + 'sshServer': 'ssh', + 'tacacs': 'tacacs+', + 'telnetServer': 'telnet', + 'elo': 'ethernet-link-oam', + 'eth_port_sec': 'port-security' + } + } if feature in feature_to_be_mapped[mode]: feature = feature_to_be_mapped[mode][feature] @@ -444,12 +444,12 @@ def validate_feature(module, mode='show'): def main(): argument_spec = dict( - feature=dict(type='str', required=True), - state=dict(choices=['enabled', 'disabled'], default='enabled', + feature=dict(type='str', required=True), + state=dict(choices=['enabled', 'disabled'], default='enabled', required=False), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_file_copy.py b/lib/ansible/modules/network/nxos/nxos_file_copy.py index 0885c4575e..e47fc0f2c2 100644 --- a/lib/ansible/modules/network/nxos/nxos_file_copy.py +++ b/lib/ansible/modules/network/nxos/nxos_file_copy.py @@ -351,7 +351,7 @@ def transfer_file(module, dest): except: time.sleep(10) temp_size = verify_remote_file_exists( - module, dest, file_system=module.params['file_system']) + module, dest, file_system=module.params['file_system']) if int(temp_size) == int(file_size): pass else: @@ -365,12 +365,12 @@ def transfer_file(module, dest): def main(): argument_spec = dict( - local_file=dict(required=True), - remote_file=dict(required=False), - file_system=dict(required=False, default='bootflash:'), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + local_file=dict(required=True), + remote_file=dict(required=False), + file_system=dict(required=False, default='bootflash:'), + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_gir.py b/lib/ansible/modules/network/nxos/nxos_gir.py index 19e0983c77..1568a5e29b 100644 --- a/lib/ansible/modules/network/nxos/nxos_gir.py +++ b/lib/ansible/modules/network/nxos/nxos_gir.py @@ -408,7 +408,7 @@ def get_commands(module, state, mode): commands.append('no system mode maintenance') elif (module.params[ - 'system_mode_maintenance_dont_generate_profile'] is True and + 'system_mode_maintenance_dont_generate_profile'] is True and mode == 'normal'): commands.append('system mode maintenance dont-generate-profile') elif (module.params[ @@ -434,20 +434,20 @@ def get_commands(module, state, mode): reset_reasons = get_reset_reasons(module) if (state == 'present' and module.params[ - 'system_mode_maintenance_on_reload_reset_reason'].lower() not + 'system_mode_maintenance_on_reload_reset_reason'].lower() not in reset_reasons.lower()): commands.append('system mode maintenance on-reload ' 'reset-reason {0}'.format( - module.params[ - 'system_mode_maintenance_on_reload_reset_reason'])) + module.params[ + 'system_mode_maintenance_on_reload_reset_reason'])) elif (state == 'absent' and module.params[ - 'system_mode_maintenance_on_reload_reset_reason'].lower() in + 'system_mode_maintenance_on_reload_reset_reason'].lower() in reset_reasons.lower()): commands.append('no system mode maintenance on-reload ' 'reset-reason {0}'.format( - module.params[ - 'system_mode_maintenance_on_reload_reset_reason'])) + module.params[ + 'system_mode_maintenance_on_reload_reset_reason'])) if commands: commands.insert(0, 'terminal dont-ask') @@ -456,32 +456,32 @@ def get_commands(module, state, mode): def main(): argument_spec = dict( - system_mode_maintenance=dict(required=False, type='bool'), - system_mode_maintenance_dont_generate_profile=dict(required=False, + system_mode_maintenance=dict(required=False, type='bool'), + system_mode_maintenance_dont_generate_profile=dict(required=False, type='bool'), - system_mode_maintenance_timeout=dict(required=False, type='str'), - system_mode_maintenance_shutdown=dict(required=False, type='bool'), - system_mode_maintenance_on_reload_reset_reason=dict(required=False, + system_mode_maintenance_timeout=dict(required=False, type='str'), + system_mode_maintenance_shutdown=dict(required=False, type='bool'), + system_mode_maintenance_on_reload_reset_reason=dict(required=False, choices=['hw_error','svc_failure','kern_failure', 'wdog_timeout','fatal_error','lc_failure', 'match_any','manual_reload']), - state=dict(choices=['absent', 'present', 'default'], + state=dict(choices=['absent', 'present', 'default'], default='present', required=False) ) module = get_network_module(argument_spec=argument_spec, mutually_exclusive=[[ - 'system_mode_maintenance', - 'system_mode_maintenance_dont_generate_profile', - 'system_mode_maintenance_timeout', - 'system_mode_maintenance_shutdown', - 'system_mode_maintenance_on_reload_reset_reason' + 'system_mode_maintenance', + 'system_mode_maintenance_dont_generate_profile', + 'system_mode_maintenance_timeout', + 'system_mode_maintenance_shutdown', + 'system_mode_maintenance_on_reload_reset_reason' ]], required_one_of=[[ - 'system_mode_maintenance', - 'system_mode_maintenance_dont_generate_profile', - 'system_mode_maintenance_timeout', - 'system_mode_maintenance_shutdown', - 'system_mode_maintenance_on_reload_reset_reason' + 'system_mode_maintenance', + 'system_mode_maintenance_dont_generate_profile', + 'system_mode_maintenance_timeout', + 'system_mode_maintenance_shutdown', + 'system_mode_maintenance_on_reload_reset_reason' ]], supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_gir_profile_management.py b/lib/ansible/modules/network/nxos/nxos_gir_profile_management.py index 22aae584aa..af0444b675 100644 --- a/lib/ansible/modules/network/nxos/nxos_gir_profile_management.py +++ b/lib/ansible/modules/network/nxos/nxos_gir_profile_management.py @@ -335,12 +335,12 @@ def execute_config_command(commands, module): def main(): argument_spec = dict( - commands=dict(required=False, type='list'), - mode=dict(required=True, choices=['maintenance', 'normal']), - state=dict(choices=['absent', 'present'], + commands=dict(required=False, type='list'), + mode=dict(required=True, choices=['maintenance', 'normal']), + state=dict(choices=['absent', 'present'], default='present'), - include_defaults=dict(default=False), - config=dict() + include_defaults=dict(default=False), + config=dict() ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_hsrp.py b/lib/ansible/modules/network/nxos/nxos_hsrp.py index f1e069d144..a183a0c0ee 100644 --- a/lib/ansible/modules/network/nxos/nxos_hsrp.py +++ b/lib/ansible/modules/network/nxos/nxos_hsrp.py @@ -604,20 +604,20 @@ def validate_params(param, module): def main(): argument_spec = dict( - group=dict(required=True, type='str'), - interface=dict(required=True), - version=dict(choices=['1', '2'], default='2', required=False), - priority=dict(type='str', required=False), - preempt=dict(type='str', choices=['disabled', 'enabled'], + group=dict(required=True, type='str'), + interface=dict(required=True), + version=dict(choices=['1', '2'], default='2', required=False), + priority=dict(type='str', required=False), + preempt=dict(type='str', choices=['disabled', 'enabled'], required=False), - vip=dict(type='str', required=False), - auth_type=dict(choices=['text', 'md5'], required=False), - auth_string=dict(type='str', required=False), - state=dict(choices=['absent', 'present'], required=False, + vip=dict(type='str', required=False), + auth_type=dict(choices=['text', 'md5'], required=False), + auth_string=dict(type='str', required=False), + state=dict(choices=['absent', 'present'], required=False, default='present'), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -685,7 +685,7 @@ def main(): commands = [] if state == 'present': delta = dict( - set(proposed.items()).difference(existing.items())) + set(proposed.items()).difference(existing.items())) if delta: command = get_commands_config_hsrp(delta, interface, args) commands.extend(command) diff --git a/lib/ansible/modules/network/nxos/nxos_igmp.py b/lib/ansible/modules/network/nxos/nxos_igmp.py index def225466a..70731eaa6a 100644 --- a/lib/ansible/modules/network/nxos/nxos_igmp.py +++ b/lib/ansible/modules/network/nxos/nxos_igmp.py @@ -335,13 +335,13 @@ def apply_key_map(key_map, table): def main(): argument_spec = dict( - flush_routes=dict(type='bool'), - enforce_rtr_alert=dict(type='bool'), - restart=dict(type='bool', default=False), - state=dict(choices=['present', 'default'], default='present'), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + flush_routes=dict(type='bool'), + enforce_rtr_alert=dict(type='bool'), + restart=dict(type='bool', default=False), + state=dict(choices=['present', 'default'], default='present'), + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -354,9 +354,9 @@ def main(): module.fail_json(msg='When state=default other params have no effect.') args = [ - "flush_routes", - "enforce_rtr_alert", - ] + "flush_routes", + "enforce_rtr_alert", + ] existing = invoke('get_existing', module, args) end_state = existing diff --git a/lib/ansible/modules/network/nxos/nxos_igmp_interface.py b/lib/ansible/modules/network/nxos/nxos_igmp_interface.py index b72a22940a..36bba1a687 100644 --- a/lib/ansible/modules/network/nxos/nxos_igmp_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_igmp_interface.py @@ -552,7 +552,7 @@ def get_igmp_interface(module, interface): command = 'show run interface {0} | inc oif'.format(interface) body = execute_show_command( - command, module, command_type='cli_show_ascii')[0] + command, module, command_type='cli_show_ascii')[0] staticoif = [] if body: @@ -573,7 +573,7 @@ def get_igmp_interface(module, interface): try: match_prefix_source = re.match( - prefix_source_regex, line, re.DOTALL) + prefix_source_regex, line, re.DOTALL) prefix_source_group = match_prefix_source.groupdict() prefix = prefix_source_group['prefix'] source = prefix_source_group['source'] @@ -694,7 +694,7 @@ def config_remove_oif(existing, existing_oif_prefix_source): command = None if existing.get('routemap'): command = 'no ip igmp static-oif route-map {0}'.format( - existing.get('routemap')) + existing.get('routemap')) if existing_oif_prefix_source: for each in existing_oif_prefix_source: if each.get('prefix') and each.get('source'): @@ -732,28 +732,28 @@ def execute_config_command(commands, module): def main(): argument_spec = dict( - interface=dict(required=True, type='str'), - version=dict(required=False, type='str'), - startup_query_interval=dict(required=False, type='str'), - startup_query_count=dict(required=False, type='str'), - robustness=dict(required=False, type='str'), - querier_timeout=dict(required=False, type='str'), - query_mrt=dict(required=False, type='str'), - query_interval=dict(required=False, type='str'), - last_member_qrt=dict(required=False, type='str'), - last_member_query_count=dict(required=False, type='str'), - group_timeout=dict(required=False, type='str'), - report_llg=dict(type='bool'), - immediate_leave=dict(type='bool'), - oif_routemap=dict(required=False, type='str'), - oif_prefix=dict(required=False, type='str'), - oif_source=dict(required=False, type='str'), - restart=dict(type='bool', default=False), - state=dict(choices=['present', 'absent', 'default'], + interface=dict(required=True, type='str'), + version=dict(required=False, type='str'), + startup_query_interval=dict(required=False, type='str'), + startup_query_count=dict(required=False, type='str'), + robustness=dict(required=False, type='str'), + querier_timeout=dict(required=False, type='str'), + query_mrt=dict(required=False, type='str'), + query_interval=dict(required=False, type='str'), + last_member_qrt=dict(required=False, type='str'), + last_member_query_count=dict(required=False, type='str'), + group_timeout=dict(required=False, type='str'), + report_llg=dict(type='bool'), + immediate_leave=dict(type='bool'), + oif_routemap=dict(required=False, type='str'), + oif_prefix=dict(required=False, type='str'), + oif_source=dict(required=False, type='str'), + restart=dict(type='bool', default=False), + state=dict(choices=['present', 'absent', 'default'], default='present'), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_igmp_snooping.py b/lib/ansible/modules/network/nxos/nxos_igmp_snooping.py index b6a443a320..75383c3770 100644 --- a/lib/ansible/modules/network/nxos/nxos_igmp_snooping.py +++ b/lib/ansible/modules/network/nxos/nxos_igmp_snooping.py @@ -408,7 +408,7 @@ def get_igmp_snooping(module): command = 'show run all | include igmp.snooping' existing = {} body = execute_show_command( - command, module, command_type='cli_show_ascii')[0] + command, module, command_type='cli_show_ascii')[0] if body: split_body = body.splitlines() @@ -485,12 +485,12 @@ def get_igmp_snooping_defaults(): def main(): argument_spec = dict( - snooping=dict(required=False, type='bool'), - group_timeout=dict(required=False, type='str'), - link_local_grp_supp=dict(required=False, type='bool'), - report_supp=dict(required=False, type='bool'), - v3_report_supp=dict(required=False, type='bool'), - state=dict(choices=['present', 'default'], default='present'), + snooping=dict(required=False, type='bool'), + group_timeout=dict(required=False, type='str'), + link_local_grp_supp=dict(required=False, type='bool'), + report_supp=dict(required=False, type='bool'), + v3_report_supp=dict(required=False, type='bool'), + state=dict(choices=['present', 'default'], default='present'), ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -516,8 +516,8 @@ def main(): commands = [] if state == 'present': delta = dict( - set(proposed.items()).difference(existing.items()) - ) + set(proposed.items()).difference(existing.items()) + ) if delta: command = config_igmp_snooping(delta, existing) if command: @@ -525,8 +525,8 @@ def main(): elif state == 'default': proposed = get_igmp_snooping_defaults() delta = dict( - set(proposed.items()).difference(existing.items()) - ) + set(proposed.items()).difference(existing.items()) + ) if delta: command = config_igmp_snooping(delta, existing, default=True) if command: diff --git a/lib/ansible/modules/network/nxos/nxos_install_os.py b/lib/ansible/modules/network/nxos/nxos_install_os.py index 278afb36d9..65497b9e8e 100644 --- a/lib/ansible/modules/network/nxos/nxos_install_os.py +++ b/lib/ansible/modules/network/nxos/nxos_install_os.py @@ -381,8 +381,8 @@ def set_boot_options(module, image_name, kickstart=None): def main(): argument_spec = dict( - system_image_file=dict(required=True), - kickstart_image_file=dict(required=False), + system_image_file=dict(required=True), + kickstart_image_file=dict(required=False), ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_interface.py b/lib/ansible/modules/network/nxos/nxos_interface.py index 275a0dcf6e..424d52c4ca 100644 --- a/lib/ansible/modules/network/nxos/nxos_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_interface.py @@ -655,7 +655,7 @@ def get_interface_config_commands(interface, intf, existing): commands.append('no ip forward') fabric_forwarding_anycast_gateway = interface.get( - 'fabric_forwarding_anycast_gateway') + 'fabric_forwarding_anycast_gateway') if fabric_forwarding_anycast_gateway is not None: if fabric_forwarding_anycast_gateway is True: commands.append('fabric forwarding mode anycast-gateway') diff --git a/lib/ansible/modules/network/nxos/nxos_interface_ospf.py b/lib/ansible/modules/network/nxos/nxos_interface_ospf.py index c69e30e09b..3f37517deb 100644 --- a/lib/ansible/modules/network/nxos/nxos_interface_ospf.py +++ b/lib/ansible/modules/network/nxos/nxos_interface_ospf.py @@ -465,11 +465,11 @@ def get_default_commands(existing, proposed, existing_commands, key, module): elif existing['message_digest_encryption_type'] == 'cisco_type_7': encryption_type = '7' command = 'no {0} {1} {2} {3} {4}'.format( - key, - existing['message_digest_key_id'], - existing['message_digest_algorithm_type'], - encryption_type, - existing['message_digest_password']) + key, + existing['message_digest_key_id'], + existing['message_digest_algorithm_type'], + encryption_type, + existing['message_digest_password']) commands.append(command) else: commands.append('no {0} {1}'.format(key, existing_value)) @@ -493,11 +493,11 @@ def get_custom_command(existing_cmd, proposed, key, module): elif proposed['message_digest_encryption_type'] == 'cisco_type_7': encryption_type = '7' command = '{0} {1} {2} {3} {4}'.format( - key, - proposed['message_digest_key_id'], - proposed['message_digest_algorithm_type'], - encryption_type, - proposed['message_digest_password']) + key, + proposed['message_digest_key_id'], + proposed['message_digest_algorithm_type'], + encryption_type, + proposed['message_digest_password']) commands.append(command) return commands @@ -545,11 +545,11 @@ def state_absent(module, existing, proposed, candidate): elif existing['message_digest_encryption_type'] == 'cisco_type_7': encryption_type = '7' command = 'no {0} {1} {2} {3} {4}'.format( - key, - existing['message_digest_key_id'], - existing['message_digest_algorithm_type'], - encryption_type, - existing['message_digest_password']) + key, + existing['message_digest_key_id'], + existing['message_digest_algorithm_type'], + encryption_type, + existing['message_digest_password']) commands.append(command) elif key in ['ip ospf authentication message-digest', 'ip ospf passive-interface']: @@ -580,25 +580,25 @@ def normalize_area(area, module): def main(): argument_spec = dict( - interface=dict(required=True, type='str'), - ospf=dict(required=True, type='str'), - area=dict(required=True, type='str'), - cost=dict(required=False, type='str'), - hello_interval=dict(required=False, type='str'), - dead_interval=dict(required=False, type='str'), - passive_interface=dict(required=False, type='bool'), - message_digest=dict(required=False, type='bool'), - message_digest_key_id=dict(required=False, type='str'), - message_digest_algorithm_type=dict(required=False, type='str', + interface=dict(required=True, type='str'), + ospf=dict(required=True, type='str'), + area=dict(required=True, type='str'), + cost=dict(required=False, type='str'), + hello_interval=dict(required=False, type='str'), + dead_interval=dict(required=False, type='str'), + passive_interface=dict(required=False, type='bool'), + message_digest=dict(required=False, type='bool'), + message_digest_key_id=dict(required=False, type='str'), + message_digest_algorithm_type=dict(required=False, type='str', choices=['md5']), - message_digest_encryption_type=dict(required=False, type='str', + message_digest_encryption_type=dict(required=False, type='str', choices=['cisco_type_7','3des']), - message_digest_password=dict(required=False, type='str'), - state=dict(choices=['present', 'absent'], default='present', + message_digest_password=dict(required=False, type='str'), + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, required_together=[['message_digest_key_id', @@ -616,19 +616,19 @@ def main(): state = module.params['state'] args = [ - 'interface', - 'ospf', - 'area', - 'cost', - 'hello_interval', - 'dead_interval', - 'passive_interface', - 'message_digest', - 'message_digest_key_id', - 'message_digest_algorithm_type', - 'message_digest_encryption_type', - 'message_digest_password' - ] + 'interface', + 'ospf', + 'area', + 'cost', + 'hello_interval', + 'dead_interval', + 'passive_interface', + 'message_digest', + 'message_digest_key_id', + 'message_digest_algorithm_type', + 'message_digest_encryption_type', + 'message_digest_password' + ] existing = invoke('get_existing', module, args) end_state = existing diff --git a/lib/ansible/modules/network/nxos/nxos_ip_interface.py b/lib/ansible/modules/network/nxos/nxos_ip_interface.py index 7431be75ca..da7ddebb6d 100644 --- a/lib/ansible/modules/network/nxos/nxos_ip_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_ip_interface.py @@ -508,7 +508,7 @@ def parse_unstructured_data(body, interface_name, module): interface['prefix'] = prefix interface_list_table = splitted_body[ - first_reference_point:last_reference_point] + first_reference_point:last_reference_point] for each_line in interface_list_table: address = each_line.strip().split(' ')[0] @@ -551,10 +551,10 @@ def get_ip_interface(interface_name, version, module): # and manually parse it. if module.params['transport'] == 'nxapi' and version == 'v6': interface, address_list = parse_unstructured_data( - body, interface_name, module) + body, interface_name, module) else: interface, address_list = parse_structured_data( - body, interface_name, version, module) + body, interface_name, version, module) return interface, address_list @@ -629,16 +629,16 @@ def validate_params(addr, interface, mask, version, state, intf_type, module): def main(): argument_spec = dict( - interface=dict(required=True), - addr=dict(required=False), - version=dict(required=False, choices=['v4', 'v6'], + interface=dict(required=True), + addr=dict(required=False), + version=dict(required=False, choices=['v4', 'v6'], default='v4'), - mask=dict(type='str', required=False), - state=dict(required=False, default='present', + mask=dict(type='str', required=False), + state=dict(required=False, default='present', choices=['present', 'absent']), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_mtu.py b/lib/ansible/modules/network/nxos/nxos_mtu.py index 392c4ffbad..4486e42c5a 100644 --- a/lib/ansible/modules/network/nxos/nxos_mtu.py +++ b/lib/ansible/modules/network/nxos/nxos_mtu.py @@ -461,7 +461,7 @@ def is_default(interface, module): try: body = execute_show_command( - command, module, command_type='cli_show_ascii')[0] + command, module, command_type='cli_show_ascii')[0] if body == 'DNE': return 'DNE' else: @@ -498,10 +498,10 @@ def get_interface_mode(interface, intf_type, module): def main(): argument_spec = dict( - mtu=dict(type='str'), - interface=dict(type='str'), - sysmtu=dict(type='str'), - state=dict(choices=['absent', 'present'], default='present'), + mtu=dict(type='str'), + interface=dict(type='str'), + sysmtu=dict(type='str'), + state=dict(choices=['absent', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, required_together=[['mtu', 'interface']], diff --git a/lib/ansible/modules/network/nxos/nxos_ntp.py b/lib/ansible/modules/network/nxos/nxos_ntp.py index 0de3f4cf55..441dbb2aad 100644 --- a/lib/ansible/modules/network/nxos/nxos_ntp.py +++ b/lib/ansible/modules/network/nxos/nxos_ntp.py @@ -400,15 +400,15 @@ def get_ntp_peer(module): command = 'show run | inc ntp.(server|peer)' ntp_peer_list = [] ntp = execute_show_command( - command, module, command_type='cli_show_ascii') + command, module, command_type='cli_show_ascii') if ntp: ntp = ntp[0] ntp_regex = ( - ".*ntp\s(server\s(?P
\S+)|peer\s(?P\S+))" - "\s*((?Pprefer)\s*)?(use-vrf\s(?P\S+)\s*)?" - "(key\s(?P\d+))?.*" - ) + ".*ntp\s(server\s(?P
\S+)|peer\s(?P\S+))" + "\s*((?Pprefer)\s*)?(use-vrf\s(?P\S+)\s*)?" + "(key\s(?P\d+))?.*" + ) split_ntp = ntp.splitlines() for peer_line in split_ntp: @@ -521,14 +521,14 @@ def config_ntp(delta, existing): def main(): argument_spec = dict( - server=dict(type='str'), - peer=dict(type='str'), - key_id=dict(type='str'), - prefer=dict(type='str', choices=['enabled', 'disabled']), - vrf_name=dict(type='str'), - source_addr=dict(type='str'), - source_int=dict(type='str'), - state=dict(choices=['absent', 'present'], default='present'), + server=dict(type='str'), + peer=dict(type='str'), + key_id=dict(type='str'), + prefer=dict(type='str', choices=['enabled', 'disabled']), + vrf_name=dict(type='str'), + source_addr=dict(type='str'), + source_int=dict(type='str'), + state=dict(choices=['absent', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, mutually_exclusive=[ @@ -606,7 +606,7 @@ def main(): if proposed_source_type == existing_source_type: if proposed_source == existing_source: command = 'no ntp {0} {1}'.format( - existing_source_type, existing_source) + existing_source_type, existing_source) if command: commands.append([command]) diff --git a/lib/ansible/modules/network/nxos/nxos_ntp_auth.py b/lib/ansible/modules/network/nxos/nxos_ntp_auth.py index 4d7be33e34..66ed69a374 100644 --- a/lib/ansible/modules/network/nxos/nxos_ntp_auth.py +++ b/lib/ansible/modules/network/nxos/nxos_ntp_auth.py @@ -393,7 +393,7 @@ def get_ntp_trusted_key(module): command = 'show run | inc ntp.trusted-key' trusted_key_str = execute_show_command( - command, module, command_type='cli_show_ascii')[0] + command, module, command_type='cli_show_ascii')[0] if trusted_key_str: trusted_keys = trusted_key_str.splitlines() @@ -496,12 +496,12 @@ def remove_ntp_auth_key(key_id, md5string, auth_type, trusted_key, authenticatio def main(): argument_spec = dict( - key_id=dict(required=True, type='str'), - md5string=dict(required=True, type='str'), - auth_type=dict(choices=['text', 'encrypt'], default='text'), - trusted_key=dict(choices=['true', 'false'], default='false'), - authentication=dict(choices=['on', 'off']), - state=dict(choices=['absent', 'present'], default='present'), + key_id=dict(required=True, type='str'), + md5string=dict(required=True, type='str'), + auth_type=dict(choices=['text', 'encrypt'], default='text'), + trusted_key=dict(choices=['true', 'false'], default='false'), + authentication=dict(choices=['on', 'off']), + state=dict(choices=['absent', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_ntp_options.py b/lib/ansible/modules/network/nxos/nxos_ntp_options.py index 9ef36d7522..121602347b 100644 --- a/lib/ansible/modules/network/nxos/nxos_ntp_options.py +++ b/lib/ansible/modules/network/nxos/nxos_ntp_options.py @@ -437,10 +437,10 @@ def config_ntp_options(delta, flip=False): def main(): argument_spec = dict( - master=dict(required=False, type='bool'), - stratum=dict(type='str'), - logging=dict(required=False, type='bool'), - state=dict(choices=['absent', 'present'], default='present'), + master=dict(required=False, type='bool'), + stratum=dict(type='str'), + logging=dict(required=False, type='bool'), + state=dict(choices=['absent', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, required_one_of=[['master', 'logging']], diff --git a/lib/ansible/modules/network/nxos/nxos_ospf.py b/lib/ansible/modules/network/nxos/nxos_ospf.py index 024b5f0ba2..fbb452ce25 100644 --- a/lib/ansible/modules/network/nxos/nxos_ospf.py +++ b/lib/ansible/modules/network/nxos/nxos_ospf.py @@ -297,12 +297,12 @@ def state_absent(module, proposed, candidate): def main(): argument_spec = dict( - ospf=dict(required=True, type='str'), - state=dict(choices=['present', 'absent'], default='present', + ospf=dict(required=True, type='str'), + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_ospf_vrf.py b/lib/ansible/modules/network/nxos/nxos_ospf_vrf.py index e2fb59043b..f9728c978d 100644 --- a/lib/ansible/modules/network/nxos/nxos_ospf_vrf.py +++ b/lib/ansible/modules/network/nxos/nxos_ospf_vrf.py @@ -441,16 +441,16 @@ def state_present(module, existing, proposed, candidate): else: if key == 'timers throttle lsa': command = '{0} {1} {2} {3}'.format( - key, - proposed['timer_throttle_lsa_start'], - proposed['timer_throttle_lsa_hold'], - proposed['timer_throttle_lsa_max']) + key, + proposed['timer_throttle_lsa_start'], + proposed['timer_throttle_lsa_hold'], + proposed['timer_throttle_lsa_max']) elif key == 'timers throttle spf': command = '{0} {1} {2} {3}'.format( - key, - proposed['timer_throttle_spf_start'], - proposed['timer_throttle_spf_hold'], - proposed['timer_throttle_spf_max']) + key, + proposed['timer_throttle_spf_start'], + proposed['timer_throttle_spf_hold'], + proposed['timer_throttle_spf_max']) elif key == 'log-adjacency-changes': if value == 'log': command = key @@ -485,16 +485,16 @@ def state_absent(module, existing, proposed, candidate): if value: if key == 'timers throttle lsa': command = 'no {0} {1} {2} {3}'.format( - key, - existing['timer_throttle_lsa_start'], - existing['timer_throttle_lsa_hold'], - existing['timer_throttle_lsa_max']) + key, + existing['timer_throttle_lsa_start'], + existing['timer_throttle_lsa_hold'], + existing['timer_throttle_lsa_max']) elif key == 'timers throttle spf': command = 'no {0} {1} {2} {3}'.format( - key, - existing['timer_throttle_spf_start'], - existing['timer_throttle_spf_hold'], - existing['timer_throttle_spf_max']) + key, + existing['timer_throttle_spf_start'], + existing['timer_throttle_spf_hold'], + existing['timer_throttle_spf_max']) else: existing_value = existing_commands.get(key) command = 'no {0} {1}'.format(key, existing_value) @@ -508,43 +508,43 @@ def state_absent(module, existing, proposed, candidate): def main(): argument_spec = dict( - vrf=dict(required=False, type='str', default='default'), - ospf=dict(required=True, type='str'), - router_id=dict(required=False, type='str'), - default_metric=dict(required=False, type='str'), - log_adjacency=dict(required=False, type='str', + vrf=dict(required=False, type='str', default='default'), + ospf=dict(required=True, type='str'), + router_id=dict(required=False, type='str'), + default_metric=dict(required=False, type='str'), + log_adjacency=dict(required=False, type='str', choices=['log', 'detail', 'default']), - timer_throttle_lsa_start=dict(required=False, type='str'), - timer_throttle_lsa_hold=dict(required=False, type='str'), - timer_throttle_lsa_max=dict(required=False, type='str'), - timer_throttle_spf_start=dict(required=False, type='str'), - timer_throttle_spf_hold=dict(required=False, type='str'), - timer_throttle_spf_max=dict(required=False, type='str'), - auto_cost=dict(required=False, type='str'), - state=dict(choices=['present', 'absent'], default='present', + timer_throttle_lsa_start=dict(required=False, type='str'), + timer_throttle_lsa_hold=dict(required=False, type='str'), + timer_throttle_lsa_max=dict(required=False, type='str'), + timer_throttle_spf_start=dict(required=False, type='str'), + timer_throttle_spf_hold=dict(required=False, type='str'), + timer_throttle_spf_max=dict(required=False, type='str'), + auto_cost=dict(required=False, type='str'), + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) state = module.params['state'] args = [ - 'vrf', - 'ospf', - 'router_id', - 'default_metric', - 'log_adjacency', - 'timer_throttle_lsa_start', - 'timer_throttle_lsa_hold', - 'timer_throttle_lsa_max', - 'timer_throttle_spf_start', - 'timer_throttle_spf_hold', - 'timer_throttle_spf_max', - 'auto_cost' - ] + 'vrf', + 'ospf', + 'router_id', + 'default_metric', + 'log_adjacency', + 'timer_throttle_lsa_start', + 'timer_throttle_lsa_hold', + 'timer_throttle_lsa_max', + 'timer_throttle_spf_start', + 'timer_throttle_spf_hold', + 'timer_throttle_spf_max', + 'auto_cost' + ] existing = invoke('get_existing', module, args) end_state = existing diff --git a/lib/ansible/modules/network/nxos/nxos_overlay_global.py b/lib/ansible/modules/network/nxos/nxos_overlay_global.py index 0bf78baeac..a0325a2bd5 100644 --- a/lib/ansible/modules/network/nxos/nxos_overlay_global.py +++ b/lib/ansible/modules/network/nxos/nxos_overlay_global.py @@ -370,18 +370,18 @@ def normalize_mac(proposed_mac, module): def main(): argument_spec = dict( - anycast_gateway_mac=dict(required=True, type='str'), - m_facts=dict(required=False, default=False, type='bool'), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + anycast_gateway_mac=dict(required=True, type='str'), + m_facts=dict(required=False, default=False, type='bool'), + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) args = [ - 'anycast_gateway_mac' - ] + 'anycast_gateway_mac' + ] existing = invoke('get_existing', module, args) end_state = existing diff --git a/lib/ansible/modules/network/nxos/nxos_pim.py b/lib/ansible/modules/network/nxos/nxos_pim.py index c972705a99..785df52fe5 100644 --- a/lib/ansible/modules/network/nxos/nxos_pim.py +++ b/lib/ansible/modules/network/nxos/nxos_pim.py @@ -285,11 +285,11 @@ def get_commands(module, existing, proposed, candidate): def main(): argument_spec = dict( - ssm_range=dict(required=True, type='str'), - m_facts=dict(required=False, default=False, type='bool'), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + ssm_range=dict(required=True, type='str'), + m_facts=dict(required=False, default=False, type='bool'), + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -300,8 +300,8 @@ def main(): "or the keyword 'none'.") args = [ - 'ssm_range' - ] + 'ssm_range' + ] existing = invoke('get_existing', module, args) end_state = existing diff --git a/lib/ansible/modules/network/nxos/nxos_pim_interface.py b/lib/ansible/modules/network/nxos/nxos_pim_interface.py index 466294e007..179a449eb3 100644 --- a/lib/ansible/modules/network/nxos/nxos_pim_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_pim_interface.py @@ -784,7 +784,7 @@ def config_pim_interface_defaults(existing, jp_bidir, isauth): # returns a dict defaults = get_pim_interface_defaults() delta = dict(set(defaults.items()).difference( - existing.items())) + existing.items())) if delta: # returns a list command = config_pim_interface(delta, existing, @@ -799,19 +799,19 @@ def config_pim_interface_defaults(existing, jp_bidir, isauth): def main(): argument_spec=dict( - interface=dict(required=True), - sparse=dict(type='bool', default=True), - dr_prio=dict(type='str'), - hello_auth_key=dict(type='str'), - hello_interval=dict(type='int'), - jp_policy_out=dict(type='str'), - jp_policy_in=dict(type='str'), - jp_type_out=dict(choices=['prefix', 'routemap']), - jp_type_in=dict(choices=['prefix', 'routemap']), - border=dict(type='bool'), - neighbor_policy=dict(type='str'), - neighbor_type=dict(choices=['prefix', 'routemap']), - state=dict(choices=['present', 'absent', 'default'], + interface=dict(required=True), + sparse=dict(type='bool', default=True), + dr_prio=dict(type='str'), + hello_auth_key=dict(type='str'), + hello_interval=dict(type='int'), + jp_policy_out=dict(type='str'), + jp_policy_in=dict(type='str'), + jp_type_out=dict(choices=['prefix', 'routemap']), + jp_type_in=dict(choices=['prefix', 'routemap']), + border=dict(type='bool'), + neighbor_policy=dict(type='str'), + neighbor_type=dict(choices=['prefix', 'routemap']), + state=dict(choices=['present', 'absent', 'default'], default='present'), ) module = get_network_module(argument_spec=argument_spec, diff --git a/lib/ansible/modules/network/nxos/nxos_pim_rp_address.py b/lib/ansible/modules/network/nxos/nxos_pim_rp_address.py index 8cd8d96575..58150fb4af 100644 --- a/lib/ansible/modules/network/nxos/nxos_pim_rp_address.py +++ b/lib/ansible/modules/network/nxos/nxos_pim_rp_address.py @@ -325,7 +325,7 @@ def build_command(param_dict, command): for param in ['group_list', 'prefix_list', 'route_map']: if param_dict.get(param): command += ' {0} {1}'.format( - param.replace('_', '-'), param_dict.get(param)) + param.replace('_', '-'), param_dict.get(param)) if param_dict.get('bidir'): command += ' bidir' return [command] @@ -346,16 +346,16 @@ def state_absent(module, existing, proposed, candidate): def main(): argument_spec = dict( - rp_address=dict(required=True, type='str'), - group_list=dict(required=False, type='str'), - prefix_list=dict(required=False, type='str'), - route_map=dict(required=False, type='str'), - bidir=dict(required=False, type='bool'), - state=dict(choices=['present', 'absent'], default='present', + rp_address=dict(required=True, type='str'), + group_list=dict(required=False, type='str'), + prefix_list=dict(required=False, type='str'), + route_map=dict(required=False, type='str'), + bidir=dict(required=False, type='bool'), + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, mutually_exclusive=[['group_list', 'route_map'], @@ -366,12 +366,12 @@ def main(): state = module.params['state'] args = [ - 'rp_address', - 'group_list', - 'prefix_list', - 'route_map', - 'bidir' - ] + 'rp_address', + 'group_list', + 'prefix_list', + 'route_map', + 'bidir' + ] existing = invoke('get_existing', module, args) end_state = existing diff --git a/lib/ansible/modules/network/nxos/nxos_ping.py b/lib/ansible/modules/network/nxos/nxos_ping.py index f5a53dfd8e..551c409b71 100644 --- a/lib/ansible/modules/network/nxos/nxos_ping.py +++ b/lib/ansible/modules/network/nxos/nxos_ping.py @@ -378,15 +378,15 @@ def get_ping_results(command, module, transport): def main(): argument_spec = dict( - dest=dict(required=True), - count=dict(required=False, default=2), - vrf=dict(required=False), - source=dict(required=False), - state=dict(required=False, choices=['present', 'absent'], + dest=dict(required=True), + count=dict(required=False, default=2), + vrf=dict(required=False), + source=dict(required=False), + state=dict(required=False, choices=['present', 'absent'], default='present'), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -417,7 +417,7 @@ def main(): ping_command += ' {0} {1}'.format(command, arg) ping_results, summary, rtt, ping_pass = get_ping_results( - ping_command, module, module.params['transport']) + ping_command, module, module.params['transport']) packet_loss = summary['packet_loss'] packets_rx = summary['packets_rx'] diff --git a/lib/ansible/modules/network/nxos/nxos_portchannel.py b/lib/ansible/modules/network/nxos/nxos_portchannel.py index 6614691b05..ee759a25a0 100644 --- a/lib/ansible/modules/network/nxos/nxos_portchannel.py +++ b/lib/ansible/modules/network/nxos/nxos_portchannel.py @@ -316,7 +316,7 @@ def check_interface(module, netcfg): def get_custom_value(arg, config, module): REGEX = re.compile(r'\s+member vni {0} associate-vrf\s*$'.format( - module.params['vni']), re.M) + module.params['vni']), re.M) value = False try: if REGEX.search(config): @@ -529,7 +529,7 @@ def config_portchannel(proposed, mode, group): command = 'interface port-channel {0}'.format(group) commands.append(command) commands.append(config_args.get('min_links').format( - min_links=min_links)) + min_links=min_links)) return commands @@ -641,18 +641,18 @@ def flatten_list(command_lists): def main(): argument_spec = dict( - group=dict(required=True, type='str'), - mode=dict(required=False, choices=['on', 'active', 'passive'], + group=dict(required=True, type='str'), + mode=dict(required=False, choices=['on', 'active', 'passive'], default='on', type='str'), - min_links=dict(required=False, default=None, type='str'), - members=dict(required=False, default=None, type='list'), - force=dict(required=False, default='false', type='str', + min_links=dict(required=False, default=None, type='str'), + members=dict(required=False, default=None, type='list'), + force=dict(required=False, default='false', type='str', choices=['true', 'false']), - state=dict(required=False, choices=['absent', 'present'], + state=dict(required=False, choices=['absent', 'present'], default='present'), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -675,11 +675,11 @@ def main(): changed = False args = [ - 'group', - 'members', - 'min_links', - 'mode' - ] + 'group', + 'members', + 'min_links', + 'mode' + ] existing, interface_exist = invoke('get_existing', module, args) end_state = existing diff --git a/lib/ansible/modules/network/nxos/nxos_reboot.py b/lib/ansible/modules/network/nxos/nxos_reboot.py index c479d10a80..3a83ff4b64 100644 --- a/lib/ansible/modules/network/nxos/nxos_reboot.py +++ b/lib/ansible/modules/network/nxos/nxos_reboot.py @@ -269,10 +269,10 @@ def disable_confirmation(module): def main(): argument_spec = dict( - confirm=dict(required=True, type='bool'), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + confirm=dict(required=True, type='bool'), + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_rollback.py b/lib/ansible/modules/network/nxos/nxos_rollback.py index 736fa25cca..d525f7780f 100644 --- a/lib/ansible/modules/network/nxos/nxos_rollback.py +++ b/lib/ansible/modules/network/nxos/nxos_rollback.py @@ -291,11 +291,11 @@ def rollback(filename, module): def main(): argument_spec = dict( - checkpoint_file=dict(required=False), - rollback_to=dict(required=False), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + checkpoint_file=dict(required=False), + rollback_to=dict(required=False), + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, mutually_exclusive=[['checkpoint_file', diff --git a/lib/ansible/modules/network/nxos/nxos_smu.py b/lib/ansible/modules/network/nxos/nxos_smu.py index 1404725ac3..87b902748a 100644 --- a/lib/ansible/modules/network/nxos/nxos_smu.py +++ b/lib/ansible/modules/network/nxos/nxos_smu.py @@ -332,7 +332,7 @@ def get_commands(module, pkg, file_system): if fixed_pkg not in active_body[0]: commands.append('install activate {0}{1} force'.format( - file_system, pkg)) + file_system, pkg)) command = 'show install committed' install_body = execute_show_command(command, module, command_type='cli_show_ascii') @@ -344,11 +344,11 @@ def get_commands(module, pkg, file_system): def main(): argument_spec = dict( - pkg=dict(required=True), - file_system=dict(required=False, default='bootflash:'), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + pkg=dict(required=True), + file_system=dict(required=False, default='bootflash:'), + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_snapshot.py b/lib/ansible/modules/network/nxos/nxos_snapshot.py index e6f367d7bf..0bc4d8ee49 100644 --- a/lib/ansible/modules/network/nxos/nxos_snapshot.py +++ b/lib/ansible/modules/network/nxos/nxos_snapshot.py @@ -485,13 +485,13 @@ def action_add(module, existing_snapshots): if proposed not in sections: if module.params['element_key2']: commands.append('snapshot section add {0} "{1}" {2} {3} {4}'.format( - module.params['section'], module.params['show_command'], - module.params['row_id'], module.params['element_key1'], - module.params['element_key2'])) + module.params['section'], module.params['show_command'], + module.params['row_id'], module.params['element_key1'], + module.params['element_key2'])) else: commands.append('snapshot section add {0} "{1}" {2} {3}'.format( - module.params['section'], module.params['show_command'], - module.params['row_id'], module.params['element_key1'])) + module.params['section'], module.params['show_command'], + module.params['row_id'], module.params['element_key1'])) return commands @@ -575,24 +575,24 @@ def write_on_file(content, filename, module): def main(): argument_spec = dict( - action=dict(required=True, choices=['create', 'add', + action=dict(required=True, choices=['create', 'add', 'compare', 'delete', 'delete_all']), - snapshot_name=dict(required=False, type='str'), - description=dict(required=False, type='str'), - snapshot1=dict(required=False, type='str'), - snapshot2=dict(required=False, type='str'), - compare_option=dict(required=False, + snapshot_name=dict(required=False, type='str'), + description=dict(required=False, type='str'), + snapshot1=dict(required=False, type='str'), + snapshot2=dict(required=False, type='str'), + compare_option=dict(required=False, choices=['summary', 'ipv4routes', 'ipv6routes']), - comparison_results_file=dict(required=False, type='str'), - section=dict(required=False, type='str'), - show_command=dict(required=False, type='str'), - row_id=dict(required=False, type='str'), - element_key1=dict(required=False, type='str'), - element_key2=dict(required=False, type='str'), - save_snapshot_locally=dict(required=False, type='bool', + comparison_results_file=dict(required=False, type='str'), + section=dict(required=False, type='str'), + show_command=dict(required=False, type='str'), + row_id=dict(required=False, type='str'), + element_key1=dict(required=False, type='str'), + element_key2=dict(required=False, type='str'), + save_snapshot_locally=dict(required=False, type='bool', default=False), - path=dict(required=False, type='str', default='./') + path=dict(required=False, type='str', default='./') ) module = get_network_module(argument_spec=argument_spec, mutually_exclusive=[['delete_all', @@ -608,7 +608,7 @@ def main(): if not os.path.isdir(module.params['path']): module.fail_json(msg='{0} is not a valid directory name.'.format( - module.params['path'])) + module.params['path'])) if action == 'create': for param in CREATE_PARAMS: @@ -643,7 +643,7 @@ def main(): if action == 'compare': written_file = write_on_file(action_results, module.params['comparison_results_file'], - module) + module) result['updates'] = [] else: if action_results: diff --git a/lib/ansible/modules/network/nxos/nxos_snmp_community.py b/lib/ansible/modules/network/nxos/nxos_snmp_community.py index 419a8ea9f7..c1c45662f5 100644 --- a/lib/ansible/modules/network/nxos/nxos_snmp_community.py +++ b/lib/ansible/modules/network/nxos/nxos_snmp_community.py @@ -429,11 +429,11 @@ def config_snmp_community(delta, community): def main(): argument_spec = dict( - community=dict(required=True, type='str'), - access=dict(choices=['ro', 'rw']), - group=dict(type='str'), - acl=dict(type='str'), - state=dict(choices=['absent', 'present'], default='present'), + community=dict(required=True, type='str'), + access=dict(choices=['ro', 'rw']), + group=dict(type='str'), + acl=dict(type='str'), + state=dict(choices=['absent', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, required_one_of=[['access', 'group']], diff --git a/lib/ansible/modules/network/nxos/nxos_snmp_contact.py b/lib/ansible/modules/network/nxos/nxos_snmp_contact.py index b5b97da92c..f5618f3e93 100644 --- a/lib/ansible/modules/network/nxos/nxos_snmp_contact.py +++ b/lib/ansible/modules/network/nxos/nxos_snmp_contact.py @@ -353,8 +353,8 @@ def get_snmp_contact(module): def main(): argument_spec = dict( - contact=dict(required=True, type='str'), - state=dict(choices=['absent', 'present'], + contact=dict(required=True, type='str'), + state=dict(choices=['absent', 'present'], default='present') ) module = get_network_module(argument_spec=argument_spec, diff --git a/lib/ansible/modules/network/nxos/nxos_snmp_host.py b/lib/ansible/modules/network/nxos/nxos_snmp_host.py index 16afb22c01..740bb69f7f 100644 --- a/lib/ansible/modules/network/nxos/nxos_snmp_host.py +++ b/lib/ansible/modules/network/nxos/nxos_snmp_host.py @@ -529,16 +529,16 @@ def flatten_list(command_lists): def main(): argument_spec = dict( - snmp_host=dict(required=True, type='str'), - community=dict(type='str'), - udp=dict(type='str'), - version=dict(choices=['v2c', 'v3'], default='v2c'), - src_intf=dict(type='str'), - v3=dict(choices=['noauth', 'auth', 'priv']), - vrf_filter=dict(type='str'), - vrf=dict(type='str'), - snmp_type=dict(choices=['trap', 'inform'], default='trap'), - state=dict(choices=['absent', 'present'], default='present'), + snmp_host=dict(required=True, type='str'), + community=dict(type='str'), + udp=dict(type='str'), + version=dict(choices=['v2c', 'v3'], default='v2c'), + src_intf=dict(type='str'), + v3=dict(choices=['noauth', 'auth', 'priv']), + vrf_filter=dict(type='str'), + vrf=dict(type='str'), + snmp_type=dict(choices=['trap', 'inform'], default='trap'), + state=dict(choices=['absent', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -586,16 +586,16 @@ def main(): existing['vrf_filter'] = vrf_filter args = dict( - community=community, - snmp_host=snmp_host, - udp=udp, - version=version, - src_intf=src_intf, - vrf_filter=vrf_filter, - v3=v3, - vrf=vrf, - snmp_type=snmp_type - ) + community=community, + snmp_host=snmp_host, + udp=udp, + version=version, + src_intf=src_intf, + vrf_filter=vrf_filter, + v3=v3, + vrf=vrf, + snmp_type=snmp_type + ) proposed = dict((k, v) for k, v in args.items() if v is not None) diff --git a/lib/ansible/modules/network/nxos/nxos_snmp_location.py b/lib/ansible/modules/network/nxos/nxos_snmp_location.py index 193e6afb1f..dc7adb174f 100644 --- a/lib/ansible/modules/network/nxos/nxos_snmp_location.py +++ b/lib/ansible/modules/network/nxos/nxos_snmp_location.py @@ -372,8 +372,8 @@ def get_snmp_location(module): def main(): argument_spec = dict( - location=dict(required=True, type='str'), - state=dict(choices=['absent', 'present'], + location=dict(required=True, type='str'), + state=dict(choices=['absent', 'present'], default='present') ) module = get_network_module(argument_spec=argument_spec, diff --git a/lib/ansible/modules/network/nxos/nxos_snmp_traps.py b/lib/ansible/modules/network/nxos/nxos_snmp_traps.py index cbc7a501be..f494efbcf3 100644 --- a/lib/ansible/modules/network/nxos/nxos_snmp_traps.py +++ b/lib/ansible/modules/network/nxos/nxos_snmp_traps.py @@ -453,8 +453,8 @@ def get_trap_commands(group, state, existing, module): def main(): argument_spec = dict( - state=dict(choices=['enabled', 'disabled'], default='enabled'), - group=dict(choices=['aaa', 'bridge', 'callhome', 'cfs', 'config', + state=dict(choices=['enabled', 'disabled'], default='enabled'), + group=dict(choices=['aaa', 'bridge', 'callhome', 'cfs', 'config', 'entity', 'feature-control', 'hsrp', 'license', 'link', 'lldp', 'ospf', 'pim', 'rf', 'rmon', 'snmp', 'storm-control', 'stpx', diff --git a/lib/ansible/modules/network/nxos/nxos_snmp_user.py b/lib/ansible/modules/network/nxos/nxos_snmp_user.py index c2c4ccd91a..aa7b100b15 100644 --- a/lib/ansible/modules/network/nxos/nxos_snmp_user.py +++ b/lib/ansible/modules/network/nxos/nxos_snmp_user.py @@ -454,13 +454,13 @@ def config_snmp_user(proposed, user, reset, new): def main(): argument_spec = dict( - user=dict(required=True, type='str'), - group=dict(type='str', required=True), - pwd=dict(type='str'), - privacy=dict(type='str'), - authentication=dict(choices=['md5', 'sha']), - encrypt=dict(type='bool'), - state=dict(choices=['absent', 'present'], default='present'), + user=dict(required=True, type='str'), + group=dict(type='str', required=True), + pwd=dict(type='str'), + privacy=dict(type='str'), + authentication=dict(choices=['md5', 'sha']), + encrypt=dict(type='bool'), + state=dict(choices=['absent', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, required_together=[['authentication', 'pwd'], @@ -522,7 +522,7 @@ def main(): proposed['encrypt'] = 'aes-128' delta = dict( - set(proposed.items()).difference(existing.items())) + set(proposed.items()).difference(existing.items())) if delta.get('pwd'): delta['authentication'] = authentication diff --git a/lib/ansible/modules/network/nxos/nxos_udld.py b/lib/ansible/modules/network/nxos/nxos_udld.py index 958490e7a5..e1d1cba02d 100644 --- a/lib/ansible/modules/network/nxos/nxos_udld.py +++ b/lib/ansible/modules/network/nxos/nxos_udld.py @@ -430,10 +430,10 @@ def get_udld_global(module): def main(): argument_spec = dict( - aggressive=dict(required=False, choices=['enabled', 'disabled']), - msg_time=dict(required=False, type='str'), - reset=dict(required=False, type='bool'), - state=dict(choices=['absent', 'present'], default='present'), + aggressive=dict(required=False, choices=['enabled', 'disabled']), + msg_time=dict(required=False, type='str'), + reset=dict(required=False, type='bool'), + state=dict(choices=['absent', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, required_one_of=[['aggressive', 'msg_time', 'reset']], diff --git a/lib/ansible/modules/network/nxos/nxos_udld_interface.py b/lib/ansible/modules/network/nxos/nxos_udld_interface.py index e36df50bfb..ecf90e9ae6 100644 --- a/lib/ansible/modules/network/nxos/nxos_udld_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_udld_interface.py @@ -461,10 +461,10 @@ def get_commands_remove_udld_interface(delta, interface, module, existing): def main(): argument_spec = dict( - mode=dict(choices=['enabled', 'disabled', 'aggressive'], + mode=dict(choices=['enabled', 'disabled', 'aggressive'], required=True), - interface=dict(type='str', required=True), - state=dict(choices=['absent', 'present'], default='present'), + interface=dict(type='str', required=True), + state=dict(choices=['absent', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_vlan.py b/lib/ansible/modules/network/nxos/nxos_vlan.py index f0413dd025..69579e7023 100644 --- a/lib/ansible/modules/network/nxos/nxos_vlan.py +++ b/lib/ansible/modules/network/nxos/nxos_vlan.py @@ -555,17 +555,17 @@ def execute_show_command(command, module, command_type='cli_show'): def main(): argument_spec = dict( - vlan_id=dict(required=False, type='str'), - vlan_range=dict(required=False), - name=dict(required=False), - vlan_state=dict(choices=['active', 'suspend'], required=False), - mapped_vni=dict(required=False, type='str'), - state=dict(choices=['present', 'absent'], default='present', + vlan_id=dict(required=False, type='str'), + vlan_range=dict(required=False), + name=dict(required=False), + vlan_state=dict(choices=['active', 'suspend'], required=False), + mapped_vni=dict(required=False, type='str'), + state=dict(choices=['present', 'absent'], default='present', required=False), - admin_state=dict(choices=['up', 'down'], required=False), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + admin_state=dict(choices=['up', 'down'], required=False), + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, mutually_exclusive=[['vlan_range', 'name'], diff --git a/lib/ansible/modules/network/nxos/nxos_vpc.py b/lib/ansible/modules/network/nxos/nxos_vpc.py index db78dd0a7f..18f1fc254a 100644 --- a/lib/ansible/modules/network/nxos/nxos_vpc.py +++ b/lib/ansible/modules/network/nxos/nxos_vpc.py @@ -436,7 +436,7 @@ def get_vpc(module): body = execute_show_command(command, module)[0] domain = str(body['vpc-domain-id']) auto_recovery = get_autorecovery(str( - body['vpc-auto-recovery-status'])) + body['vpc-auto-recovery-status'])) if domain != 'not configured': delay_restore = None @@ -563,19 +563,19 @@ def get_commands_to_remove_vpc_interface(portchannel, config_value): def main(): argument_spec = dict( - domain=dict(required=True, type='str'), - role_priority=dict(required=False, type='str'), - system_priority=dict(required=False, type='str'), - pkl_src=dict(required=False), - pkl_dest=dict(required=False), - pkl_vrf=dict(required=False, default='management'), - peer_gw=dict(required=True, type='bool'), - auto_recovery=dict(required=True, type='bool'), - delay_restore=dict(required=False, type='str'), - state=dict(choices=['absent', 'present'], default='present'), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + domain=dict(required=True, type='str'), + role_priority=dict(required=False, type='str'), + system_priority=dict(required=False, type='str'), + pkl_src=dict(required=False), + pkl_dest=dict(required=False), + pkl_vrf=dict(required=False, default='management'), + peer_gw=dict(required=True, type='bool'), + auto_recovery=dict(required=True, type='bool'), + delay_restore=dict(required=False, type='str'), + state=dict(choices=['absent', 'present'], default='present'), + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_vpc_interface.py b/lib/ansible/modules/network/nxos/nxos_vpc_interface.py index 85b944f178..a5e31ae60b 100644 --- a/lib/ansible/modules/network/nxos/nxos_vpc_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_vpc_interface.py @@ -477,13 +477,13 @@ def get_commands_to_config_vpc_interface(portchannel, delta, config_value, exist def main(): argument_spec = dict( - portchannel=dict(required=True, type='str'), - vpc=dict(required=False, type='str'), - peer_link=dict(required=False, type='bool'), - state=dict(choices=['absent', 'present'], default='present'), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + portchannel=dict(required=True, type='str'), + vpc=dict(required=False, type='str'), + peer_link=dict(required=False, type='bool'), + state=dict(choices=['absent', 'present'], default='present'), + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, mutually_exclusive=[['vpc', 'peer_link']], @@ -534,7 +534,7 @@ def main(): module.fail_json(msg="A peer link already exists on" " the device. Remove it first", current_peer_link='Po{0}'.format( - active_peer_link)) + active_peer_link)) config_value = 'peer-link' diff --git a/lib/ansible/modules/network/nxos/nxos_vrf.py b/lib/ansible/modules/network/nxos/nxos_vrf.py index 03301fe252..574a51d4b5 100644 --- a/lib/ansible/modules/network/nxos/nxos_vrf.py +++ b/lib/ansible/modules/network/nxos/nxos_vrf.py @@ -445,17 +445,17 @@ def get_vrf(vrf, module): def main(): argument_spec = dict( - vrf=dict(required=True), - description=dict(default=None, required=False), - vni=dict(required=False, type='str'), - rd=dict(required=False, type='str'), - admin_state=dict(default='up', choices=['up', 'down'], + vrf=dict(required=True), + description=dict(default=None, required=False), + vni=dict(required=False, type='str'), + rd=dict(required=False, type='str'), + admin_state=dict(default='up', choices=['up', 'down'], required=False), - state=dict(default='present', choices=['present', 'absent'], + state=dict(default='present', choices=['present', 'absent'], required=False), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_vrf_af.py b/lib/ansible/modules/network/nxos/nxos_vrf_af.py index 1beca09ec8..086eef1bfc 100644 --- a/lib/ansible/modules/network/nxos/nxos_vrf_af.py +++ b/lib/ansible/modules/network/nxos/nxos_vrf_af.py @@ -367,16 +367,16 @@ def state_absent(module, existing, proposed, candidate): def main(): argument_spec = dict( - vrf=dict(required=True, type='str'), - safi=dict(required=True, type='str', choices=['unicast','multicast']), - afi=dict(required=True, type='str', choices=['ipv4','ipv6']), - route_target_both_auto_evpn=dict(required=False, type='bool'), - m_facts=dict(required=False, default=False, type='bool'), - state=dict(choices=['present', 'absent'], default='present', + vrf=dict(required=True, type='str'), + safi=dict(required=True, type='str', choices=['unicast','multicast']), + afi=dict(required=True, type='str', choices=['ipv4','ipv6']), + route_target_both_auto_evpn=dict(required=False, type='bool'), + m_facts=dict(required=False, default=False, type='bool'), + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -384,11 +384,11 @@ def main(): state = module.params['state'] args = [ - 'vrf', - 'safi', - 'afi', - 'route_target_both_auto_evpn' - ] + 'vrf', + 'safi', + 'afi', + 'route_target_both_auto_evpn' + ] existing = invoke('get_existing', module, args) end_state = existing diff --git a/lib/ansible/modules/network/nxos/nxos_vrf_interface.py b/lib/ansible/modules/network/nxos/nxos_vrf_interface.py index 66353ee04f..95e509393a 100644 --- a/lib/ansible/modules/network/nxos/nxos_vrf_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_vrf_interface.py @@ -418,13 +418,13 @@ def is_default(interface, module): def main(): argument_spec = dict( - vrf=dict(required=True), - interface=dict(type='str', required=True), - state=dict(default='present', choices=['present', 'absent'], + vrf=dict(required=True), + interface=dict(type='str', required=True), + state=dict(default='present', choices=['present', 'absent'], required=False), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_vrrp.py b/lib/ansible/modules/network/nxos/nxos_vrrp.py index 9a560bd794..5fa1c99b25 100644 --- a/lib/ansible/modules/network/nxos/nxos_vrrp.py +++ b/lib/ansible/modules/network/nxos/nxos_vrrp.py @@ -572,20 +572,20 @@ def validate_params(param, module): def main(): argument_spec = dict( - group=dict(required=True, type='str'), - interface=dict(required=True), - priority=dict(required=False, type='str'), - preempt=dict(required=False, type='bool'), - vip=dict(required=False, type='str'), - admin_state=dict(required=False, type='str', + group=dict(required=True, type='str'), + interface=dict(required=True), + priority=dict(required=False, type='str'), + preempt=dict(required=False, type='bool'), + vip=dict(required=False, type='str'), + admin_state=dict(required=False, type='str', choices=['shutdown', 'no shutdown'], default='no shutdown'), - authentication=dict(required=False, type='str'), - state=dict(choices=['absent', 'present'], + authentication=dict(required=False, type='str'), + state=dict(choices=['absent', 'present'], required=False, default='present'), - include_defaults=dict(default=False), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=False), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_vtp_domain.py b/lib/ansible/modules/network/nxos/nxos_vtp_domain.py index 61f28768b0..f364b266bc 100644 --- a/lib/ansible/modules/network/nxos/nxos_vtp_domain.py +++ b/lib/ansible/modules/network/nxos/nxos_vtp_domain.py @@ -339,7 +339,7 @@ def get_vtp_config(module): command = 'show vtp status' body = execute_show_command( - command, module, command_type='cli_show_ascii')[0] + command, module, command_type='cli_show_ascii')[0] vtp_parsed = {} if body: @@ -378,7 +378,7 @@ def get_vtp_password(module): def main(): argument_spec = dict( - domain=dict(type='str', required=True), + domain=dict(type='str', required=True), ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_vtp_password.py b/lib/ansible/modules/network/nxos/nxos_vtp_password.py index 69f9d6f852..c7ae9e314a 100644 --- a/lib/ansible/modules/network/nxos/nxos_vtp_password.py +++ b/lib/ansible/modules/network/nxos/nxos_vtp_password.py @@ -369,7 +369,7 @@ def get_vtp_config(module): command = 'show vtp status' body = execute_show_command( - command, module, command_type='cli_show_ascii')[0] + command, module, command_type='cli_show_ascii')[0] vtp_parsed = {} if body: @@ -408,8 +408,8 @@ def get_vtp_password(module): def main(): argument_spec = dict( - vtp_password=dict(type='str', no_log=True), - state=dict(choices=['absent', 'present'], + vtp_password=dict(type='str', no_log=True), + state=dict(choices=['absent', 'present'], default='present'), ) module = get_network_module(argument_spec=argument_spec, diff --git a/lib/ansible/modules/network/nxos/nxos_vtp_version.py b/lib/ansible/modules/network/nxos/nxos_vtp_version.py index 5661f45084..2cc1f5f923 100644 --- a/lib/ansible/modules/network/nxos/nxos_vtp_version.py +++ b/lib/ansible/modules/network/nxos/nxos_vtp_version.py @@ -334,7 +334,7 @@ def get_vtp_config(module): command = 'show vtp status' body = execute_show_command( - command, module, command_type='cli_show_ascii')[0] + command, module, command_type='cli_show_ascii')[0] vtp_parsed = {} if body: @@ -373,7 +373,7 @@ def get_vtp_password(module): def main(): argument_spec = dict( - version=dict(type='str', choices=['1', '2'], required=True), + version=dict(type='str', choices=['1', '2'], required=True), ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) diff --git a/lib/ansible/modules/network/nxos/nxos_vxlan_vtep.py b/lib/ansible/modules/network/nxos/nxos_vxlan_vtep.py index 835c072f7c..96d3513ac0 100644 --- a/lib/ansible/modules/network/nxos/nxos_vxlan_vtep.py +++ b/lib/ansible/modules/network/nxos/nxos_vxlan_vtep.py @@ -445,18 +445,18 @@ def state_absent(module, existing, proposed, candidate): def main(): argument_spec = dict( - interface=dict(required=True, type='str'), - description=dict(required=False, type='str'), - host_reachability=dict(required=False, type='bool'), - shutdown=dict(required=False, type='bool'), - source_interface=dict(required=False, type='str'), - source_interface_hold_down_time=dict(required=False, type='str'), - m_facts=dict(required=False, default=False, type='bool'), - state=dict(choices=['present', 'absent'], default='present', + interface=dict(required=True, type='str'), + description=dict(required=False, type='str'), + host_reachability=dict(required=False, type='bool'), + shutdown=dict(required=False, type='bool'), + source_interface=dict(required=False, type='str'), + source_interface_hold_down_time=dict(required=False, type='str'), + m_facts=dict(required=False, default=False, type='bool'), + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -465,13 +465,13 @@ def main(): interface = module.params['interface'].lower() args = [ - 'interface', - 'description', - 'host_reachability', - 'shutdown', - 'source_interface', - 'source_interface_hold_down_time' - ] + 'interface', + 'description', + 'host_reachability', + 'shutdown', + 'source_interface', + 'source_interface_hold_down_time' + ] existing = invoke('get_existing', module, args) end_state = existing diff --git a/lib/ansible/modules/network/nxos/nxos_vxlan_vtep_vni.py b/lib/ansible/modules/network/nxos/nxos_vxlan_vtep_vni.py index 38ffffdbd7..cfdf7ea364 100644 --- a/lib/ansible/modules/network/nxos/nxos_vxlan_vtep_vni.py +++ b/lib/ansible/modules/network/nxos/nxos_vxlan_vtep_vni.py @@ -378,7 +378,7 @@ def get_existing(module, args): if 'member vni {0} associate-vrf'.format(module.params['vni']) in temp_config: parents.append('member vni {0} associate-vrf'.format( - module.params['vni'])) + module.params['vni'])) config = netcfg.get_section(parents) elif "member vni {0}".format(module.params['vni']) in temp_config: parents.append('member vni {0}'.format(module.params['vni'])) @@ -473,7 +473,7 @@ def state_present(module, existing, proposed, candidate): def state_absent(module, existing, proposed, candidate): if existing['assoc_vrf']: commands = ['no member vni {0} associate-vrf'.format( - module.params['vni'])] + module.params['vni'])] else: commands = ['no member vni {0}'.format(module.params['vni'])] parents = ['interface {0}'.format(module.params['interface'])] @@ -482,19 +482,19 @@ def state_absent(module, existing, proposed, candidate): def main(): argument_spec = dict( - interface=dict(required=True, type='str'), - vni=dict(required=True, type='str'), - assoc_vrf=dict(required=False, type='bool'), - multicast_group=dict(required=False, type='str'), - peer_list=dict(required=False, type='list'), - suppress_arp=dict(required=False, type='bool'), - ingress_replication=dict(required=False, type='str', + interface=dict(required=True, type='str'), + vni=dict(required=True, type='str'), + assoc_vrf=dict(required=False, type='bool'), + multicast_group=dict(required=False, type='str'), + peer_list=dict(required=False, type='list'), + suppress_arp=dict(required=False, type='bool'), + ingress_replication=dict(required=False, type='str', choices=['bgp', 'static', 'default']), - state=dict(choices=['present', 'absent'], default='present', + state=dict(choices=['present', 'absent'], default='present', required=False), - include_defaults=dict(default=True), - config=dict(), - save=dict(type='bool', default=False) + include_defaults=dict(default=True), + config=dict(), + save=dict(type='bool', default=False) ) module = get_network_module(argument_spec=argument_spec, supports_check_mode=True) @@ -521,14 +521,14 @@ def main(): state = module.params['state'] args = [ - 'assoc_vrf', - 'interface', - 'vni', - 'ingress_replication', - 'multicast_group', - 'peer_list', - 'suppress_arp' - ] + 'assoc_vrf', + 'interface', + 'vni', + 'ingress_replication', + 'multicast_group', + 'peer_list', + 'suppress_arp' + ] existing, interface_exist = invoke('get_existing', module, args) end_state = existing @@ -557,7 +557,7 @@ def main(): existing['vni'] != module.params['vni']): module.fail_json(msg="ERROR: VNI delete failed: Could not find" " vni node for {0}".format( - module.params['vni']), + module.params['vni']), existing_vni=existing['vni']) else: candidate = CustomNetworkConfig(indent=3) diff --git a/lib/ansible/modules/network/snmp_facts.py b/lib/ansible/modules/network/snmp_facts.py index 9fab434f2a..e28b733c3f 100644 --- a/lib/ansible/modules/network/snmp_facts.py +++ b/lib/ansible/modules/network/snmp_facts.py @@ -156,10 +156,10 @@ def decode_mac(hexstring): def lookup_adminstatus(int_adminstatus): adminstatus_options = { - 1: 'up', - 2: 'down', - 3: 'testing' - } + 1: 'up', + 2: 'down', + 3: 'testing' + } if int_adminstatus in adminstatus_options: return adminstatus_options[int_adminstatus] else: @@ -167,14 +167,14 @@ def lookup_adminstatus(int_adminstatus): def lookup_operstatus(int_operstatus): operstatus_options = { - 1: 'up', - 2: 'down', - 3: 'testing', - 4: 'unknown', - 5: 'dormant', - 6: 'notPresent', - 7: 'lowerLayerDown' - } + 1: 'up', + 2: 'down', + 3: 'testing', + 4: 'unknown', + 5: 'dormant', + 6: 'notPresent', + 7: 'lowerLayerDown' + } if int_operstatus in operstatus_options: return operstatus_options[int_operstatus] else: @@ -354,9 +354,9 @@ def main(): for ipv4_network in ipv4_networks: current_interface = ipv4_networks[ipv4_network]['interface'] current_network = { - 'address': ipv4_networks[ipv4_network]['address'], - 'netmask': ipv4_networks[ipv4_network]['netmask'] - } + 'address': ipv4_networks[ipv4_network]['address'], + 'netmask': ipv4_networks[ipv4_network]['netmask'] + } if not current_interface in interface_to_ipv4: interface_to_ipv4[current_interface] = [] interface_to_ipv4[current_interface].append(current_network) diff --git a/lib/ansible/modules/notification/sendgrid.py b/lib/ansible/modules/notification/sendgrid.py index 4b5b9b1617..63da5a7fcd 100644 --- a/lib/ansible/modules/notification/sendgrid.py +++ b/lib/ansible/modules/notification/sendgrid.py @@ -230,9 +230,9 @@ def main(): ), supports_check_mode=True, mutually_exclusive = [ - ['api_key', 'password'], - ['api_key', 'username'] - ], + ['api_key', 'password'], + ['api_key', 'username'] + ], required_together = [['username', 'password']], ) diff --git a/lib/ansible/modules/packaging/language/bundler.py b/lib/ansible/modules/packaging/language/bundler.py index e7950b0854..deef30b9fe 100644 --- a/lib/ansible/modules/packaging/language/bundler.py +++ b/lib/ansible/modules/packaging/language/bundler.py @@ -152,19 +152,19 @@ def get_bundler_executable(module): def main(): module = AnsibleModule( argument_spec=dict( - executable=dict(default=None, required=False), - state=dict(default='present', required=False, choices=['present', 'latest']), - chdir=dict(default=None, required=False, type='path'), - exclude_groups=dict(default=None, required=False, type='list'), - clean=dict(default=False, required=False, type='bool'), - gemfile=dict(default=None, required=False, type='path'), - local=dict(default=False, required=False, type='bool'), - deployment_mode=dict(default=False, required=False, type='bool'), - user_install=dict(default=True, required=False, type='bool'), - gem_path=dict(default=None, required=False, type='path'), - binstub_directory=dict(default=None, required=False, type='path'), - extra_args=dict(default=None, required=False), - ), + executable=dict(default=None, required=False), + state=dict(default='present', required=False, choices=['present', 'latest']), + chdir=dict(default=None, required=False, type='path'), + exclude_groups=dict(default=None, required=False, type='list'), + clean=dict(default=False, required=False, type='bool'), + gemfile=dict(default=None, required=False, type='path'), + local=dict(default=False, required=False, type='bool'), + deployment_mode=dict(default=False, required=False, type='bool'), + user_install=dict(default=True, required=False, type='bool'), + gem_path=dict(default=None, required=False, type='path'), + binstub_directory=dict(default=None, required=False, type='path'), + extra_args=dict(default=None, required=False), + ), supports_check_mode=True ) diff --git a/lib/ansible/modules/packaging/os/apt.py b/lib/ansible/modules/packaging/os/apt.py index 5afbfde6e6..15d499bb69 100644 --- a/lib/ansible/modules/packaging/os/apt.py +++ b/lib/ansible/modules/packaging/os/apt.py @@ -239,14 +239,14 @@ from ansible.module_utils.urls import fetch_url # APT related constants APT_ENV_VARS = dict( - DEBIAN_FRONTEND = 'noninteractive', - DEBIAN_PRIORITY = 'critical', - # We screenscrape apt-get and aptitude output for information so we need - # to make sure we use the C locale when running commands - LANG = 'C', - LC_ALL = 'C', - LC_MESSAGES = 'C', - LC_CTYPE = 'C', + DEBIAN_FRONTEND = 'noninteractive', + DEBIAN_PRIORITY = 'critical', + # We screenscrape apt-get and aptitude output for information so we need + # to make sure we use the C locale when running commands + LANG = 'C', + LC_ALL = 'C', + LC_MESSAGES = 'C', + LC_CTYPE = 'C', ) DPKG_OPTIONS = 'force-confdef,force-confold' diff --git a/lib/ansible/modules/packaging/os/apt_rpm.py b/lib/ansible/modules/packaging/os/apt_rpm.py index f800073ea4..4091c5a2c3 100755 --- a/lib/ansible/modules/packaging/os/apt_rpm.py +++ b/lib/ansible/modules/packaging/os/apt_rpm.py @@ -158,10 +158,10 @@ def install_packages(module, pkgspec): def main(): module = AnsibleModule( - argument_spec = dict( - state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']), - update_cache = dict(default=False, aliases=['update-cache'], type='bool'), - package = dict(aliases=['pkg', 'name'], required=True))) + argument_spec = dict( + state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']), + update_cache = dict(default=False, aliases=['update-cache'], type='bool'), + package = dict(aliases=['pkg', 'name'], required=True))) if not os.path.exists(APT_PATH) or not os.path.exists(RPM_PATH): diff --git a/lib/ansible/modules/packaging/os/pkgin.py b/lib/ansible/modules/packaging/os/pkgin.py index a66c11fe4a..4a51c079eb 100755 --- a/lib/ansible/modules/packaging/os/pkgin.py +++ b/lib/ansible/modules/packaging/os/pkgin.py @@ -336,16 +336,16 @@ def clean_cache(module): def main(): module = AnsibleModule( - argument_spec = dict( - state = dict(default="present", choices=["present","absent"]), - name = dict(aliases=["pkg"], type='list'), - update_cache = dict(default='no', type='bool'), - upgrade = dict(default='no', type='bool'), - full_upgrade = dict(default='no', type='bool'), - clean = dict(default='no', type='bool'), - force = dict(default='no', type='bool')), - required_one_of = [['name', 'update_cache', 'upgrade', 'full_upgrade', 'clean']], - supports_check_mode = True) + argument_spec = dict( + state = dict(default="present", choices=["present","absent"]), + name = dict(aliases=["pkg"], type='list'), + update_cache = dict(default='no', type='bool'), + upgrade = dict(default='no', type='bool'), + full_upgrade = dict(default='no', type='bool'), + clean = dict(default='no', type='bool'), + force = dict(default='no', type='bool')), + required_one_of = [['name', 'update_cache', 'upgrade', 'full_upgrade', 'clean']], + supports_check_mode = True) global PKGIN_PATH PKGIN_PATH = module.get_bin_path('pkgin', True, ['/opt/local/bin']) diff --git a/lib/ansible/modules/packaging/os/pkgng.py b/lib/ansible/modules/packaging/os/pkgng.py index 4b6eac739c..cb31cf3d84 100644 --- a/lib/ansible/modules/packaging/os/pkgng.py +++ b/lib/ansible/modules/packaging/os/pkgng.py @@ -305,17 +305,17 @@ def autoremove_packages(module, pkgng_path, dir_arg): def main(): module = AnsibleModule( - argument_spec = dict( - state = dict(default="present", choices=["present","absent"], required=False), - name = dict(aliases=["pkg"], required=True, type='list'), - cached = dict(default=False, type='bool'), - annotation = dict(default="", required=False), - pkgsite = dict(default="", required=False), - rootdir = dict(default="", required=False, type='path'), - chroot = dict(default="", required=False, type='path'), - autoremove = dict(default=False, type='bool')), - supports_check_mode = True, - mutually_exclusive =[["rootdir", "chroot"]]) + argument_spec = dict( + state = dict(default="present", choices=["present","absent"], required=False), + name = dict(aliases=["pkg"], required=True, type='list'), + cached = dict(default=False, type='bool'), + annotation = dict(default="", required=False), + pkgsite = dict(default="", required=False), + rootdir = dict(default="", required=False, type='path'), + chroot = dict(default="", required=False, type='path'), + autoremove = dict(default=False, type='bool')), + supports_check_mode = True, + mutually_exclusive =[["rootdir", "chroot"]]) pkgng_path = module.get_bin_path('pkg', True) diff --git a/lib/ansible/modules/packaging/os/portinstall.py b/lib/ansible/modules/packaging/os/portinstall.py index 3f0e4965e8..b574105834 100644 --- a/lib/ansible/modules/packaging/os/portinstall.py +++ b/lib/ansible/modules/packaging/os/portinstall.py @@ -195,10 +195,10 @@ def install_packages(module, packages, use_packages): def main(): module = AnsibleModule( - argument_spec = dict( - state = dict(default="present", choices=["present","absent"]), - name = dict(aliases=["pkg"], required=True), - use_packages = dict(type='bool', default='yes'))) + argument_spec = dict( + state = dict(default="present", choices=["present","absent"]), + name = dict(aliases=["pkg"], required=True), + use_packages = dict(type='bool', default='yes'))) p = module.params diff --git a/lib/ansible/modules/packaging/os/redhat_subscription.py b/lib/ansible/modules/packaging/os/redhat_subscription.py index c1a4324d7b..d65c29d26b 100644 --- a/lib/ansible/modules/packaging/os/redhat_subscription.py +++ b/lib/ansible/modules/packaging/os/redhat_subscription.py @@ -273,7 +273,7 @@ class Rhsm(RegistrationBase): # Quick version... if False: return os.path.isfile('/etc/pki/consumer/cert.pem') and \ - os.path.isfile('/etc/pki/consumer/key.pem') + os.path.isfile('/etc/pki/consumer/key.pem') args = [SUBMAN_CMD, 'identity'] rc, stdout, stderr = self.module.run_command(args, check_rc=False) @@ -469,26 +469,26 @@ def main(): rhsm = Rhsm(None) module = AnsibleModule( - argument_spec = dict( - state = dict(default='present', choices=['present', 'absent']), - username = dict(default=None, required=False), - password = dict(default=None, required=False, no_log=True), - server_hostname = dict(default=rhsm.config.get_option('server.hostname'), required=False), - server_insecure = dict(default=rhsm.config.get_option('server.insecure'), required=False), - rhsm_baseurl = dict(default=rhsm.config.get_option('rhsm.baseurl'), required=False), - autosubscribe = dict(default=False, type='bool'), - activationkey = dict(default=None, required=False), - org_id = dict(default=None, required=False), - environment = dict(default=None, required=False, type='str'), - pool = dict(default='^$', required=False, type='str'), - consumer_type = dict(default=None, required=False), - consumer_name = dict(default=None, required=False), - consumer_id = dict(default=None, required=False), - force_register = dict(default=False, type='bool'), - ), - required_together = [ ['username', 'password'], ['activationkey', 'org_id'] ], - mutually_exclusive = [ ['username', 'activationkey'] ], - ) + argument_spec = dict( + state = dict(default='present', choices=['present', 'absent']), + username = dict(default=None, required=False), + password = dict(default=None, required=False, no_log=True), + server_hostname = dict(default=rhsm.config.get_option('server.hostname'), required=False), + server_insecure = dict(default=rhsm.config.get_option('server.insecure'), required=False), + rhsm_baseurl = dict(default=rhsm.config.get_option('rhsm.baseurl'), required=False), + autosubscribe = dict(default=False, type='bool'), + activationkey = dict(default=None, required=False), + org_id = dict(default=None, required=False), + environment = dict(default=None, required=False, type='str'), + pool = dict(default='^$', required=False, type='str'), + consumer_type = dict(default=None, required=False), + consumer_name = dict(default=None, required=False), + consumer_id = dict(default=None, required=False), + force_register = dict(default=False, type='bool'), + ), + required_together = [ ['username', 'password'], ['activationkey', 'org_id'] ], + mutually_exclusive = [ ['username', 'activationkey'] ], + ) rhsm.module = module state = module.params['state'] diff --git a/lib/ansible/modules/packaging/os/rhn_channel.py b/lib/ansible/modules/packaging/os/rhn_channel.py index 5f35a3f78a..69993e33ef 100644 --- a/lib/ansible/modules/packaging/os/rhn_channel.py +++ b/lib/ansible/modules/packaging/os/rhn_channel.py @@ -135,7 +135,7 @@ def main(): user = dict(required=True), password = dict(required=True, aliases=['pwd']), ) -# supports_check_mode=True + # supports_check_mode=True ) state = module.params['state'] diff --git a/lib/ansible/modules/packaging/os/rhn_register.py b/lib/ansible/modules/packaging/os/rhn_register.py index c228f0b1b7..ab2431c7ec 100644 --- a/lib/ansible/modules/packaging/os/rhn_register.py +++ b/lib/ansible/modules/packaging/os/rhn_register.py @@ -358,19 +358,19 @@ def main(): rhn = Rhn() module = AnsibleModule( - argument_spec = dict( - state = dict(default='present', choices=['present', 'absent']), - username = dict(default=None, required=False), - password = dict(default=None, required=False, no_log=True), - server_url = dict(default=None, required=False), - activationkey = dict(default=None, required=False, no_log=True), - profilename = dict(default=None, required=False), - sslcacert = dict(default=None, required=False, type='path'), - systemorgid = dict(default=None, required=False), - enable_eus = dict(default=False, type='bool'), - channels = dict(default=[], type='list'), - ) + argument_spec = dict( + state = dict(default='present', choices=['present', 'absent']), + username = dict(default=None, required=False), + password = dict(default=None, required=False, no_log=True), + server_url = dict(default=None, required=False), + activationkey = dict(default=None, required=False, no_log=True), + profilename = dict(default=None, required=False), + sslcacert = dict(default=None, required=False, type='path'), + systemorgid = dict(default=None, required=False), + enable_eus = dict(default=False, type='bool'), + channels = dict(default=[], type='list'), ) + ) if not HAS_UP2DATE_CLIENT: module.fail_json(msg="Unable to import up2date_client. Is 'rhn-client-tools' installed?") diff --git a/lib/ansible/modules/packaging/os/rpm_key.py b/lib/ansible/modules/packaging/os/rpm_key.py index 9cb058c56a..5ab45db9f2 100644 --- a/lib/ansible/modules/packaging/os/rpm_key.py +++ b/lib/ansible/modules/packaging/os/rpm_key.py @@ -200,13 +200,13 @@ class RpmKey: def main(): module = AnsibleModule( - argument_spec = dict( - state=dict(default='present', choices=['present', 'absent'], type='str'), - key=dict(required=True, type='str'), - validate_certs=dict(default='yes', type='bool'), - ), - supports_check_mode=True - ) + argument_spec = dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + key=dict(required=True, type='str'), + validate_certs=dict(default='yes', type='bool'), + ), + supports_check_mode=True + ) RpmKey(module) diff --git a/lib/ansible/modules/packaging/os/urpmi.py b/lib/ansible/modules/packaging/os/urpmi.py index 300bb29570..2dc94267df 100644 --- a/lib/ansible/modules/packaging/os/urpmi.py +++ b/lib/ansible/modules/packaging/os/urpmi.py @@ -183,12 +183,12 @@ def install_packages(module, pkgspec, force=True, no_recommends=True): def main(): module = AnsibleModule( - argument_spec = dict( - state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']), - update_cache = dict(default=False, aliases=['update-cache'], type='bool'), - force = dict(default=True, type='bool'), - no_recommends = dict(default=True, aliases=['no-recommends'], type='bool'), - package = dict(aliases=['pkg', 'name'], required=True))) + argument_spec = dict( + state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']), + update_cache = dict(default=False, aliases=['update-cache'], type='bool'), + force = dict(default=True, type='bool'), + no_recommends = dict(default=True, aliases=['no-recommends'], type='bool'), + package = dict(aliases=['pkg', 'name'], required=True))) if not os.path.exists(URPMI_PATH): diff --git a/lib/ansible/modules/source_control/github_hooks.py b/lib/ansible/modules/source_control/github_hooks.py index 56bf49fdb6..ec14f2bc17 100644 --- a/lib/ansible/modules/source_control/github_hooks.py +++ b/lib/ansible/modules/source_control/github_hooks.py @@ -166,13 +166,13 @@ def _delete(module, hookurl, oauthkey, repo, user, hookid): def main(): module = AnsibleModule( argument_spec=dict( - action=dict(required=True, choices=['list','clean504','cleanall','create']), - hookurl=dict(required=False), - oauthkey=dict(required=True, no_log=True), - repo=dict(required=True), - user=dict(required=True), - validate_certs=dict(default='yes', type='bool'), - content_type=dict(default='json', choices=['json', 'form']), + action=dict(required=True, choices=['list','clean504','cleanall','create']), + hookurl=dict(required=False), + oauthkey=dict(required=True, no_log=True), + repo=dict(required=True), + user=dict(required=True), + validate_certs=dict(default='yes', type='bool'), + content_type=dict(default='json', choices=['json', 'form']), ) ) diff --git a/lib/ansible/modules/system/authorized_key.py b/lib/ansible/modules/system/authorized_key.py index aa2c9d21a4..1800fc2590 100644 --- a/lib/ansible/modules/system/authorized_key.py +++ b/lib/ansible/modules/system/authorized_key.py @@ -639,15 +639,15 @@ def enforce_state(module, params): def main(): module = AnsibleModule( argument_spec = dict( - user = dict(required=True, type='str'), - key = dict(required=True, type='str'), - path = dict(required=False, type='str'), - manage_dir = dict(required=False, type='bool', default=True), - state = dict(default='present', choices=['absent','present']), - key_options = dict(required=False, type='str'), - unique = dict(default=False, type='bool'), - exclusive = dict(default=False, type='bool'), - validate_certs = dict(default=True, type='bool'), + user = dict(required=True, type='str'), + key = dict(required=True, type='str'), + path = dict(required=False, type='str'), + manage_dir = dict(required=False, type='bool', default=True), + state = dict(default='present', choices=['absent','present']), + key_options = dict(required=False, type='str'), + unique = dict(default=False, type='bool'), + exclusive = dict(default=False, type='bool'), + validate_certs = dict(default=True, type='bool'), ), supports_check_mode=True ) diff --git a/lib/ansible/modules/system/cron.py b/lib/ansible/modules/system/cron.py index 764f19362f..8b46bcfd7a 100644 --- a/lib/ansible/modules/system/cron.py +++ b/lib/ansible/modules/system/cron.py @@ -605,9 +605,9 @@ def main(): ), supports_check_mode = True, mutually_exclusive=[ - ['reboot', 'special_time'], - ['insertafter', 'insertbefore'], - ] + ['reboot', 'special_time'], + ['insertafter', 'insertbefore'], + ] ) name = module.params['name'] diff --git a/lib/ansible/modules/system/debconf.py b/lib/ansible/modules/system/debconf.py index 224f2fbcb9..e2d5b83ff3 100644 --- a/lib/ansible/modules/system/debconf.py +++ b/lib/ansible/modules/system/debconf.py @@ -138,11 +138,11 @@ def main(): module = AnsibleModule( argument_spec = dict( - name = dict(required=True, aliases=['pkg'], type='str'), - question = dict(required=False, aliases=['setting', 'selection'], type='str'), - vtype = dict(required=False, type='str', choices=['string', 'password', 'boolean', 'select', 'multiselect', 'note', 'error', 'title', 'text', 'seen']), - value = dict(required=False, type='str', aliases=['answer']), - unseen = dict(required=False, type='bool'), + name = dict(required=True, aliases=['pkg'], type='str'), + question = dict(required=False, aliases=['setting', 'selection'], type='str'), + vtype = dict(required=False, type='str', choices=['string', 'password', 'boolean', 'select', 'multiselect', 'note', 'error', 'title', 'text', 'seen']), + value = dict(required=False, type='str', aliases=['answer']), + unseen = dict(required=False, type='bool'), ), required_together = ( ['question','vtype', 'value'],), supports_check_mode=True, diff --git a/lib/ansible/modules/system/gconftool2.py b/lib/ansible/modules/system/gconftool2.py index 3bdd65d51c..3c4a919c82 100644 --- a/lib/ansible/modules/system/gconftool2.py +++ b/lib/ansible/modules/system/gconftool2.py @@ -166,21 +166,21 @@ def main(): # Setup the Ansible module module = AnsibleModule( argument_spec=dict( - key=dict(required=True, default=None, type='str'), - value_type=dict(required=False, + key=dict(required=True, default=None, type='str'), + value_type=dict(required=False, choices=['int', 'bool', 'float', 'string'], type='str'), - value=dict(required=False, default=None, + value=dict(required=False, default=None, type='str'), - state=dict(required=True, default=None, + state=dict(required=True, default=None, choices=['present', 'get', 'absent'], type='str'), - direct=dict(required=False, + direct=dict(required=False, default=False, type='bool'), - config_source=dict(required=False, + config_source=dict(required=False, default=None, type='str') - ), + ), supports_check_mode=True ) diff --git a/lib/ansible/modules/system/openwrt_init.py b/lib/ansible/modules/system/openwrt_init.py index e986775672..1e54c2f9ed 100644 --- a/lib/ansible/modules/system/openwrt_init.py +++ b/lib/ansible/modules/system/openwrt_init.py @@ -110,11 +110,11 @@ def main(): # init module = AnsibleModule( argument_spec = dict( - name = dict(required=True, type='str', aliases=['service']), - state = dict(choices=['started', 'stopped', 'restarted', 'reloaded'], type='str'), - enabled = dict(type='bool'), - pattern = dict(required=False, default=None), - ), + name = dict(required=True, type='str', aliases=['service']), + state = dict(choices=['started', 'stopped', 'restarted', 'reloaded'], type='str'), + enabled = dict(type='bool'), + pattern = dict(required=False, default=None), + ), supports_check_mode=True, required_one_of=[['state', 'enabled']], ) diff --git a/lib/ansible/modules/system/sefcontext.py b/lib/ansible/modules/system/sefcontext.py index 5ca1fc4e55..6c9aac929f 100644 --- a/lib/ansible/modules/system/sefcontext.py +++ b/lib/ansible/modules/system/sefcontext.py @@ -117,14 +117,14 @@ if HAVE_SEOBJECT: ### Make backward compatible option_to_file_type_str = dict( - a = 'all files', - b = 'block device', - c = 'character device', - d = 'directory', - f = 'regular file', - l = 'symbolic link', - p = 'named pipe', - s = 'socket file', + a = 'all files', + b = 'block device', + c = 'character device', + d = 'directory', + f = 'regular file', + l = 'symbolic link', + p = 'named pipe', + s = 'socket file', ) def semanage_fcontext_exists(sefcontext, target, ftype): @@ -225,14 +225,14 @@ def semanage_fcontext_delete(module, result, target, ftype, do_reload, sestore=' def main(): module = AnsibleModule( argument_spec = dict( - target = dict(required=True, aliases=['path']), - ftype = dict(required=False, choices=option_to_file_type_str.keys(), default='a'), - setype = dict(required=True), - seuser = dict(required=False, default=None), - selevel = dict(required=False, default=None, aliases=['serange']), - state = dict(required=False, choices=['present', 'absent'], default='present'), - reload = dict(required=False, type='bool', default='yes'), - ), + target = dict(required=True, aliases=['path']), + ftype = dict(required=False, choices=option_to_file_type_str.keys(), default='a'), + setype = dict(required=True), + seuser = dict(required=False, default=None), + selevel = dict(required=False, default=None, aliases=['serange']), + state = dict(required=False, choices=['present', 'absent'], default='present'), + reload = dict(required=False, type='bool', default='yes'), + ), supports_check_mode = True, ) if not HAVE_SELINUX: diff --git a/lib/ansible/modules/system/seport.py b/lib/ansible/modules/system/seport.py index bbd049c030..1fd409981e 100644 --- a/lib/ansible/modules/system/seport.py +++ b/lib/ansible/modules/system/seport.py @@ -266,26 +266,26 @@ def semanage_port_del(module, ports, proto, setype, do_reload, sestore=''): def main(): module = AnsibleModule( argument_spec={ - 'ports': { - 'required': True, + 'ports': { + 'required': True, }, - 'proto': { - 'required': True, - 'choices': ['tcp', 'udp'], + 'proto': { + 'required': True, + 'choices': ['tcp', 'udp'], }, - 'setype': { - 'required': True, + 'setype': { + 'required': True, }, - 'state': { - 'required': True, - 'choices': ['present', 'absent'], + 'state': { + 'required': True, + 'choices': ['present', 'absent'], }, - 'reload': { - 'required': False, - 'type': 'bool', - 'default': 'yes', + 'reload': { + 'required': False, + 'type': 'bool', + 'default': 'yes', }, - }, + }, supports_check_mode=True ) if not HAVE_SELINUX: diff --git a/lib/ansible/modules/system/systemd.py b/lib/ansible/modules/system/systemd.py index 2f93820a1a..704ba19c22 100644 --- a/lib/ansible/modules/system/systemd.py +++ b/lib/ansible/modules/system/systemd.py @@ -259,14 +259,14 @@ def main(): # initialize module = AnsibleModule( argument_spec = dict( - name = dict(required=True, type='str', aliases=['unit', 'service']), - state = dict(choices=[ 'started', 'stopped', 'restarted', 'reloaded'], type='str'), - enabled = dict(type='bool'), - masked = dict(type='bool'), - daemon_reload = dict(type='bool', default=False, aliases=['daemon-reload']), - user = dict(type='bool', default=False), - no_block = dict(type='bool', default=False), - ), + name = dict(required=True, type='str', aliases=['unit', 'service']), + state = dict(choices=[ 'started', 'stopped', 'restarted', 'reloaded'], type='str'), + enabled = dict(type='bool'), + masked = dict(type='bool'), + daemon_reload = dict(type='bool', default=False, aliases=['daemon-reload']), + user = dict(type='bool', default=False), + no_block = dict(type='bool', default=False), + ), supports_check_mode=True, required_one_of=[['state', 'enabled', 'masked', 'daemon_reload']], ) diff --git a/lib/ansible/modules/system/user.py b/lib/ansible/modules/system/user.py index 721c5d57f9..6ce4bad247 100644 --- a/lib/ansible/modules/system/user.py +++ b/lib/ansible/modules/system/user.py @@ -2112,10 +2112,10 @@ class HPUX(User): def main(): ssh_defaults = { - 'bits': 0, - 'type': 'rsa', - 'passphrase': None, - 'comment': 'ansible-generated on %s' % socket.gethostname() + 'bits': 0, + 'type': 'rsa', + 'passphrase': None, + 'comment': 'ansible-generated on %s' % socket.gethostname() } module = AnsibleModule( argument_spec = dict( diff --git a/lib/ansible/modules/utilities/logic/wait_for.py b/lib/ansible/modules/utilities/logic/wait_for.py index 8c234fa343..ee133818dd 100644 --- a/lib/ansible/modules/utilities/logic/wait_for.py +++ b/lib/ansible/modules/utilities/logic/wait_for.py @@ -382,12 +382,12 @@ def _timedelta_total_seconds(timedelta): def get_connection_state_id(state): connection_state_id = { - 'ESTABLISHED': '01', - 'SYN_SENT': '02', - 'SYN_RECV': '03', - 'FIN_WAIT1': '04', - 'FIN_WAIT2': '05', - 'TIME_WAIT': '06', + 'ESTABLISHED': '01', + 'SYN_SENT': '02', + 'SYN_RECV': '03', + 'FIN_WAIT1': '04', + 'FIN_WAIT2': '05', + 'TIME_WAIT': '06', } return connection_state_id[state] diff --git a/lib/ansible/modules/web_infrastructure/apache2_module.py b/lib/ansible/modules/web_infrastructure/apache2_module.py index 6e2519b688..923c42a28e 100644 --- a/lib/ansible/modules/web_infrastructure/apache2_module.py +++ b/lib/ansible/modules/web_infrastructure/apache2_module.py @@ -120,8 +120,8 @@ def _get_ctl_binary(module): return ctl_binary module.fail_json( - msg="Neither of apache2ctl nor apachctl found." - " At least one apache control binary is necessary." + msg="Neither of apache2ctl nor apachctl found." + " At least one apache control binary is necessary." ) def _module_is_enabled(module): diff --git a/lib/ansible/modules/web_infrastructure/taiga_issue.py b/lib/ansible/modules/web_infrastructure/taiga_issue.py index d64f3fa9bc..83470cc4f6 100644 --- a/lib/ansible/modules/web_infrastructure/taiga_issue.py +++ b/lib/ansible/modules/web_infrastructure/taiga_issue.py @@ -193,15 +193,15 @@ def manage_issue(module, taiga_host, project_name, issue_subject, issue_priority severity_id = severity_list[0].id issue = { - "project": project_name, - "subject": issue_subject, - "priority": issue_priority, - "status": issue_status, - "type": issue_type, - "severity": issue_severity, - "description": issue_description, - "tags": issue_tags, - } + "project": project_name, + "subject": issue_subject, + "priority": issue_priority, + "status": issue_status, + "type": issue_type, + "severity": issue_severity, + "description": issue_description, + "tags": issue_tags, + } # An issue is identified by the project_name, the issue_subject and the issue_type matching_issue_list = filter(lambda x: x.subject == issue_subject and x.type == type_id, project.list_issues()) @@ -288,21 +288,21 @@ def main(): state = module.params['state'] return_status, changed, msg, issue_attr_dict = manage_issue( - module, - taiga_host, - project_name, - issue_subject, - issue_priority, - issue_status, - issue_type, - issue_severity, - issue_description, - issue_attachment, - issue_attachment_description, - issue_tags, - state, - check_mode=module.check_mode - ) + module, + taiga_host, + project_name, + issue_subject, + issue_priority, + issue_status, + issue_type, + issue_severity, + issue_description, + issue_attachment, + issue_attachment_description, + issue_tags, + state, + check_mode=module.check_mode + ) if return_status: if len(issue_attr_dict) > 0: module.exit_json(changed=changed, msg=msg, issue=issue_attr_dict) diff --git a/lib/ansible/playbook/block.py b/lib/ansible/playbook/block.py index 71f074da75..2ff5d33b34 100644 --- a/lib/ansible/playbook/block.py +++ b/lib/ansible/playbook/block.py @@ -349,8 +349,8 @@ class Block(Base, Become, Conditional, Taggable): if isinstance(task, Block): tmp_list.append(evaluate_block(task)) elif task.action == 'meta' \ - or (task.action == 'include' and task.evaluate_tags([], play_context.skip_tags, all_vars=all_vars)) \ - or task.evaluate_tags(play_context.only_tags, play_context.skip_tags, all_vars=all_vars): + or (task.action == 'include' and task.evaluate_tags([], play_context.skip_tags, all_vars=all_vars)) \ + or task.evaluate_tags(play_context.only_tags, play_context.skip_tags, all_vars=all_vars): tmp_list.append(task) return tmp_list diff --git a/lib/ansible/playbook/helpers.py b/lib/ansible/playbook/helpers.py index 5e9c0fb81b..6c6e1151a0 100644 --- a/lib/ansible/playbook/helpers.py +++ b/lib/ansible/playbook/helpers.py @@ -133,8 +133,8 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h is_static = t.static else: is_static = C.DEFAULT_TASK_INCLUDES_STATIC or \ - (use_handlers and C.DEFAULT_HANDLER_INCLUDES_STATIC) or \ - (not templar._contains_vars(t.args['_raw_params']) and t.all_parents_static() and not t.loop) + (use_handlers and C.DEFAULT_HANDLER_INCLUDES_STATIC) or \ + (not templar._contains_vars(t.args['_raw_params']) and t.all_parents_static() and not t.loop) if is_static: if t.loop is not None: @@ -179,13 +179,13 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h include_target = templar.template(t.args['_raw_params']) except AnsibleUndefinedVariable: raise AnsibleParserError( - "Error when evaluating variable in include name: %s.\n\n" \ - "When using static includes, ensure that any variables used in their names are defined in vars/vars_files\n" \ - "or extra-vars passed in from the command line. Static includes cannot use variables from inventory\n" \ - "sources like group or host vars." % t.args['_raw_params'], - obj=task_ds, - suppress_extended_error=True, - ) + "Error when evaluating variable in include name: %s.\n\n" \ + "When using static includes, ensure that any variables used in their names are defined in vars/vars_files\n" \ + "or extra-vars passed in from the command line. Static includes cannot use variables from inventory\n" \ + "sources like group or host vars." % t.args['_raw_params'], + obj=task_ds, + suppress_extended_error=True, + ) if t._role: include_file = loader.path_dwim_relative(t._role._role_path, subdir, include_target) else: @@ -269,13 +269,13 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h elif 'include_role' in task_ds: ir = IncludeRole.load( - task_ds, - block=block, - role=role, - task_include=None, - variable_manager=variable_manager, - loader=loader - ) + task_ds, + block=block, + role=role, + task_include=None, + variable_manager=variable_manager, + loader=loader + ) # 1. the user has set the 'static' option to false or true # 2. one of the appropriate config options was set diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index fa4fa4f54e..65c40b44da 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -51,41 +51,41 @@ except ImportError: # in variable names. MAGIC_VARIABLE_MAPPING = dict( - connection = ('ansible_connection',), - remote_addr = ('ansible_ssh_host', 'ansible_host'), - remote_user = ('ansible_ssh_user', 'ansible_user'), - port = ('ansible_ssh_port', 'ansible_port'), - ssh_executable = ('ansible_ssh_executable',), - accelerate_port = ('ansible_accelerate_port',), - password = ('ansible_ssh_pass', 'ansible_password'), - private_key_file = ('ansible_ssh_private_key_file', 'ansible_private_key_file'), - pipelining = ('ansible_ssh_pipelining', 'ansible_pipelining'), - shell = ('ansible_shell_type',), - network_os = ('ansible_network_os',), - become = ('ansible_become',), - become_method = ('ansible_become_method',), - become_user = ('ansible_become_user',), - become_pass = ('ansible_become_password','ansible_become_pass'), - become_exe = ('ansible_become_exe',), - become_flags = ('ansible_become_flags',), - ssh_common_args = ('ansible_ssh_common_args',), - docker_extra_args= ('ansible_docker_extra_args',), - sftp_extra_args = ('ansible_sftp_extra_args',), - scp_extra_args = ('ansible_scp_extra_args',), - ssh_extra_args = ('ansible_ssh_extra_args',), - ssh_transfer_method = ('ansible_ssh_transfer_method',), - sudo = ('ansible_sudo',), - sudo_user = ('ansible_sudo_user',), - sudo_pass = ('ansible_sudo_password', 'ansible_sudo_pass'), - sudo_exe = ('ansible_sudo_exe',), - sudo_flags = ('ansible_sudo_flags',), - su = ('ansible_su',), - su_user = ('ansible_su_user',), - su_pass = ('ansible_su_password', 'ansible_su_pass'), - su_exe = ('ansible_su_exe',), - su_flags = ('ansible_su_flags',), - executable = ('ansible_shell_executable',), - module_compression = ('ansible_module_compression',), + connection = ('ansible_connection',), + remote_addr = ('ansible_ssh_host', 'ansible_host'), + remote_user = ('ansible_ssh_user', 'ansible_user'), + port = ('ansible_ssh_port', 'ansible_port'), + ssh_executable = ('ansible_ssh_executable',), + accelerate_port = ('ansible_accelerate_port',), + password = ('ansible_ssh_pass', 'ansible_password'), + private_key_file = ('ansible_ssh_private_key_file', 'ansible_private_key_file'), + pipelining = ('ansible_ssh_pipelining', 'ansible_pipelining'), + shell = ('ansible_shell_type',), + network_os = ('ansible_network_os',), + become = ('ansible_become',), + become_method = ('ansible_become_method',), + become_user = ('ansible_become_user',), + become_pass = ('ansible_become_password','ansible_become_pass'), + become_exe = ('ansible_become_exe',), + become_flags = ('ansible_become_flags',), + ssh_common_args = ('ansible_ssh_common_args',), + docker_extra_args= ('ansible_docker_extra_args',), + sftp_extra_args = ('ansible_sftp_extra_args',), + scp_extra_args = ('ansible_scp_extra_args',), + ssh_extra_args = ('ansible_ssh_extra_args',), + ssh_transfer_method = ('ansible_ssh_transfer_method',), + sudo = ('ansible_sudo',), + sudo_user = ('ansible_sudo_user',), + sudo_pass = ('ansible_sudo_password', 'ansible_sudo_pass'), + sudo_exe = ('ansible_sudo_exe',), + sudo_flags = ('ansible_sudo_flags',), + su = ('ansible_su',), + su_user = ('ansible_su_user',), + su_pass = ('ansible_su_password', 'ansible_su_pass'), + su_exe = ('ansible_su_exe',), + su_flags = ('ansible_su_flags',), + executable = ('ansible_shell_executable',), + module_compression = ('ansible_module_compression',), ) b_SU_PROMPT_LOCALIZATIONS = [ diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 89de093731..2e34897202 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -441,11 +441,11 @@ class ActionBase(with_metaclass(ABCMeta, object)): Get information from remote file. ''' module_args=dict( - path=path, - follow=follow, - get_md5=False, - get_checksum=True, - checksum_algo='sha1', + path=path, + follow=follow, + get_md5=False, + get_checksum=True, + checksum_algo='sha1', ) mystat = self._execute_module(module_name='stat', module_args=module_args, task_vars=all_vars, tmp=tmp, delete_remote_tmp=(tmp is None)) diff --git a/lib/ansible/plugins/action/template.py b/lib/ansible/plugins/action/template.py index b1a3dc4281..ea47d67f37 100644 --- a/lib/ansible/plugins/action/template.py +++ b/lib/ansible/plugins/action/template.py @@ -175,12 +175,12 @@ class ActionModule(ActionBase): # run the copy module new_module_args.update( - dict( - src=xfered, - dest=dest, - original_basename=os.path.basename(source), - follow=True, - ), + dict( + src=xfered, + dest=dest, + original_basename=os.path.basename(source), + follow=True, + ), ) result.update(self._execute_module(module_name='copy', module_args=new_module_args, task_vars=task_vars, tmp=tmp, delete_remote_tmp=False)) diff --git a/lib/ansible/plugins/callback/dense.py b/lib/ansible/plugins/callback/dense.py index 181dd6ff06..22b70f3847 100644 --- a/lib/ansible/plugins/callback/dense.py +++ b/lib/ansible/plugins/callback/dense.py @@ -167,9 +167,9 @@ class CallbackModule_dense(CallbackModule_default): # Attributes to remove from results for more density self.removed_attributes = ( -# 'changed', + # 'changed', 'delta', -# 'diff', + # 'diff', 'end', 'failed', 'failed_when_result', diff --git a/lib/ansible/plugins/callback/foreman.py b/lib/ansible/plugins/callback/foreman.py index a899a71098..24b3fcc416 100644 --- a/lib/ansible/plugins/callback/foreman.py +++ b/lib/ansible/plugins/callback/foreman.py @@ -63,8 +63,8 @@ class CallbackModule(CallbackBase): "/etc/foreman/client_key.pem")) FOREMAN_SSL_VERIFY = os.getenv('FOREMAN_SSL_VERIFY', "1") FOREMAN_HEADERS = { - "Content-Type": "application/json", - "Accept": "application/json" + "Content-Type": "application/json", + "Accept": "application/json" } TIME_FORMAT = "%Y-%m-%d %H:%M:%S %f" @@ -155,7 +155,7 @@ class CallbackModule(CallbackBase): "status": status, "logs": log, } - } + } # To be changed to /api/v2/config_reports in 1.11. Maybe we # could make a GET request to get the Foreman version & do # this automatically. diff --git a/lib/ansible/plugins/callback/selective.py b/lib/ansible/plugins/callback/selective.py index 90b7f83145..a1eb06a8c9 100644 --- a/lib/ansible/plugins/callback/selective.py +++ b/lib/ansible/plugins/callback/selective.py @@ -226,7 +226,7 @@ class CallbackModule(CallbackBase): color = 'ok' msg = '{} : ok={}\tchanged={}\tfailed={}\tunreachable={}'.format( - host, s['ok'], s['changed'], s['failures'], s['unreachable']) + host, s['ok'], s['changed'], s['failures'], s['unreachable']) print(colorize(msg, color)) def v2_runner_on_skipped(self, result, **kwargs): diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py index 9278de820f..5fb79b4e52 100644 --- a/lib/ansible/plugins/connection/ssh.py +++ b/lib/ansible/plugins/connection/ssh.py @@ -202,8 +202,8 @@ class Connection(ConnectionBase): if user: self._add_args(b_command, (b"-o", b"User=" + to_bytes(self._play_context.remote_user, errors='surrogate_or_strict')), - u"ANSIBLE_REMOTE_USER/remote_user/ansible_user/user/-u set" - ) + u"ANSIBLE_REMOTE_USER/remote_user/ansible_user/user/-u set" + ) self._add_args(b_command, (b"-o", b"ConnectTimeout=" + to_bytes(self._play_context.timeout, errors='surrogate_or_strict', nonstring='simplerepr')), diff --git a/lib/ansible/plugins/filter/ipaddr.py b/lib/ansible/plugins/filter/ipaddr.py index 32b6017e12..4837f9d7f6 100644 --- a/lib/ansible/plugins/filter/ipaddr.py +++ b/lib/ansible/plugins/filter/ipaddr.py @@ -262,61 +262,61 @@ def ipaddr(value, query = '', version = False, alias = 'ipaddr'): ''' Check if string is an IP address or network and filter it ''' query_func_extra_args = { - '': ('vtype',), - '6to4': ('vtype', 'value'), - 'cidr_lookup': ('iplist', 'value'), - 'int': ('vtype',), - 'ipv4': ('value',), - 'ipv6': ('value',), - 'link-local': ('value',), - 'loopback': ('value',), - 'lo': ('value',), - 'multicast': ('value',), - 'private': ('value',), - 'public': ('value',), - 'unicast': ('value',), - 'wrap': ('vtype', 'value'), - } + '': ('vtype',), + '6to4': ('vtype', 'value'), + 'cidr_lookup': ('iplist', 'value'), + 'int': ('vtype',), + 'ipv4': ('value',), + 'ipv6': ('value',), + 'link-local': ('value',), + 'loopback': ('value',), + 'lo': ('value',), + 'multicast': ('value',), + 'private': ('value',), + 'public': ('value',), + 'unicast': ('value',), + 'wrap': ('vtype', 'value'), + } query_func_map = { - '': _empty_ipaddr_query, - '6to4': _6to4_query, - 'address': _ip_query, - 'address/prefix': _gateway_query, - 'bool': _bool_ipaddr_query, - 'broadcast': _broadcast_query, - 'cidr': _cidr_query, - 'cidr_lookup': _cidr_lookup_query, - 'gateway': _gateway_query, - 'gw': _gateway_query, - 'host': _host_query, - 'host/prefix': _gateway_query, - 'hostmask': _hostmask_query, - 'hostnet': _gateway_query, - 'int': _int_query, - 'ip': _ip_query, - 'ipv4': _ipv4_query, - 'ipv6': _ipv6_query, - 'link-local': _link_local_query, - 'lo': _loopback_query, - 'loopback': _loopback_query, - 'multicast': _multicast_query, - 'net': _net_query, - 'netmask': _netmask_query, - 'network': _network_query, - 'prefix': _prefix_query, - 'private': _private_query, - 'public': _public_query, - 'revdns': _revdns_query, - 'router': _gateway_query, - 'size': _size_query, - 'subnet': _subnet_query, - 'type': _type_query, - 'unicast': _unicast_query, - 'v4': _ipv4_query, - 'v6': _ipv6_query, - 'version': _version_query, - 'wrap': _wrap_query, - } + '': _empty_ipaddr_query, + '6to4': _6to4_query, + 'address': _ip_query, + 'address/prefix': _gateway_query, + 'bool': _bool_ipaddr_query, + 'broadcast': _broadcast_query, + 'cidr': _cidr_query, + 'cidr_lookup': _cidr_lookup_query, + 'gateway': _gateway_query, + 'gw': _gateway_query, + 'host': _host_query, + 'host/prefix': _gateway_query, + 'hostmask': _hostmask_query, + 'hostnet': _gateway_query, + 'int': _int_query, + 'ip': _ip_query, + 'ipv4': _ipv4_query, + 'ipv6': _ipv6_query, + 'link-local': _link_local_query, + 'lo': _loopback_query, + 'loopback': _loopback_query, + 'multicast': _multicast_query, + 'net': _net_query, + 'netmask': _netmask_query, + 'network': _network_query, + 'prefix': _prefix_query, + 'private': _private_query, + 'public': _public_query, + 'revdns': _revdns_query, + 'router': _gateway_query, + 'size': _size_query, + 'subnet': _subnet_query, + 'type': _type_query, + 'unicast': _unicast_query, + 'v4': _ipv4_query, + 'v6': _ipv6_query, + 'version': _version_query, + 'wrap': _wrap_query, + } vtype = None @@ -633,22 +633,22 @@ def hwaddr(value, query = '', alias = 'hwaddr'): ''' Check if string is a HW/MAC address and filter it ''' query_func_extra_args = { - '': ('value',), - } + '': ('value',), + } query_func_map = { - '': _empty_hwaddr_query, - 'bare': _bare_query, - 'bool': _bool_hwaddr_query, - 'int': _int_hwaddr_query, - 'cisco': _cisco_query, - 'eui48': _win_query, - 'linux': _linux_query, - 'pgsql': _postgresql_query, - 'postgresql': _postgresql_query, - 'psql': _postgresql_query, - 'unix': _unix_query, - 'win': _win_query, - } + '': _empty_hwaddr_query, + 'bare': _bare_query, + 'bool': _bool_hwaddr_query, + 'int': _int_hwaddr_query, + 'cisco': _cisco_query, + 'eui48': _win_query, + 'linux': _linux_query, + 'pgsql': _postgresql_query, + 'postgresql': _postgresql_query, + 'psql': _postgresql_query, + 'unix': _unix_query, + 'win': _win_query, + } try: v = netaddr.EUI(value) diff --git a/lib/ansible/plugins/lookup/dig.py b/lib/ansible/plugins/lookup/dig.py index a50da9c780..034324eb2e 100644 --- a/lib/ansible/plugins/lookup/dig.py +++ b/lib/ansible/plugins/lookup/dig.py @@ -39,29 +39,29 @@ def make_rdata_dict(rdata): Note: adding support for RRSIG is hard work. :) ''' supported_types = { - A : ['address'], - AAAA : ['address'], - CNAME : ['target'], - DNAME : ['target'], - DLV : ['algorithm', 'digest_type', 'key_tag', 'digest'], - DNSKEY : ['flags', 'algorithm', 'protocol', 'key'], - DS : ['algorithm', 'digest_type', 'key_tag', 'digest'], - HINFO : ['cpu', 'os'], - LOC : ['latitude', 'longitude', 'altitude', 'size', 'horizontal_precision', 'vertical_precision'], - MX : ['preference', 'exchange'], - NAPTR : ['order', 'preference', 'flags', 'service', 'regexp', 'replacement'], - NS : ['target'], - NSEC3PARAM : ['algorithm', 'flags', 'iterations', 'salt'], - PTR : ['target'], - RP : ['mbox', 'txt'], - # RRSIG : ['algorithm', 'labels', 'original_ttl', 'expiration', 'inception', 'signature'], - SOA : ['mname', 'rname', 'serial', 'refresh', 'retry', 'expire', 'minimum'], - SPF : ['strings'], - SRV : ['priority', 'weight', 'port', 'target'], - SSHFP : ['algorithm', 'fp_type', 'fingerprint'], - TLSA : ['usage', 'selector', 'mtype', 'cert'], - TXT : ['strings'], - } + A : ['address'], + AAAA : ['address'], + CNAME : ['target'], + DNAME : ['target'], + DLV : ['algorithm', 'digest_type', 'key_tag', 'digest'], + DNSKEY : ['flags', 'algorithm', 'protocol', 'key'], + DS : ['algorithm', 'digest_type', 'key_tag', 'digest'], + HINFO : ['cpu', 'os'], + LOC : ['latitude', 'longitude', 'altitude', 'size', 'horizontal_precision', 'vertical_precision'], + MX : ['preference', 'exchange'], + NAPTR : ['order', 'preference', 'flags', 'service', 'regexp', 'replacement'], + NS : ['target'], + NSEC3PARAM : ['algorithm', 'flags', 'iterations', 'salt'], + PTR : ['target'], + RP : ['mbox', 'txt'], + # RRSIG : ['algorithm', 'labels', 'original_ttl', 'expiration', 'inception', 'signature'], + SOA : ['mname', 'rname', 'serial', 'refresh', 'retry', 'expire', 'minimum'], + SPF : ['strings'], + SRV : ['priority', 'weight', 'port', 'target'], + SSHFP : ['algorithm', 'fp_type', 'fingerprint'], + TLSA : ['usage', 'selector', 'mtype', 'cert'], + TXT : ['strings'], + } rd = {} diff --git a/lib/ansible/template/__init__.py b/lib/ansible/template/__init__.py index e29a8bf1f0..e3d7bc14be 100644 --- a/lib/ansible/template/__init__.py +++ b/lib/ansible/template/__init__.py @@ -414,12 +414,12 @@ class Templar: elif isinstance(variable, (list, tuple)): return [self.template( - v, - preserve_trailing_newlines=preserve_trailing_newlines, - fail_on_undefined=fail_on_undefined, - overrides=overrides, - disable_lookups=disable_lookups, - ) for v in variable] + v, + preserve_trailing_newlines=preserve_trailing_newlines, + fail_on_undefined=fail_on_undefined, + overrides=overrides, + disable_lookups=disable_lookups, + ) for v in variable] elif isinstance(variable, dict): d = {} # we don't use iteritems() here to avoid problems if the underlying dict @@ -427,12 +427,12 @@ class Templar: for k in variable.keys(): if k not in static_vars: d[k] = self.template( - variable[k], - preserve_trailing_newlines=preserve_trailing_newlines, - fail_on_undefined=fail_on_undefined, - overrides=overrides, - disable_lookups=disable_lookups, - ) + variable[k], + preserve_trailing_newlines=preserve_trailing_newlines, + fail_on_undefined=fail_on_undefined, + overrides=overrides, + disable_lookups=disable_lookups, + ) else: d[k] = variable[k] return d diff --git a/lib/ansible/utils/module_docs.py b/lib/ansible/utils/module_docs.py index 4208d49767..47e0b59a94 100755 --- a/lib/ansible/utils/module_docs.py +++ b/lib/ansible/utils/module_docs.py @@ -40,7 +40,7 @@ except ImportError: # modules that are ok that they do not have documentation strings BLACKLIST_MODULES = frozenset(( - 'async_wrapper', + 'async_wrapper', )) def get_docstring(filename, verbose=False): diff --git a/setup.py b/setup.py index 1c9dd62b85..ad1bd661a9 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ setup(name='ansible', package_dir={ '': 'lib' }, packages=find_packages('lib'), package_data={ - '': ['module_utils/*.ps1', 'modules/windows/*.ps1', 'modules/windows/*.ps1', 'galaxy/data/*/*.*', 'galaxy/data/*/*/*.*', 'galaxy/data/*/tests/inventory'], + '': ['module_utils/*.ps1', 'modules/windows/*.ps1', 'modules/windows/*.ps1', 'galaxy/data/*/*.*', 'galaxy/data/*/*/*.*', 'galaxy/data/*/tests/inventory'], }, classifiers=[ 'Development Status :: 5 - Production/Stable', @@ -42,14 +42,14 @@ setup(name='ansible', 'Topic :: Utilities', ], scripts=[ - 'bin/ansible', - 'bin/ansible-playbook', - 'bin/ansible-pull', - 'bin/ansible-doc', - 'bin/ansible-galaxy', - 'bin/ansible-console', - 'bin/ansible-connection', - 'bin/ansible-vault', + 'bin/ansible', + 'bin/ansible-playbook', + 'bin/ansible-pull', + 'bin/ansible-doc', + 'bin/ansible-galaxy', + 'bin/ansible-console', + 'bin/ansible-connection', + 'bin/ansible-vault', ], data_files=[], ) diff --git a/test/sanity/pep8/legacy-files.txt b/test/sanity/pep8/legacy-files.txt index 4c740dfa49..23ec2543d6 100644 --- a/test/sanity/pep8/legacy-files.txt +++ b/test/sanity/pep8/legacy-files.txt @@ -1,29 +1,17 @@ contrib/inventory/abiquo.py -contrib/inventory/azure_rm.py -contrib/inventory/cloudstack.py contrib/inventory/consul_io.py contrib/inventory/digital_ocean.py contrib/inventory/docker.py contrib/inventory/ec2.py -contrib/inventory/gce.py contrib/inventory/mdt_dynamic_inventory.py contrib/inventory/openvz.py contrib/inventory/rax.py contrib/inventory/softlayer.py -contrib/inventory/ssh_config.py contrib/inventory/vbox.py contrib/inventory/zone.py -docs/api/conf.py -docs/docsite/conf.py -docs/docsite/rst/conf.py -docs/docsite/rst/dev_guide/conf.py -examples/scripts/uptime.py hacking/metadata-tool.py hacking/module_formatter.py -hacking/tests/gen_distribution_version_testcase.py lib/ansible/cli/__init__.py -lib/ansible/cli/adhoc.py -lib/ansible/cli/console.py lib/ansible/cli/galaxy.py lib/ansible/cli/playbook.py lib/ansible/compat/six/__init__.py @@ -42,11 +30,8 @@ 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/gcp.py lib/ansible/module_utils/known_hosts.py lib/ansible/module_utils/mysql.py -lib/ansible/module_utils/nxos.py -lib/ansible/module_utils/redhat.py lib/ansible/module_utils/vmware.py lib/ansible/modules/cloud/amazon/_ec2_vpc.py lib/ansible/modules/cloud/amazon/aws_kms.py @@ -58,19 +43,15 @@ lib/ansible/modules/cloud/amazon/cloudwatchevent_rule.py lib/ansible/modules/cloud/amazon/dynamodb_table.py lib/ansible/modules/cloud/amazon/ec2.py lib/ansible/modules/cloud/amazon/ec2_ami.py -lib/ansible/modules/cloud/amazon/ec2_ami_copy.py lib/ansible/modules/cloud/amazon/ec2_ami_find.py lib/ansible/modules/cloud/amazon/ec2_asg.py lib/ansible/modules/cloud/amazon/ec2_asg_facts.py lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py lib/ansible/modules/cloud/amazon/ec2_elb.py -lib/ansible/modules/cloud/amazon/ec2_elb_facts.py lib/ansible/modules/cloud/amazon/ec2_elb_lb.py lib/ansible/modules/cloud/amazon/ec2_eni.py lib/ansible/modules/cloud/amazon/ec2_eni_facts.py -lib/ansible/modules/cloud/amazon/ec2_facts.py lib/ansible/modules/cloud/amazon/ec2_group.py -lib/ansible/modules/cloud/amazon/ec2_key.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 @@ -87,7 +68,6 @@ lib/ansible/modules/cloud/amazon/ec2_vpc_net.py lib/ansible/modules/cloud/amazon/ec2_vpc_net_facts.py lib/ansible/modules/cloud/amazon/ec2_vpc_route_table.py lib/ansible/modules/cloud/amazon/ec2_vpc_route_table_facts.py -lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py lib/ansible/modules/cloud/amazon/ec2_vpc_subnet_facts.py lib/ansible/modules/cloud/amazon/ec2_vpc_vgw.py lib/ansible/modules/cloud/amazon/ec2_vpc_vgw_facts.py @@ -97,7 +77,6 @@ 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/elasticache_subnet_group.py lib/ansible/modules/cloud/amazon/iam.py lib/ansible/modules/cloud/amazon/iam_cert.py lib/ansible/modules/cloud/amazon/iam_policy.py @@ -109,7 +88,6 @@ lib/ansible/modules/cloud/amazon/rds_subnet_group.py lib/ansible/modules/cloud/amazon/redshift.py lib/ansible/modules/cloud/amazon/route53.py lib/ansible/modules/cloud/amazon/route53_health_check.py -lib/ansible/modules/cloud/amazon/route53_zone.py lib/ansible/modules/cloud/amazon/s3.py lib/ansible/modules/cloud/amazon/s3_bucket.py lib/ansible/modules/cloud/amazon/s3_lifecycle.py @@ -118,8 +96,6 @@ lib/ansible/modules/cloud/amazon/s3_website.py lib/ansible/modules/cloud/amazon/sns_topic.py lib/ansible/modules/cloud/amazon/sts_assume_role.py lib/ansible/modules/cloud/amazon/sts_session_token.py -lib/ansible/modules/cloud/atomic/atomic_host.py -lib/ansible/modules/cloud/atomic/atomic_image.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 @@ -135,46 +111,26 @@ lib/ansible/modules/cloud/cloudstack/cs_host.py lib/ansible/modules/cloud/cloudstack/cs_instance.py lib/ansible/modules/cloud/cloudstack/cs_iso.py lib/ansible/modules/cloud/cloudstack/cs_portforward.py -lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.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_container.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_lb.py -lib/ansible/modules/cloud/google/gce_mig.py lib/ansible/modules/cloud/google/gce_net.py -lib/ansible/modules/cloud/google/gce_pd.py lib/ansible/modules/cloud/google/gce_tag.py lib/ansible/modules/cloud/google/gcpubsub.py lib/ansible/modules/cloud/google/gcpubsub_facts.py -lib/ansible/modules/cloud/linode/linode.py lib/ansible/modules/cloud/misc/ovirt.py 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/virt.py lib/ansible/modules/cloud/misc/xenserver_facts.py -lib/ansible/modules/cloud/openstack/_glance_image.py -lib/ansible/modules/cloud/openstack/_keystone_user.py lib/ansible/modules/cloud/openstack/_nova_compute.py -lib/ansible/modules/cloud/openstack/_quantum_floating_ip.py -lib/ansible/modules/cloud/openstack/_quantum_floating_ip_associate.py -lib/ansible/modules/cloud/openstack/_quantum_network.py -lib/ansible/modules/cloud/openstack/_quantum_router.py -lib/ansible/modules/cloud/openstack/_quantum_router_gateway.py -lib/ansible/modules/cloud/openstack/_quantum_router_interface.py -lib/ansible/modules/cloud/openstack/_quantum_subnet.py -lib/ansible/modules/cloud/openstack/os_auth.py lib/ansible/modules/cloud/openstack/os_nova_host_aggregate.py lib/ansible/modules/cloud/openstack/os_object.py -lib/ansible/modules/cloud/openstack/os_quota.py -lib/ansible/modules/cloud/openstack/os_recordset.py -lib/ansible/modules/cloud/openstack/os_zone.py lib/ansible/modules/cloud/packet/packet_device.py lib/ansible/modules/cloud/packet/packet_sshkey.py lib/ansible/modules/cloud/profitbricks/profitbricks.py @@ -182,7 +138,6 @@ lib/ansible/modules/cloud/profitbricks/profitbricks_datacenter.py lib/ansible/modules/cloud/softlayer/sl_vm.py lib/ansible/modules/cloud/vmware/vca_fw.py lib/ansible/modules/cloud/vmware/vmware_guest.py -lib/ansible/modules/cloud/vmware/vmware_local_user_manager.py lib/ansible/modules/cloud/vmware/vsphere_guest.py lib/ansible/modules/cloud/webfaction/webfaction_app.py lib/ansible/modules/cloud/webfaction/webfaction_db.py @@ -190,17 +145,11 @@ lib/ansible/modules/cloud/webfaction/webfaction_domain.py 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/clustering/consul_acl.py -lib/ansible/modules/clustering/consul_kv.py -lib/ansible/modules/clustering/consul_session.py -lib/ansible/modules/commands/command.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/misc/redis.py -lib/ansible/modules/database/misc/riak.py lib/ansible/modules/database/mssql/mssql_db.py lib/ansible/modules/database/mysql/mysql_db.py lib/ansible/modules/database/mysql/mysql_replication.py @@ -219,25 +168,17 @@ 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/lineinfile.py -lib/ansible/modules/files/stat.py lib/ansible/modules/files/synchronize.py lib/ansible/modules/files/tempfile.py lib/ansible/modules/files/unarchive.py -lib/ansible/modules/messaging/rabbitmq_binding.py -lib/ansible/modules/messaging/rabbitmq_exchange.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/logicmonitor_facts.py lib/ansible/modules/monitoring/nagios.py -lib/ansible/modules/monitoring/pagerduty.py lib/ansible/modules/monitoring/pagerduty_alert.py -lib/ansible/modules/monitoring/pingdom.py lib/ansible/modules/monitoring/sensu_check.py -lib/ansible/modules/monitoring/statusio_maintenance.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 @@ -321,28 +262,20 @@ lib/ansible/modules/network/snmp_facts.py lib/ansible/modules/notification/hall.py lib/ansible/modules/notification/sendgrid.py lib/ansible/modules/notification/sns.py -lib/ansible/modules/packaging/language/bundler.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/apt_rpm.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 lib/ansible/modules/packaging/os/pacman.py -lib/ansible/modules/packaging/os/pkgin.py -lib/ansible/modules/packaging/os/pkgng.py -lib/ansible/modules/packaging/os/portinstall.py lib/ansible/modules/packaging/os/redhat_subscription.py -lib/ansible/modules/packaging/os/rhn_channel.py lib/ansible/modules/packaging/os/rhn_register.py -lib/ansible/modules/packaging/os/rpm_key.py lib/ansible/modules/packaging/os/swdepot.py -lib/ansible/modules/packaging/os/urpmi.py lib/ansible/modules/packaging/os/yum.py lib/ansible/modules/packaging/os/zypper.py lib/ansible/modules/remote_management/foreman/katello.py @@ -357,21 +290,15 @@ lib/ansible/modules/storage/netapp/netapp_e_snapshot_group.py lib/ansible/modules/storage/netapp/netapp_e_snapshot_volume.py lib/ansible/modules/storage/netapp/netapp_e_storage_system.py lib/ansible/modules/storage/netapp/netapp_e_storagepool.py -lib/ansible/modules/system/authorized_key.py -lib/ansible/modules/system/cron.py lib/ansible/modules/system/debconf.py lib/ansible/modules/system/filesystem.py lib/ansible/modules/system/firewalld.py -lib/ansible/modules/system/gconftool2.py lib/ansible/modules/system/gluster_volume.py lib/ansible/modules/system/group.py lib/ansible/modules/system/known_hosts.py lib/ansible/modules/system/locale_gen.py lib/ansible/modules/system/lvol.py -lib/ansible/modules/system/openwrt_init.py lib/ansible/modules/system/pam_limits.py -lib/ansible/modules/system/sefcontext.py -lib/ansible/modules/system/seport.py lib/ansible/modules/system/solaris_zone.py lib/ansible/modules/system/systemd.py lib/ansible/modules/system/ufw.py @@ -384,12 +311,10 @@ lib/ansible/modules/utilities/logic/pause.py lib/ansible/modules/utilities/logic/set_fact.py lib/ansible/modules/utilities/logic/wait_for.py lib/ansible/modules/web_infrastructure/apache2_mod_proxy.py -lib/ansible/modules/web_infrastructure/apache2_module.py lib/ansible/modules/web_infrastructure/django_manage.py lib/ansible/modules/web_infrastructure/jenkins_job.py lib/ansible/modules/web_infrastructure/jira.py lib/ansible/modules/web_infrastructure/nginx_status_facts.py -lib/ansible/modules/web_infrastructure/taiga_issue.py lib/ansible/modules/windows/win_acl.py lib/ansible/modules/windows/win_acl_inheritance.py lib/ansible/modules/windows/win_chocolatey.py @@ -411,7 +336,6 @@ 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/helpers.py lib/ansible/playbook/play_context.py lib/ansible/playbook/playbook_include.py lib/ansible/playbook/role/__init__.py @@ -423,14 +347,10 @@ lib/ansible/plugins/action/async.py lib/ansible/plugins/action/set_fact.py lib/ansible/plugins/action/set_stats.py lib/ansible/plugins/action/synchronize.py -lib/ansible/plugins/action/template.py lib/ansible/plugins/cache/jsonfile.py lib/ansible/plugins/callback/default.py -lib/ansible/plugins/callback/dense.py -lib/ansible/plugins/callback/foreman.py lib/ansible/plugins/callback/logentries.py lib/ansible/plugins/callback/oneline.py -lib/ansible/plugins/callback/selective.py lib/ansible/plugins/connection/accelerate.py lib/ansible/plugins/connection/paramiko_ssh.py lib/ansible/plugins/connection/ssh.py @@ -466,26 +386,9 @@ test/units/errors/test_errors.py test/units/executor/test_playbook_executor.py test/units/mock/yaml_helper.py test/units/module_utils/basic/test__log_invocation.py -test/units/module_utils/basic/test_exit_json.py -test/units/module_utils/basic/test_log.py -test/units/module_utils/basic/test_no_log.py -test/units/module_utils/basic/test_safe_eval.py -test/units/module_utils/basic/test_set_mode_if_different.py -test/units/module_utils/json_utils/test_filter_non_json_lines.py test/units/module_utils/test_basic.py test/units/module_utils/test_distribution_version.py test/units/module_utils/test_facts.py -test/units/module_utils/test_text.py -test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py -test/units/parsing/test_mod_args.py test/units/parsing/yaml/test_loader.py -test/units/playbook/test_block.py test/units/playbook/test_helpers.py test/units/playbook/test_play_context.py -test/units/playbook/test_task.py -test/units/plugins/lookup/test_ini.py -test/units/plugins/lookup/test_password.py -test/units/template/test_templar.py -test/units/template/test_template_utilities.py -test/units/utils/test_vars.py -test/units/vars/test_variable_manager.py diff --git a/test/sanity/pep8/legacy-ignore.txt b/test/sanity/pep8/legacy-ignore.txt index 5f0d26d784..14d09ab1ec 100644 --- a/test/sanity/pep8/legacy-ignore.txt +++ b/test/sanity/pep8/legacy-ignore.txt @@ -1,9 +1,6 @@ E111 E114 -E121 -E122 E125 -E126 E129 E501 E712 diff --git a/test/units/module_utils/basic/test_exit_json.py b/test/units/module_utils/basic/test_exit_json.py index 15e167dbcf..9f9ed0b942 100644 --- a/test/units/module_utils/basic/test_exit_json.py +++ b/test/units/module_utils/basic/test_exit_json.py @@ -92,28 +92,28 @@ class TestAnsibleModuleExitJson(unittest.TestCase): class TestAnsibleModuleExitValuesRemoved(unittest.TestCase): OMIT = 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER' dataset = ( - (dict(username='person', password='$ecret k3y'), + (dict(username='person', password='$ecret k3y'), dict(one=1, pwd='$ecret k3y', url='https://username:password12345@foo.com/login/', not_secret='following the leader', msg='here'), dict(one=1, pwd=OMIT, url='https://username:password12345@foo.com/login/', not_secret='following the leader', changed=False, msg='here', invocation=dict(module_args=dict(password=OMIT, token=None, username='person'))), ), - (dict(username='person', password='password12345'), + (dict(username='person', password='password12345'), dict(one=1, pwd='$ecret k3y', url='https://username:password12345@foo.com/login/', not_secret='following the leader', msg='here'), dict(one=1, pwd='$ecret k3y', url='https://username:********@foo.com/login/', not_secret='following the leader', changed=False, msg='here', invocation=dict(module_args=dict(password=OMIT, token=None, username='person'))), ), - (dict(username='person', password='$ecret k3y'), + (dict(username='person', password='$ecret k3y'), dict(one=1, pwd='$ecret k3y', url='https://username:$ecret k3y@foo.com/login/', not_secret='following the leader', msg='here'), dict(one=1, pwd=OMIT, url='https://username:********@foo.com/login/', not_secret='following the leader', changed=False, msg='here', invocation=dict(module_args=dict(password=OMIT, token=None, username='person'))), ), - ) + ) def test_exit_json_removes_values(self): self.maxDiff = None diff --git a/test/units/module_utils/basic/test_log.py b/test/units/module_utils/basic/test_log.py index f50f7f607b..05c7420be5 100644 --- a/test/units/module_utils/basic/test_log.py +++ b/test/units/module_utils/basic/test_log.py @@ -115,20 +115,20 @@ class TestAnsibleModuleLogSyslog(unittest.TestCase): """Test the AnsibleModule Log Method""" py2_output_data = { - u'Text string': b'Text string', - u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test'.encode('utf-8'), - b'Byte string': b'Byte string', - u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test'.encode('utf-8'), - b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace').encode('utf-8'), - } + u'Text string': b'Text string', + u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test'.encode('utf-8'), + b'Byte string': b'Byte string', + u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test'.encode('utf-8'), + b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace').encode('utf-8'), + } py3_output_data = { - u'Text string': u'Text string', - u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test', - b'Byte string': u'Byte string', - u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test', - b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace') - } + u'Text string': u'Text string', + u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test', + b'Byte string': u'Byte string', + u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test', + b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace') + } def setUp(self): args = json.dumps(dict(ANSIBLE_MODULE_ARGS={})) @@ -184,12 +184,12 @@ class TestAnsibleModuleLogJournal(unittest.TestCase): """Test the AnsibleModule Log Method""" output_data = { - u'Text string': u'Text string', - u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test', - b'Byte string': u'Byte string', - u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test', - b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace') - } + u'Text string': u'Text string', + u'Toshio くらとみ non-ascii test': u'Toshio くらとみ non-ascii test', + b'Byte string': u'Byte string', + u'Toshio くらとみ non-ascii test'.encode('utf-8'): u'Toshio くらとみ non-ascii test', + b'non-utf8 :\xff: test': b'non-utf8 :\xff: test'.decode('utf-8', 'replace') + } # overriding run lets us use context managers for setup/teardown-esque behavior def setUp(self): diff --git a/test/units/module_utils/basic/test_no_log.py b/test/units/module_utils/basic/test_no_log.py index 3cb5d7b64b..7ffb06c5d8 100644 --- a/test/units/module_utils/basic/test_no_log.py +++ b/test/units/module_utils/basic/test_no_log.py @@ -34,21 +34,21 @@ from ansible.module_utils.basic import return_values, remove_values class TestReturnValues(unittest.TestCase): dataset = ( - ('string', frozenset(['string'])), - ('', frozenset()), - (1, frozenset(['1'])), - (1.0, frozenset(['1.0'])), - (False, frozenset()), - (['1', '2', '3'], frozenset(['1', '2', '3'])), - (('1', '2', '3'), frozenset(['1', '2', '3'])), - ({'one': 1, 'two': 'dos'}, frozenset(['1', 'dos'])), - ({'one': 1, 'two': 'dos', + ('string', frozenset(['string'])), + ('', frozenset()), + (1, frozenset(['1'])), + (1.0, frozenset(['1.0'])), + (False, frozenset()), + (['1', '2', '3'], frozenset(['1', '2', '3'])), + (('1', '2', '3'), frozenset(['1', '2', '3'])), + ({'one': 1, 'two': 'dos'}, frozenset(['1', 'dos'])), + ({'one': 1, 'two': 'dos', 'three': ['amigos', 'musketeers', None, {'ping': 'pong', 'base': ('balls', 'raquets')}]}, frozenset(['1', 'dos', 'amigos', 'musketeers', 'pong', 'balls', 'raquets'])), - (u'Toshio くらとみ', frozenset(['Toshio くらとみ'])), - ('Toshio くらとみ', frozenset(['Toshio くらとみ'])), - ) + (u'Toshio くらとみ', frozenset(['Toshio くらとみ'])), + ('Toshio くらとみ', frozenset(['Toshio くらとみ'])), + ) def test_return_values(self): for data, expected in self.dataset: @@ -61,46 +61,46 @@ class TestReturnValues(unittest.TestCase): class TestRemoveValues(unittest.TestCase): OMIT = 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER' dataset_no_remove = ( - ('string', frozenset(['nope'])), - (1234, frozenset(['4321'])), - (False, frozenset(['4321'])), - (1.0, frozenset(['4321'])), - (['string', 'strang', 'strung'], frozenset(['nope'])), - ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['nope'])), - ({'one': 1, 'two': 'dos', + ('string', frozenset(['nope'])), + (1234, frozenset(['4321'])), + (False, frozenset(['4321'])), + (1.0, frozenset(['4321'])), + (['string', 'strang', 'strung'], frozenset(['nope'])), + ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['nope'])), + ({'one': 1, 'two': 'dos', 'three': ['amigos', 'musketeers', None, {'ping': 'pong', 'base': ['balls', 'raquets']}]}, frozenset(['nope'])), - ('Toshio くら', frozenset(['とみ'])), - (u'Toshio くら', frozenset(['とみ'])), - ) + ('Toshio くら', frozenset(['とみ'])), + (u'Toshio くら', frozenset(['とみ'])), + ) dataset_remove = ( - ('string', frozenset(['string']), OMIT), - (1234, frozenset(['1234']), OMIT), - (1234, frozenset(['23']), OMIT), - (1.0, frozenset(['1.0']), OMIT), - (['string', 'strang', 'strung'], frozenset(['strang']), ['string', OMIT, 'strung']), - (['string', 'strang', 'strung'], frozenset(['strang', 'string', 'strung']), [OMIT, OMIT, OMIT]), - (('string', 'strang', 'strung'), frozenset(['string', 'strung']), [OMIT, 'strang', OMIT]), - ((1234567890, 345678, 987654321), frozenset(['1234567890']), [OMIT, 345678, 987654321]), - ((1234567890, 345678, 987654321), frozenset(['345678']), [OMIT, OMIT, 987654321]), - ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key']), + ('string', frozenset(['string']), OMIT), + (1234, frozenset(['1234']), OMIT), + (1234, frozenset(['23']), OMIT), + (1.0, frozenset(['1.0']), OMIT), + (['string', 'strang', 'strung'], frozenset(['strang']), ['string', OMIT, 'strung']), + (['string', 'strang', 'strung'], frozenset(['strang', 'string', 'strung']), [OMIT, OMIT, OMIT]), + (('string', 'strang', 'strung'), frozenset(['string', 'strung']), [OMIT, 'strang', OMIT]), + ((1234567890, 345678, 987654321), frozenset(['1234567890']), [OMIT, 345678, 987654321]), + ((1234567890, 345678, 987654321), frozenset(['345678']), [OMIT, OMIT, 987654321]), + ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key']), {'one': 1, 'two': 'dos', 'secret': OMIT}), - ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key', 'dos', '1']), + ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key', 'dos', '1']), {'one': OMIT, 'two': OMIT, 'secret': OMIT}), - ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key', 'dos', '1']), + ({'one': 1, 'two': 'dos', 'secret': 'key'}, frozenset(['key', 'dos', '1']), {'one': OMIT, 'two': OMIT, 'secret': OMIT}), - ({'one': 1, 'two': 'dos', 'three': ['amigos', 'musketeers', None, + ({'one': 1, 'two': 'dos', 'three': ['amigos', 'musketeers', None, {'ping': 'pong', 'base': ['balls', 'raquets']}]}, frozenset(['balls', 'base', 'pong', 'amigos']), {'one': 1, 'two': 'dos', 'three': [OMIT, 'musketeers', None, {'ping': OMIT, 'base': [OMIT, 'raquets']}]}), - ('This sentence has an enigma wrapped in a mystery inside of a secret. - mr mystery', + ('This sentence has an enigma wrapped in a mystery inside of a secret. - mr mystery', frozenset(['enigma', 'mystery', 'secret']), 'This sentence has an ******** wrapped in a ******** inside of a ********. - mr ********'), - ('Toshio くらとみ', frozenset(['くらとみ']), 'Toshio ********'), - (u'Toshio くらとみ', frozenset(['くらとみ']), u'Toshio ********'), - ) + ('Toshio くらとみ', frozenset(['くらとみ']), 'Toshio ********'), + (u'Toshio くらとみ', frozenset(['くらとみ']), u'Toshio ********'), + ) def test_no_removal(self): for value, no_log_strings in self.dataset_no_remove: diff --git a/test/units/module_utils/basic/test_safe_eval.py b/test/units/module_utils/basic/test_safe_eval.py index 0983002049..bf684f51e8 100644 --- a/test/units/module_utils/basic/test_safe_eval.py +++ b/test/units/module_utils/basic/test_safe_eval.py @@ -30,27 +30,27 @@ from units.mock.generator import add_method # Strings that should be converted into a typed value VALID_STRINGS = ( - [("'a'", 'a')], - [("'1'", '1')], - [("1", 1)], - [("True", True)], - [("False", False)], - [("{}", {})], - ) + [("'a'", 'a')], + [("'1'", '1')], + [("1", 1)], + [("True", True)], + [("False", False)], + [("{}", {})], + ) # Passing things that aren't strings should just return the object NONSTRINGS = ( - [({'a':1}, {'a':1})], - ) + [({'a':1}, {'a':1})], + ) # These strings are not basic types. For security, these should not be # executed. We return the same string and get an exception for some INVALID_STRINGS = ( - [("a=1", "a=1", SyntaxError)], - [("a.foo()", "a.foo()", None)], - [("import foo", "import foo", None)], - [("__import__('foo')", "__import__('foo')", ValueError)], - ) + [("a=1", "a=1", SyntaxError)], + [("a.foo()", "a.foo()", None)], + [("import foo", "import foo", None)], + [("__import__('foo')", "__import__('foo')", ValueError)], + ) def _check_simple_types(self, code, expected): diff --git a/test/units/module_utils/basic/test_set_mode_if_different.py b/test/units/module_utils/basic/test_set_mode_if_different.py index f8caea6d36..e13f2ec668 100644 --- a/test/units/module_utils/basic/test_set_mode_if_different.py +++ b/test/units/module_utils/basic/test_set_mode_if_different.py @@ -79,15 +79,15 @@ def _check_mode_unchanged_when_already_0660(self, mode): SYNONYMS_0660 = ( - [[0o660]], - [['0o660']], - [['660']], - ) + [[0o660]], + [['0o660']], + [['660']], + ) @add_method(_check_no_mode_given_returns_previous_changes, [dict(previous_changes=True)], - [dict(previous_changes=False)], - ) + [dict(previous_changes=False)], + ) @add_method(_check_mode_changed_to_0660, *SYNONYMS_0660 ) @@ -131,8 +131,8 @@ def _check_knows_to_change_to_0660_in_check_mode(self, mode): @add_method(_check_no_mode_given_returns_previous_changes, [dict(previous_changes=True)], - [dict(previous_changes=False)], - ) + [dict(previous_changes=False)], + ) @add_method(_check_knows_to_change_to_0660_in_check_mode, *SYNONYMS_0660 ) diff --git a/test/units/module_utils/json_utils/test_filter_non_json_lines.py b/test/units/module_utils/json_utils/test_filter_non_json_lines.py index b111cda040..768e770a1e 100644 --- a/test/units/module_utils/json_utils/test_filter_non_json_lines.py +++ b/test/units/module_utils/json_utils/test_filter_non_json_lines.py @@ -46,12 +46,12 @@ class TestAnsibleModuleExitJson(unittest.TestCase): junk = [u"single line of junk", u"line 1/2 of junk\nline 2/2 of junk"] unparsable_cases = ( - u'No json here', - u'"olá": "mundo"', - u'{"No json": "ending"', - u'{"wrong": "ending"]', - u'["wrong": "ending"}', - ) + u'No json here', + u'"olá": "mundo"', + u'{"No json": "ending"', + u'{"wrong": "ending"]', + u'["wrong": "ending"}', + ) def test_just_json(self): for i in self.all_inputs: diff --git a/test/units/module_utils/test_distribution_version.py b/test/units/module_utils/test_distribution_version.py index c9171cd314..52ca71ccc3 100644 --- a/test/units/module_utils/test_distribution_version.py +++ b/test/units/module_utils/test_distribution_version.py @@ -36,86 +36,86 @@ import ansible.module_utils.facts as facts # to generate the testcase data, you can use the script gen_distribution_version_testcase.py in hacking/tests TESTSETS = [ { - "platform.dist": [ - "centos", - "7.2.1511", - "Core" - ], - "input": { - "/etc/redhat-release": "CentOS Linux release 7.2.1511 (Core) \n", - "/etc/os-release": "NAME=\"CentOS Linux\"\nVERSION=\"7 (Core)\"\nID=\"centos\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"7\"\nPRETTY_NAME=\"CentOS Linux 7 (Core)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:centos:centos:7\"\nHOME_URL=\"https://www.centos.org/\"\nBUG_REPORT_URL=\"https://bugs.centos.org/\"\n\nCENTOS_MANTISBT_PROJECT=\"CentOS-7\"\nCENTOS_MANTISBT_PROJECT_VERSION=\"7\"\nREDHAT_SUPPORT_PRODUCT=\"centos\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7\"\n\n", - "/etc/system-release": "CentOS Linux release 7.2.1511 (Core) \n" - }, - "name": "CentOS 7.2.1511", - "result": { - "distribution_release": "Core", - "distribution": "CentOS", - "distribution_major_version": "7", - "os_family": "RedHat", - "distribution_version": "7.2.1511" - } -}, + "platform.dist": [ + "centos", + "7.2.1511", + "Core" + ], + "input": { + "/etc/redhat-release": "CentOS Linux release 7.2.1511 (Core) \n", + "/etc/os-release": "NAME=\"CentOS Linux\"\nVERSION=\"7 (Core)\"\nID=\"centos\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"7\"\nPRETTY_NAME=\"CentOS Linux 7 (Core)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:centos:centos:7\"\nHOME_URL=\"https://www.centos.org/\"\nBUG_REPORT_URL=\"https://bugs.centos.org/\"\n\nCENTOS_MANTISBT_PROJECT=\"CentOS-7\"\nCENTOS_MANTISBT_PROJECT_VERSION=\"7\"\nREDHAT_SUPPORT_PRODUCT=\"centos\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7\"\n\n", + "/etc/system-release": "CentOS Linux release 7.2.1511 (Core) \n" + }, + "name": "CentOS 7.2.1511", + "result": { + "distribution_release": "Core", + "distribution": "CentOS", + "distribution_major_version": "7", + "os_family": "RedHat", + "distribution_version": "7.2.1511" + } + }, { - "name": "CentOS 6.7", - "platform.dist": [ - "centos", - "6.7", - "Final" - ], - "input": { - "/etc/redhat-release": "CentOS release 6.7 (Final)\n", - "/etc/lsb-release": "LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\n", - "/etc/system-release": "CentOS release 6.7 (Final)\n" - }, - "result": { - "distribution_release": "Final", - "distribution": "CentOS", - "distribution_major_version": "6", - "os_family": "RedHat", - "distribution_version": "6.7" - } -}, + "name": "CentOS 6.7", + "platform.dist": [ + "centos", + "6.7", + "Final" + ], + "input": { + "/etc/redhat-release": "CentOS release 6.7 (Final)\n", + "/etc/lsb-release": "LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\n", + "/etc/system-release": "CentOS release 6.7 (Final)\n" + }, + "result": { + "distribution_release": "Final", + "distribution": "CentOS", + "distribution_major_version": "6", + "os_family": "RedHat", + "distribution_version": "6.7" + } + }, + { + "name": "RedHat 7.2", + "platform.dist": [ + "redhat", + "7.2", + "Maipo" + ], + "input": { + "/etc/redhat-release": "Red Hat Enterprise Linux Server release 7.2 (Maipo)\n", + "/etc/os-release": "NAME=\"Red Hat Enterprise Linux Server\"\nVERSION=\"7.2 (Maipo)\"\nID=\"rhel\"\nID_LIKE=\"fedora\"\nVERSION_ID=\"7.2\"\nPRETTY_NAME=\"Red Hat Enterprise Linux Server 7.2 (Maipo)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:redhat:enterprise_linux:7.2:GA:server\"\nHOME_URL=\"https://www.redhat.com/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\n\nREDHAT_BUGZILLA_PRODUCT=\"Red Hat Enterprise Linux 7\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.2\nREDHAT_SUPPORT_PRODUCT=\"Red Hat Enterprise Linux\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7.2\"\n", + "/etc/system-release": "Red Hat Enterprise Linux Server release 7.2 (Maipo)\n" + }, + "result": { + "distribution_release": "Maipo", + "distribution": "RedHat", + "distribution_major_version": "7", + "os_family": "RedHat", + "distribution_version": "7.2" + } + }, + { + "name": "RedHat 6.7", + "platform.dist": [ + "redhat", + "6.7", + "Santiago" + ], + "input": { + "/etc/redhat-release": "Red Hat Enterprise Linux Server release 6.7 (Santiago)\n", + "/etc/lsb-release": "LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\n", + "/etc/system-release": "Red Hat Enterprise Linux Server release 6.7 (Santiago)\n" + }, + "result": { + "distribution_release": "Santiago", + "distribution": "RedHat", + "distribution_major_version": "6", + "os_family": "RedHat", + "distribution_version": "6.7" + } + }, { - "name": "RedHat 7.2", - "platform.dist": [ - "redhat", - "7.2", - "Maipo" - ], - "input": { - "/etc/redhat-release": "Red Hat Enterprise Linux Server release 7.2 (Maipo)\n", - "/etc/os-release": "NAME=\"Red Hat Enterprise Linux Server\"\nVERSION=\"7.2 (Maipo)\"\nID=\"rhel\"\nID_LIKE=\"fedora\"\nVERSION_ID=\"7.2\"\nPRETTY_NAME=\"Red Hat Enterprise Linux Server 7.2 (Maipo)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:redhat:enterprise_linux:7.2:GA:server\"\nHOME_URL=\"https://www.redhat.com/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\n\nREDHAT_BUGZILLA_PRODUCT=\"Red Hat Enterprise Linux 7\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.2\nREDHAT_SUPPORT_PRODUCT=\"Red Hat Enterprise Linux\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7.2\"\n", - "/etc/system-release": "Red Hat Enterprise Linux Server release 7.2 (Maipo)\n" - }, - "result": { - "distribution_release": "Maipo", - "distribution": "RedHat", - "distribution_major_version": "7", - "os_family": "RedHat", - "distribution_version": "7.2" - } -}, -{ - "name": "RedHat 6.7", - "platform.dist": [ - "redhat", - "6.7", - "Santiago" - ], - "input": { - "/etc/redhat-release": "Red Hat Enterprise Linux Server release 6.7 (Santiago)\n", - "/etc/lsb-release": "LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\n", - "/etc/system-release": "Red Hat Enterprise Linux Server release 6.7 (Santiago)\n" - }, - "result": { - "distribution_release": "Santiago", - "distribution": "RedHat", - "distribution_major_version": "6", - "os_family": "RedHat", - "distribution_version": "6.7" - } -}, -{ "name" : "openSUSE Leap 42.1", "input": { "/etc/os-release": @@ -604,84 +604,84 @@ DISTRIB_DESCRIPTION="CoreOS 976.0.0 (Coeur Rouge)" "platform.system": "SunOS" }, -{ - "name": "Solaris 11.3", - "platform.dist": [ - "", - "", - "" - ], - "input": { - "/etc/release": " Oracle Solaris 11.3 X86\n Copyright (c) 1983, 2015, Oracle and/or its affiliates. All rights reserved.\n Assembled 06 October 2015\n" - }, - "platform.system": "SunOS", - "result": { - "distribution_release": "Oracle Solaris 11.3 X86", - "distribution": "Solaris", - "os_family": "Solaris", - "distribution_version": "11.3" - } -}, + { + "name": "Solaris 11.3", + "platform.dist": [ + "", + "", + "" + ], + "input": { + "/etc/release": " Oracle Solaris 11.3 X86\n Copyright (c) 1983, 2015, Oracle and/or its affiliates. All rights reserved.\n Assembled 06 October 2015\n" + }, + "platform.system": "SunOS", + "result": { + "distribution_release": "Oracle Solaris 11.3 X86", + "distribution": "Solaris", + "os_family": "Solaris", + "distribution_version": "11.3" + } + }, -{ - "name": "Solaris 10", - "platform.dist": [ - "", - "", - "" - ], - "input": { - "/etc/release": " Oracle Solaris 10 1/13 s10x_u11wos_24a X86\n Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.\n Assembled 17 January 2013\n" - }, - "platform.system": "SunOS", - "result": { - "distribution_release": "Oracle Solaris 10 1/13 s10x_u11wos_24a X86", - "distribution": "Solaris", - "os_family": "Solaris", - "distribution_version": "10" - } -}, + { + "name": "Solaris 10", + "platform.dist": [ + "", + "", + "" + ], + "input": { + "/etc/release": " Oracle Solaris 10 1/13 s10x_u11wos_24a X86\n Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.\n Assembled 17 January 2013\n" + }, + "platform.system": "SunOS", + "result": { + "distribution_release": "Oracle Solaris 10 1/13 s10x_u11wos_24a X86", + "distribution": "Solaris", + "os_family": "Solaris", + "distribution_version": "10" + } + }, -{ - "name": "Fedora 22", - "platform.dist": [ - "fedora", - "22", - "Twenty Two" - ], - "input": { - "/etc/redhat-release": "Fedora release 22 (Twenty Two)\n", - "/etc/os-release": "NAME=Fedora\nVERSION=\"22 (Twenty Two)\"\nID=fedora\nVERSION_ID=22\nPRETTY_NAME=\"Fedora 22 (Twenty Two)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:22\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=22\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=22\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\n", - "/etc/system-release": "Fedora release 22 (Twenty Two)\n" - }, - "result": { - "distribution_release": "Twenty Two", - "distribution": "Fedora", - "distribution_major_version": "22", - "os_family": "RedHat", - "distribution_version": "22" - } -}, -{ - "platform.dist": [ - "fedora", - "25", - "Rawhide" - ], - "input": { - "/etc/redhat-release": "Fedora release 25 (Rawhide)\n", - "/etc/os-release": "NAME=Fedora\nVERSION=\"25 (Workstation Edition)\"\nID=fedora\nVERSION_ID=25\nPRETTY_NAME=\"Fedora 25 (Workstation Edition)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:25\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=rawhide\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=rawhide\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\nVARIANT=\"Workstation Edition\"\nVARIANT_ID=workstation\n", - "/etc/system-release": "Fedora release 25 (Rawhide)\n" - }, - "name": "Fedora 25", - "result": { - "distribution_release": "Rawhide", - "distribution": "Fedora", - "distribution_major_version": "25", - "os_family": "RedHat", - "distribution_version": "25" - } -}, + { + "name": "Fedora 22", + "platform.dist": [ + "fedora", + "22", + "Twenty Two" + ], + "input": { + "/etc/redhat-release": "Fedora release 22 (Twenty Two)\n", + "/etc/os-release": "NAME=Fedora\nVERSION=\"22 (Twenty Two)\"\nID=fedora\nVERSION_ID=22\nPRETTY_NAME=\"Fedora 22 (Twenty Two)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:22\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=22\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=22\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\n", + "/etc/system-release": "Fedora release 22 (Twenty Two)\n" + }, + "result": { + "distribution_release": "Twenty Two", + "distribution": "Fedora", + "distribution_major_version": "22", + "os_family": "RedHat", + "distribution_version": "22" + } + }, + { + "platform.dist": [ + "fedora", + "25", + "Rawhide" + ], + "input": { + "/etc/redhat-release": "Fedora release 25 (Rawhide)\n", + "/etc/os-release": "NAME=Fedora\nVERSION=\"25 (Workstation Edition)\"\nID=fedora\nVERSION_ID=25\nPRETTY_NAME=\"Fedora 25 (Workstation Edition)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:25\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=rawhide\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=rawhide\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\nVARIANT=\"Workstation Edition\"\nVARIANT_ID=workstation\n", + "/etc/system-release": "Fedora release 25 (Rawhide)\n" + }, + "name": "Fedora 25", + "result": { + "distribution_release": "Rawhide", + "distribution": "Fedora", + "distribution_major_version": "25", + "os_family": "RedHat", + "distribution_version": "25" + } + }, ] diff --git a/test/units/module_utils/test_text.py b/test/units/module_utils/test_text.py index 6b11fa4e2a..388d086b55 100644 --- a/test/units/module_utils/test_text.py +++ b/test/units/module_utils/test_text.py @@ -31,13 +31,13 @@ from ansible.module_utils._text import to_text, to_bytes, to_native # Format: byte representation, text representation, encoding of byte representation VALID_STRINGS = ( - (b'abcde', u'abcde', 'ascii'), - (b'caf\xc3\xa9', u'caf\xe9', 'utf-8'), - (b'caf\xe9', u'caf\xe9', 'latin-1'), - # u'くらとみ' - (b'\xe3\x81\x8f\xe3\x82\x89\xe3\x81\xa8\xe3\x81\xbf', u'\u304f\u3089\u3068\u307f', 'utf-8'), - (b'\x82\xad\x82\xe7\x82\xc6\x82\xdd', u'\u304f\u3089\u3068\u307f', 'shift-jis'), - ) + (b'abcde', u'abcde', 'ascii'), + (b'caf\xc3\xa9', u'caf\xe9', 'utf-8'), + (b'caf\xe9', u'caf\xe9', 'latin-1'), + # u'くらとみ' + (b'\xe3\x81\x8f\xe3\x82\x89\xe3\x81\xa8\xe3\x81\xbf', u'\u304f\u3089\u3068\u307f', 'utf-8'), + (b'\x82\xad\x82\xe7\x82\xc6\x82\xdd', u'\u304f\u3089\u3068\u307f', 'shift-jis'), + ) def _check_to_text(self, in_string, encoding, expected): """test happy path of decoding to text""" diff --git a/test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py b/test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py index f274b70114..6600219612 100644 --- a/test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py +++ b/test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py @@ -57,13 +57,13 @@ def run(play): results = None try: tqm = TaskQueueManager( - inventory=inventory, - variable_manager=variable_manager, - loader=loader, - options=options, - passwords=passwords, - stdout_callback='default', - ) + inventory=inventory, + variable_manager=variable_manager, + loader=loader, + options=options, + passwords=passwords, + stdout_callback='default', + ) results = tqm.run(play) finally: if tqm is not None: diff --git a/test/units/parsing/test_mod_args.py b/test/units/parsing/test_mod_args.py index e83ddeea37..bd5b5c8397 100644 --- a/test/units/parsing/test_mod_args.py +++ b/test/units/parsing/test_mod_args.py @@ -47,9 +47,9 @@ class TestModArgsDwim(unittest.TestCase): self._debug(mod, args, to) self.assertEqual(mod, 'command') self.assertEqual(args, dict( - _raw_params = 'echo hi', - _uses_shell = True, - )) + _raw_params = 'echo hi', + _uses_shell = True, + )) self.assertIsNone(to) def test_basic_command(self): @@ -58,8 +58,8 @@ class TestModArgsDwim(unittest.TestCase): self._debug(mod, args, to) self.assertEqual(mod, 'command') self.assertEqual(args, dict( - _raw_params = 'echo hi', - )) + _raw_params = 'echo hi', + )) self.assertIsNone(to) def test_shell_with_modifiers(self): @@ -68,11 +68,11 @@ class TestModArgsDwim(unittest.TestCase): self._debug(mod, args, to) self.assertEqual(mod, 'command') self.assertEqual(args, dict( - creates = '/tmp/baz', - removes = '/tmp/bleep', - _raw_params = '/bin/foo', - _uses_shell = True, - )) + creates = '/tmp/baz', + removes = '/tmp/bleep', + _raw_params = '/bin/foo', + _uses_shell = True, + )) self.assertIsNone(to) def test_normal_usage(self): diff --git a/test/units/playbook/test_block.py b/test/units/playbook/test_block.py index c116b364f3..2fec92ef04 100644 --- a/test/units/playbook/test_block.py +++ b/test/units/playbook/test_block.py @@ -39,10 +39,10 @@ class TestBlock(unittest.TestCase): def test_load_block_simple(self): ds = dict( - block = [], - rescue = [], - always = [], - #otherwise = [], + block = [], + rescue = [], + always = [], + #otherwise = [], ) b = Block.load(ds) self.assertEqual(b.block, []) @@ -53,10 +53,10 @@ class TestBlock(unittest.TestCase): def test_load_block_with_tasks(self): ds = dict( - block = [dict(action='block')], - rescue = [dict(action='rescue')], - always = [dict(action='always')], - #otherwise = [dict(action='otherwise')], + block = [dict(action='block')], + rescue = [dict(action='rescue')], + always = [dict(action='always')], + #otherwise = [dict(action='otherwise')], ) b = Block.load(ds) self.assertEqual(len(b.block), 1) @@ -77,9 +77,9 @@ class TestBlock(unittest.TestCase): def test_deserialize(self): ds = dict( - block = [dict(action='block')], - rescue = [dict(action='rescue')], - always = [dict(action='always')], + block = [dict(action='block')], + rescue = [dict(action='rescue')], + always = [dict(action='always')], ) b = Block.load(ds) data = dict(parent = ds, parent_type = 'Block') diff --git a/test/units/playbook/test_play_context.py b/test/units/playbook/test_play_context.py index adbd54f2bb..4a73e0f56b 100644 --- a/test/units/playbook/test_play_context.py +++ b/test/units/playbook/test_play_context.py @@ -186,7 +186,7 @@ class TestPlayContext(unittest.TestCase): class TestTaskAndVariableOverrride(unittest.TestCase): inventory_vars = ( - ('preferred_names', + ('preferred_names', dict(ansible_connection='local', ansible_user='ansibull', ansible_become_user='ansibull', @@ -198,11 +198,11 @@ class TestTaskAndVariableOverrride(unittest.TestCase): become_method='su', become_pass='ansibullwuzhere',) ), - ('alternate_names', + ('alternate_names', dict(ansible_become_password='ansibullwuzhere',), dict(become_pass='ansibullwuzhere',) ), - ('deprecated_names', + ('deprecated_names', dict(ansible_ssh_user='ansibull', ansible_sudo_user='ansibull', ansible_sudo_pass='ansibullwuzhere',), @@ -211,7 +211,7 @@ class TestTaskAndVariableOverrride(unittest.TestCase): become_user='ansibull', become_pass='ansibullwuzhere',) ), - ('deprecated_names2', + ('deprecated_names2', dict(ansible_ssh_user='ansibull', ansible_su_user='ansibull', ansible_su_pass='ansibullwuzhere',), @@ -220,17 +220,17 @@ class TestTaskAndVariableOverrride(unittest.TestCase): become_user='ansibull', become_pass='ansibullwuzhere',) ), - ('deprecated_alt_names', + ('deprecated_alt_names', dict(ansible_sudo_password='ansibullwuzhere',), dict(become_method='sudo', become_pass='ansibullwuzhere',) ), - ('deprecated_alt_names2', + ('deprecated_alt_names2', dict(ansible_su_password='ansibullwuzhere',), dict(become_method='su', become_pass='ansibullwuzhere',) ), - ('deprecated_and_preferred_names', + ('deprecated_and_preferred_names', dict(ansible_user='ansibull', ansible_ssh_user='badbull', ansible_become_user='ansibull', @@ -245,7 +245,7 @@ class TestTaskAndVariableOverrride(unittest.TestCase): become_method='su', become_pass='ansibullwuzhere',) ), - ) + ) def setUp(self): parser = CLI.base_parser( diff --git a/test/units/playbook/test_task.py b/test/units/playbook/test_task.py index b2160e0dd2..3995c4fd55 100644 --- a/test/units/playbook/test_task.py +++ b/test/units/playbook/test_task.py @@ -23,12 +23,12 @@ from ansible.playbook.task import Task from ansible.compat.tests import unittest basic_shell_task = dict( - name = 'Test Task', - shell = 'echo hi' + name = 'Test Task', + shell = 'echo hi' ) kv_shell_task = dict( - action = 'shell echo hi' + action = 'shell echo hi' ) class TestTask(unittest.TestCase): diff --git a/test/units/plugins/lookup/test_ini.py b/test/units/plugins/lookup/test_ini.py index aeb6c2e067..3fc728aa74 100644 --- a/test/units/plugins/lookup/test_ini.py +++ b/test/units/plugins/lookup/test_ini.py @@ -28,26 +28,26 @@ class TestINILookup(unittest.TestCase): # Currently there isn't a new-style old_style_params_data = ( - # Simple case - dict(term=u'keyA section=sectionA file=/path/to/file', + # Simple case + dict(term=u'keyA section=sectionA file=/path/to/file', expected=[u'keyA', u'section=sectionA', u'file=/path/to/file'], ), - dict(term=u'keyB section=sectionB with space file=/path/with/embedded spaces and/file', + dict(term=u'keyB section=sectionB with space file=/path/with/embedded spaces and/file', expected=[u'keyB', u'section=sectionB with space', u'file=/path/with/embedded spaces and/file'], ), - dict(term=u'keyC section=sectionC file=/path/with/equals/cn=com.ansible', + dict(term=u'keyC section=sectionC file=/path/with/equals/cn=com.ansible', expected=[u'keyC', u'section=sectionC', u'file=/path/with/equals/cn=com.ansible'], ), - dict(term=u'keyD section=sectionD file=/path/with space and/equals/cn=com.ansible', + dict(term=u'keyD section=sectionD file=/path/with space and/equals/cn=com.ansible', expected=[u'keyD', u'section=sectionD', u'file=/path/with space and/equals/cn=com.ansible'], ), - dict(term=u'keyE section=sectionE file=/path/with/unicode/くらとみ/file', + dict(term=u'keyE section=sectionE file=/path/with/unicode/くらとみ/file', expected=[u'keyE', u'section=sectionE', u'file=/path/with/unicode/くらとみ/file'], ), - dict(term=u'keyF section=sectionF file=/path/with/utf 8 and spaces/くらとみ/file', + dict(term=u'keyF section=sectionF file=/path/with/utf 8 and spaces/くらとみ/file', expected=[u'keyF', u'section=sectionF', u'file=/path/with/utf 8 and spaces/くらとみ/file'], ), - ) + ) def setUp(self): diff --git a/test/units/plugins/lookup/test_password.py b/test/units/plugins/lookup/test_password.py index 7dabba6ce6..0fdffe99c5 100644 --- a/test/units/plugins/lookup/test_password.py +++ b/test/units/plugins/lookup/test_password.py @@ -305,24 +305,24 @@ class TestParseContent(unittest.TestCase): class TestFormatContent(unittest.TestCase): def test_no_encrypt(self): self.assertEqual( - password._format_content(password=u'hunter42', + password._format_content(password=u'hunter42', salt=u'87654321', encrypt=False), - u'hunter42 salt=87654321') + u'hunter42 salt=87654321') def test_no_encrypt_no_salt(self): self.assertEqual( - password._format_content(password=u'hunter42', + password._format_content(password=u'hunter42', salt=None, encrypt=False), - u'hunter42') + u'hunter42') def test_encrypt(self): self.assertEqual( - password._format_content(password=u'hunter42', + password._format_content(password=u'hunter42', salt=u'87654321', encrypt='pbkdf2_sha256'), - u'hunter42 salt=87654321') + u'hunter42 salt=87654321') def test_encrypt_no_salt(self): self.assertRaises(AssertionError, password._format_content, diff --git a/test/units/template/test_templar.py b/test/units/template/test_templar.py index f2e1be5dfb..6c8f5e7eb6 100644 --- a/test/units/template/test_templar.py +++ b/test/units/template/test_templar.py @@ -34,7 +34,7 @@ class TestTemplar(unittest.TestCase): def setUp(self): fake_loader = DictDataLoader({ - "/path/to/my_file.txt": "foo\n", + "/path/to/my_file.txt": "foo\n", }) shared_loader = SharedPluginLoaderObj() variables = dict( diff --git a/test/units/template/test_template_utilities.py b/test/units/template/test_template_utilities.py index da0ed0db5e..5ac866b25a 100644 --- a/test/units/template/test_template_utilities.py +++ b/test/units/template/test_template_utilities.py @@ -30,45 +30,45 @@ from ansible.template import _escape_backslashes, _count_newlines_from_end class TestBackslashEscape(unittest.TestCase): test_data = ( - # Test backslashes in a filter arg are double escaped - dict( - template=u"{{ 'test2 %s' | format('\\1') }}", - intermediate=u"{{ 'test2 %s' | format('\\\\1') }}", - expectation=u"test2 \\1", - args=dict() - ), - # Test backslashes inside the jinja2 var itself are double - # escaped - dict( - template=u"Test 2\\3: {{ '\\1 %s' | format('\\2') }}", - intermediate=u"Test 2\\3: {{ '\\\\1 %s' | format('\\\\2') }}", - expectation=u"Test 2\\3: \\1 \\2", - args=dict() - ), - # Test backslashes outside of the jinja2 var are not double - # escaped - dict( - template=u"Test 2\\3: {{ 'test2 %s' | format('\\1') }}; \\done", - intermediate=u"Test 2\\3: {{ 'test2 %s' | format('\\\\1') }}; \\done", - expectation=u"Test 2\\3: test2 \\1; \\done", - args=dict() - ), - # Test backslashes in a variable sent to a filter are handled - dict( - template=u"{{ 'test2 %s' | format(var1) }}", - intermediate=u"{{ 'test2 %s' | format(var1) }}", - expectation=u"test2 \\1", - args=dict(var1=u'\\1') - ), - # Test backslashes in a variable expanded by jinja2 are double - # escaped - dict( - template=u"Test 2\\3: {{ var1 | format('\\2') }}", - intermediate=u"Test 2\\3: {{ var1 | format('\\\\2') }}", - expectation=u"Test 2\\3: \\1 \\2", - args=dict(var1=u'\\1 %s') - ), - ) + # Test backslashes in a filter arg are double escaped + dict( + template=u"{{ 'test2 %s' | format('\\1') }}", + intermediate=u"{{ 'test2 %s' | format('\\\\1') }}", + expectation=u"test2 \\1", + args=dict() + ), + # Test backslashes inside the jinja2 var itself are double + # escaped + dict( + template=u"Test 2\\3: {{ '\\1 %s' | format('\\2') }}", + intermediate=u"Test 2\\3: {{ '\\\\1 %s' | format('\\\\2') }}", + expectation=u"Test 2\\3: \\1 \\2", + args=dict() + ), + # Test backslashes outside of the jinja2 var are not double + # escaped + dict( + template=u"Test 2\\3: {{ 'test2 %s' | format('\\1') }}; \\done", + intermediate=u"Test 2\\3: {{ 'test2 %s' | format('\\\\1') }}; \\done", + expectation=u"Test 2\\3: test2 \\1; \\done", + args=dict() + ), + # Test backslashes in a variable sent to a filter are handled + dict( + template=u"{{ 'test2 %s' | format(var1) }}", + intermediate=u"{{ 'test2 %s' | format(var1) }}", + expectation=u"test2 \\1", + args=dict(var1=u'\\1') + ), + # Test backslashes in a variable expanded by jinja2 are double + # escaped + dict( + template=u"Test 2\\3: {{ var1 | format('\\2') }}", + intermediate=u"Test 2\\3: {{ var1 | format('\\\\2') }}", + expectation=u"Test 2\\3: \\1 \\2", + args=dict(var1=u'\\1 %s') + ), + ) def setUp(self): self.env = jinja2.Environment() diff --git a/test/units/utils/test_vars.py b/test/units/utils/test_vars.py index aba05c41d4..1b4b57f273 100644 --- a/test/units/utils/test_vars.py +++ b/test/units/utils/test_vars.py @@ -30,39 +30,39 @@ from ansible.utils.vars import combine_vars, merge_hash class TestVariableUtils(unittest.TestCase): test_merge_data = ( - dict( - a=dict(a=1), - b=dict(b=2), - result=dict(a=1, b=2) + dict( + a=dict(a=1), + b=dict(b=2), + result=dict(a=1, b=2) ), - dict( - a=dict(a=1, c=dict(foo='bar')), - b=dict(b=2, c=dict(baz='bam')), - result=dict(a=1, b=2, c=dict(foo='bar', baz='bam')) + dict( + a=dict(a=1, c=dict(foo='bar')), + b=dict(b=2, c=dict(baz='bam')), + result=dict(a=1, b=2, c=dict(foo='bar', baz='bam')) ), - dict( - a=defaultdict(a=1, c=defaultdict(foo='bar')), - b=dict(b=2, c=dict(baz='bam')), - result=defaultdict(a=1, b=2, c=defaultdict(foo='bar', baz='bam')) + dict( + a=defaultdict(a=1, c=defaultdict(foo='bar')), + b=dict(b=2, c=dict(baz='bam')), + result=defaultdict(a=1, b=2, c=defaultdict(foo='bar', baz='bam')) ), - ) + ) test_replace_data = ( - dict( - a=dict(a=1), - b=dict(b=2), - result=dict(a=1, b=2) + dict( + a=dict(a=1), + b=dict(b=2), + result=dict(a=1, b=2) ), - dict( - a=dict(a=1, c=dict(foo='bar')), - b=dict(b=2, c=dict(baz='bam')), - result=dict(a=1, b=2, c=dict(baz='bam')) + dict( + a=dict(a=1, c=dict(foo='bar')), + b=dict(b=2, c=dict(baz='bam')), + result=dict(a=1, b=2, c=dict(baz='bam')) ), - dict( - a=defaultdict(a=1, c=dict(foo='bar')), - b=dict(b=2, c=defaultdict(baz='bam')), - result=defaultdict(a=1, b=2, c=defaultdict(baz='bam')) + dict( + a=defaultdict(a=1, c=dict(foo='bar')), + b=dict(b=2, c=defaultdict(baz='bam')), + result=defaultdict(a=1, b=2, c=defaultdict(baz='bam')) ), - ) + ) def setUp(self): pass diff --git a/test/units/vars/test_variable_manager.py b/test/units/vars/test_variable_manager.py index 659ca72c85..b2397d6cf2 100644 --- a/test/units/vars/test_variable_manager.py +++ b/test/units/vars/test_variable_manager.py @@ -237,8 +237,8 @@ class TestVariableManager(unittest.TestCase): inv1.set_playbook_basedir('./') play1 = Play.load(dict( - hosts=['all'], - roles=['defaults_only1', 'defaults_only2'], + hosts=['all'], + roles=['defaults_only1', 'defaults_only2'], ), loader=fake_loader, variable_manager=v) # first we assert that the defaults as viewed as a whole are the merged results @@ -341,8 +341,8 @@ class TestVariableManager(unittest.TestCase): }) play1 = Play.load(dict( - hosts=['all'], - roles=['role1', 'role2'], + hosts=['all'], + roles=['role1', 'role2'], ), loader=fake_loader, variable_manager=v) # The task defined by common-role exists twice because role1