mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
PEP 8 whitespace cleanup. (#20783)
* PEP 8 E271 whitespace cleanup. * PEP 8 W293 whitespace cleanup. * Fix whitespace issue from recent PR.
This commit is contained in:
parent
802fbcadf8
commit
95789f3949
132 changed files with 287 additions and 313 deletions
|
@ -123,7 +123,7 @@ def chain(module):
|
|||
|
||||
if state in ('absent') and not config_present:
|
||||
module.exit_json(changed=False)
|
||||
|
||||
|
||||
if state in ('present'):
|
||||
response = rest.put('chain[name="%s"]' % name, data={'name': name})
|
||||
if response.status_code == 204:
|
||||
|
|
|
@ -391,7 +391,7 @@ class CloudflareAPI(object):
|
|||
error_msg += "; Failed to parse API response: {0}".format(content)
|
||||
|
||||
# received an error status but no data with details on what failed
|
||||
if (info['status'] not in [200,304]) and (result is None):
|
||||
if (info['status'] not in [200,304]) and (result is None):
|
||||
self.module.fail_json(msg=error_msg)
|
||||
|
||||
if not result['success']:
|
||||
|
|
|
@ -183,14 +183,14 @@ class Default(FactsBase):
|
|||
return sw_name.text
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def parse_version(self, data):
|
||||
sw_ver = data.find('./data/system-sw-state/sw-version/sw-version')
|
||||
if sw_ver is not None:
|
||||
return sw_ver.text
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def parse_hostname(self, data):
|
||||
match = re.search(r'hostname\s+(\S+)', data, re.M)
|
||||
if match:
|
||||
|
@ -224,7 +224,7 @@ class Hardware(FactsBase):
|
|||
self.facts['cpu_arch'] = self.parse_cpu_arch(xml_data)
|
||||
|
||||
data = self.runner.get_command('show processes memory | grep Total')
|
||||
|
||||
|
||||
match = self.parse_memory(data)
|
||||
if match:
|
||||
self.facts['memtotal_mb'] = int(match[0]) / 1024
|
||||
|
@ -236,7 +236,7 @@ class Hardware(FactsBase):
|
|||
return cpu_arch.text
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def parse_memory(self, data):
|
||||
return re.findall(r'\:\s*(\d+)', data, re.M)
|
||||
|
||||
|
@ -372,7 +372,7 @@ class Interfaces(FactsBase):
|
|||
lldp_facts[name].append(fact)
|
||||
|
||||
return lldp_facts
|
||||
|
||||
|
||||
FACT_SUBSETS = dict(
|
||||
default=Default,
|
||||
hardware=Hardware,
|
||||
|
|
|
@ -327,7 +327,7 @@ class Interfaces(FactsBase):
|
|||
return match.group(3)
|
||||
if flag==1:
|
||||
return "null"
|
||||
|
||||
|
||||
def parse_type(self, key, properties):
|
||||
type_val, type_val_next = properties.split('--------- ------- --------------------- --------------------- --------------')
|
||||
flag=1
|
||||
|
|
|
@ -31,25 +31,25 @@ options:
|
|||
- Account API Key.
|
||||
required: true
|
||||
default: null
|
||||
|
||||
|
||||
account_secret:
|
||||
description:
|
||||
- Account Secret Key.
|
||||
required: true
|
||||
default: null
|
||||
|
||||
|
||||
domain:
|
||||
description:
|
||||
- Domain to work with. Can be the domain name (e.g. "mydomain.com") or the numeric ID of the domain in DNS Made Easy (e.g. "839989") for faster resolution.
|
||||
required: true
|
||||
default: null
|
||||
|
||||
|
||||
record_name:
|
||||
description:
|
||||
- Record name to get/create/delete/update. If record_name is not specified; all records for the domain will be returned in "result" regardless of the state argument.
|
||||
required: false
|
||||
default: null
|
||||
|
||||
|
||||
record_type:
|
||||
description:
|
||||
- Record type.
|
||||
|
@ -63,20 +63,20 @@ options:
|
|||
- "If record_value is not specified; no changes will be made and the record will be returned in 'result' (in other words, this module can be used to fetch a record's current id, type, and ttl)"
|
||||
required: false
|
||||
default: null
|
||||
|
||||
|
||||
record_ttl:
|
||||
description:
|
||||
- record's "Time to live". Number of seconds the record remains cached in DNS servers.
|
||||
required: false
|
||||
default: 1800
|
||||
|
||||
|
||||
state:
|
||||
description:
|
||||
- whether the record should exist or not
|
||||
required: true
|
||||
choices: [ 'present', 'absent' ]
|
||||
default: null
|
||||
|
||||
|
||||
validate_certs:
|
||||
description:
|
||||
- If C(no), SSL certificates will not be validated. This should only be used
|
||||
|
@ -89,7 +89,7 @@ options:
|
|||
notes:
|
||||
- The DNS Made Easy service requires that machines interacting with the API have the proper time and timezone set. Be sure you are within a few seconds of actual time by using NTP.
|
||||
- This module returns record(s) in the "result" element when 'state' is set to 'present'. This value can be be registered and used in your playbooks.
|
||||
|
||||
|
||||
requirements: [ hashlib, hmac ]
|
||||
author: "Brice Burgess (@briceburg)"
|
||||
'''
|
||||
|
@ -102,7 +102,7 @@ EXAMPLES = '''
|
|||
domain: my.com
|
||||
state: present
|
||||
register: response
|
||||
|
||||
|
||||
# create / ensure the presence of a record
|
||||
- dnsmadeeasy:
|
||||
account_key: key
|
||||
|
@ -130,7 +130,7 @@ EXAMPLES = '''
|
|||
state: present
|
||||
record_name: test
|
||||
register: response
|
||||
|
||||
|
||||
# delete a record / ensure it is absent
|
||||
- dnsmadeeasy:
|
||||
account_key: key
|
||||
|
|
|
@ -283,7 +283,7 @@ def map_config_to_obj(module):
|
|||
'state': parse_state(out)
|
||||
}
|
||||
|
||||
def map_params_to_obj(module):
|
||||
def map_params_to_obj(module):
|
||||
obj = {
|
||||
'http': module.params['http'],
|
||||
'http_port': module.params['http_port'],
|
||||
|
@ -310,7 +310,7 @@ def collect_facts(module, result):
|
|||
for each in out[0]['urls']:
|
||||
intf, url = each.split(' : ')
|
||||
key = str(intf).strip()
|
||||
if key not in facts['eos_eapi_urls']:
|
||||
if key not in facts['eos_eapi_urls']:
|
||||
facts['eos_eapi_urls'][key] = list()
|
||||
facts['eos_eapi_urls'][key].append(str(url).strip())
|
||||
result['ansible_facts'] = facts
|
||||
|
|
|
@ -38,7 +38,7 @@ EXAMPLES = '''
|
|||
# Retrieve switch/port information
|
||||
- name: Gather information from lldp
|
||||
lldp:
|
||||
|
||||
|
||||
- name: Print each switch/port
|
||||
debug:
|
||||
msg: "{{ lldp[item]['chassis']['name'] }} / {{ lldp[item]['port']['ifalias'] }}"
|
||||
|
@ -73,7 +73,7 @@ def gather_lldp():
|
|||
current_dict = current_dict[path_component]
|
||||
current_dict[final] = value
|
||||
return output_dict
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule({})
|
||||
|
@ -84,7 +84,7 @@ def main():
|
|||
module.exit_json(ansible_facts=data)
|
||||
except TypeError:
|
||||
module.fail_json(msg="lldpctl command failed. is lldpd running?")
|
||||
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
|
|
|
@ -492,7 +492,7 @@ def main():
|
|||
)
|
||||
module = get_network_module(argument_spec=argument_spec,
|
||||
supports_check_mode=True)
|
||||
|
||||
|
||||
server_type = module.params['server_type']
|
||||
global_key = module.params['global_key']
|
||||
encrypt_type = module.params['encrypt_type']
|
||||
|
|
|
@ -428,7 +428,7 @@ def _match_dict(match_list, key_map):
|
|||
def get_aaa_host_info(module, server_type, address):
|
||||
aaa_host_info = {}
|
||||
command = 'show run | inc {0}-server.host.{1}'.format(server_type, address)
|
||||
|
||||
|
||||
body = execute_show_command(command, module, command_type='cli_show_ascii')
|
||||
|
||||
if body:
|
||||
|
@ -574,7 +574,7 @@ def main():
|
|||
results['updates'] = cmds
|
||||
results['changed'] = changed
|
||||
results['end_state'] = end_state
|
||||
|
||||
|
||||
module.exit_json(**results)
|
||||
|
||||
|
||||
|
|
|
@ -612,7 +612,7 @@ def get_custom_string_value(config, arg, module):
|
|||
elif arg.startswith('dampening'):
|
||||
REGEX = re.compile(r'(?:{0}\s)(?P<value>.*)$'.format(
|
||||
PARAM_TO_COMMAND_KEYMAP[arg]), re.M)
|
||||
if arg == 'dampen_igp_metric' or arg == 'dampening_routemap':
|
||||
if arg == 'dampen_igp_metric' or arg == 'dampening_routemap':
|
||||
value = ''
|
||||
if PARAM_TO_COMMAND_KEYMAP[arg] in config:
|
||||
value = REGEX.search(config).group('value')
|
||||
|
|
|
@ -295,7 +295,7 @@ def main():
|
|||
supports_check_mode=True)
|
||||
|
||||
splitted_ssm_range = module.params['ssm_range'].split('.')
|
||||
if len(splitted_ssm_range) != 4 and module.params['ssm_range'] != 'none':
|
||||
if len(splitted_ssm_range) != 4 and module.params['ssm_range'] != 'none':
|
||||
module.fail_json(msg="Valid ssm_range values are multicast addresses "
|
||||
"or the keyword 'none'.")
|
||||
|
||||
|
|
|
@ -495,10 +495,10 @@ def get_interface_mode(interface, intf_type, module):
|
|||
def get_pim_interface(module, interface):
|
||||
pim_interface = {}
|
||||
command = 'show ip pim interface {0}'.format(interface)
|
||||
|
||||
|
||||
body = execute_show_command(command, module,
|
||||
command_type='cli_show_ascii', text=True)
|
||||
|
||||
|
||||
if body:
|
||||
if 'not running' not in body[0]:
|
||||
body = execute_show_command(command, module)
|
||||
|
@ -552,7 +552,7 @@ def get_pim_interface(module, interface):
|
|||
return {}
|
||||
|
||||
command = 'show run interface {0}'.format(interface)
|
||||
|
||||
|
||||
body = execute_show_command(command, module, command_type='cli_show_ascii')
|
||||
|
||||
jp_configs = []
|
||||
|
|
|
@ -378,7 +378,7 @@ def main():
|
|||
)
|
||||
module = get_network_module(argument_spec=argument_spec,
|
||||
supports_check_mode=True)
|
||||
|
||||
|
||||
|
||||
location = module.params['location']
|
||||
state = module.params['state']
|
||||
|
|
|
@ -463,7 +463,7 @@ def main():
|
|||
)
|
||||
module = get_network_module(argument_spec=argument_spec,
|
||||
supports_check_mode=True)
|
||||
|
||||
|
||||
group = module.params['group'].lower()
|
||||
state = module.params['state']
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ def wakeonlan(module, mac, broadcast, port):
|
|||
int(mac, 16)
|
||||
except ValueError:
|
||||
module.fail_json(msg="Incorrect MAC address format: %s" % mac_orig)
|
||||
|
||||
|
||||
# Create payload for magic packet
|
||||
data = ''
|
||||
padding = ''.join(['FFFFFFFFFFFF', mac * 20])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue