mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix pycodestyle E117 issues.
This commit is contained in:
parent
7b8e814a10
commit
3e778d3f8f
40 changed files with 150 additions and 150 deletions
|
@ -354,13 +354,13 @@ class AzureRM(object):
|
||||||
self.credentials.get('client_id') is not None and \
|
self.credentials.get('client_id') is not None and \
|
||||||
self.credentials.get('tenant') is not None:
|
self.credentials.get('tenant') is not None:
|
||||||
|
|
||||||
self.azure_credentials = self.acquire_token_with_username_password(
|
self.azure_credentials = self.acquire_token_with_username_password(
|
||||||
self._adfs_authority_url,
|
self._adfs_authority_url,
|
||||||
self._resource,
|
self._resource,
|
||||||
self.credentials['ad_user'],
|
self.credentials['ad_user'],
|
||||||
self.credentials['password'],
|
self.credentials['password'],
|
||||||
self.credentials['client_id'],
|
self.credentials['client_id'],
|
||||||
self.credentials['tenant'])
|
self.credentials['tenant'])
|
||||||
|
|
||||||
elif self.credentials.get('ad_user') is not None and self.credentials.get('password') is not None:
|
elif self.credentials.get('ad_user') is not None and self.credentials.get('password') is not None:
|
||||||
tenant = self.credentials.get('tenant')
|
tenant = self.credentials.get('tenant')
|
||||||
|
@ -813,7 +813,7 @@ class AzureInventory(object):
|
||||||
sys.exit("Error: fetching instanceview for host {0} - {1}".format(name, str(exc)))
|
sys.exit("Error: fetching instanceview for host {0} - {1}".format(name, str(exc)))
|
||||||
|
|
||||||
return next((s.code.replace('PowerState/', '')
|
return next((s.code.replace('PowerState/', '')
|
||||||
for s in vm.instance_view.statuses if s.code.startswith('PowerState')), None)
|
for s in vm.instance_view.statuses if s.code.startswith('PowerState')), None)
|
||||||
|
|
||||||
def _add_host(self, vars):
|
def _add_host(self, vars):
|
||||||
|
|
||||||
|
|
|
@ -262,13 +262,13 @@ class AzureRM(object):
|
||||||
self.credentials.get('client_id') is not None and \
|
self.credentials.get('client_id') is not None and \
|
||||||
self.credentials.get('tenant') is not None:
|
self.credentials.get('tenant') is not None:
|
||||||
|
|
||||||
self.azure_credentials = self.acquire_token_with_username_password(
|
self.azure_credentials = self.acquire_token_with_username_password(
|
||||||
self._adfs_authority_url,
|
self._adfs_authority_url,
|
||||||
self._resource,
|
self._resource,
|
||||||
self.credentials['ad_user'],
|
self.credentials['ad_user'],
|
||||||
self.credentials['password'],
|
self.credentials['password'],
|
||||||
self.credentials['client_id'],
|
self.credentials['client_id'],
|
||||||
self.credentials['tenant'])
|
self.credentials['tenant'])
|
||||||
|
|
||||||
elif self.credentials.get('ad_user') is not None and self.credentials.get('password') is not None:
|
elif self.credentials.get('ad_user') is not None and self.credentials.get('password') is not None:
|
||||||
tenant = self.credentials.get('tenant')
|
tenant = self.credentials.get('tenant')
|
||||||
|
|
|
@ -162,9 +162,9 @@ class TaskQueueManager:
|
||||||
try:
|
try:
|
||||||
callback_obj.set_options()
|
callback_obj.set_options()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
display.deprecated("%s callback, does not support setting 'options', it will work for now, "
|
display.deprecated("%s callback, does not support setting 'options', it will work for now, "
|
||||||
" but this will be required in the future and should be updated, "
|
" but this will be required in the future and should be updated, "
|
||||||
" see the 2.4 porting guide for details." % callback_obj._load_name, version="2.9")
|
" see the 2.4 porting guide for details." % callback_obj._load_name, version="2.9")
|
||||||
self._callback_plugins.append(callback_obj)
|
self._callback_plugins.append(callback_obj)
|
||||||
|
|
||||||
self._callbacks_loaded = True
|
self._callbacks_loaded = True
|
||||||
|
|
|
@ -1026,24 +1026,24 @@ class AzureRMAuth(object):
|
||||||
elif self.credentials.get('client_id') is not None and \
|
elif self.credentials.get('client_id') is not None and \
|
||||||
self.credentials.get('secret') is not None and \
|
self.credentials.get('secret') is not None and \
|
||||||
self.credentials.get('tenant') is not None:
|
self.credentials.get('tenant') is not None:
|
||||||
self.azure_credentials = ServicePrincipalCredentials(client_id=self.credentials['client_id'],
|
self.azure_credentials = ServicePrincipalCredentials(client_id=self.credentials['client_id'],
|
||||||
secret=self.credentials['secret'],
|
secret=self.credentials['secret'],
|
||||||
tenant=self.credentials['tenant'],
|
tenant=self.credentials['tenant'],
|
||||||
cloud_environment=self._cloud_environment,
|
cloud_environment=self._cloud_environment,
|
||||||
verify=self._cert_validation_mode == 'validate')
|
verify=self._cert_validation_mode == 'validate')
|
||||||
|
|
||||||
elif self.credentials.get('ad_user') is not None and \
|
elif self.credentials.get('ad_user') is not None and \
|
||||||
self.credentials.get('password') is not None and \
|
self.credentials.get('password') is not None and \
|
||||||
self.credentials.get('client_id') is not None and \
|
self.credentials.get('client_id') is not None and \
|
||||||
self.credentials.get('tenant') is not None:
|
self.credentials.get('tenant') is not None:
|
||||||
|
|
||||||
self.azure_credentials = self.acquire_token_with_username_password(
|
self.azure_credentials = self.acquire_token_with_username_password(
|
||||||
self._adfs_authority_url,
|
self._adfs_authority_url,
|
||||||
self._resource,
|
self._resource,
|
||||||
self.credentials['ad_user'],
|
self.credentials['ad_user'],
|
||||||
self.credentials['password'],
|
self.credentials['password'],
|
||||||
self.credentials['client_id'],
|
self.credentials['client_id'],
|
||||||
self.credentials['tenant'])
|
self.credentials['tenant'])
|
||||||
|
|
||||||
elif self.credentials.get('ad_user') is not None and self.credentials.get('password') is not None:
|
elif self.credentials.get('ad_user') is not None and self.credentials.get('password') is not None:
|
||||||
tenant = self.credentials.get('tenant')
|
tenant = self.credentials.get('tenant')
|
||||||
|
|
|
@ -117,7 +117,7 @@ def dict_merge(a, b):
|
||||||
result = deepcopy(a)
|
result = deepcopy(a)
|
||||||
for k, v in b.items():
|
for k, v in b.items():
|
||||||
if k in result and isinstance(result[k], dict):
|
if k in result and isinstance(result[k], dict):
|
||||||
result[k] = dict_merge(result[k], v)
|
result[k] = dict_merge(result[k], v)
|
||||||
else:
|
else:
|
||||||
result[k] = deepcopy(v)
|
result[k] = deepcopy(v)
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -448,14 +448,14 @@ class LinuxHardware(Hardware):
|
||||||
|
|
||||||
def get_mount_info(self, mount, device, uuids):
|
def get_mount_info(self, mount, device, uuids):
|
||||||
|
|
||||||
mount_size = get_mount_size(mount)
|
mount_size = get_mount_size(mount)
|
||||||
|
|
||||||
# _udevadm_uuid is a fallback for versions of lsblk <= 2.23 that don't have --paths
|
# _udevadm_uuid is a fallback for versions of lsblk <= 2.23 that don't have --paths
|
||||||
# see _run_lsblk() above
|
# see _run_lsblk() above
|
||||||
# https://github.com/ansible/ansible/issues/36077
|
# https://github.com/ansible/ansible/issues/36077
|
||||||
uuid = uuids.get(device, self._udevadm_uuid(device))
|
uuid = uuids.get(device, self._udevadm_uuid(device))
|
||||||
|
|
||||||
return mount_size, uuid
|
return mount_size, uuid
|
||||||
|
|
||||||
def get_mount_facts(self):
|
def get_mount_facts(self):
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,7 @@ class MSOModule(object):
|
||||||
if not t:
|
if not t:
|
||||||
self.module.fail_json(msg="Tenant '%s' is not valid tenant name." % tenant)
|
self.module.fail_json(msg="Tenant '%s' is not valid tenant name." % tenant)
|
||||||
if 'id' not in t:
|
if 'id' not in t:
|
||||||
self.module.fail_json(msg="Tenant lookup failed for tenant '%s': %s" % (tenant, t))
|
self.module.fail_json(msg="Tenant lookup failed for tenant '%s': %s" % (tenant, t))
|
||||||
return t['id']
|
return t['id']
|
||||||
|
|
||||||
def lookup_users(self, users):
|
def lookup_users(self, users):
|
||||||
|
|
|
@ -315,7 +315,7 @@ def create_scalable_target(connection, module):
|
||||||
ScalableDimension=module.params.get('scalable_dimension')
|
ScalableDimension=module.params.get('scalable_dimension')
|
||||||
)
|
)
|
||||||
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
|
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
|
||||||
module.fail_json_aws(e, msg="Failed to describe scalable targets")
|
module.fail_json_aws(e, msg="Failed to describe scalable targets")
|
||||||
|
|
||||||
# Scalable target registration will occur if:
|
# Scalable target registration will occur if:
|
||||||
# 1. There is no scalable target registered for this service
|
# 1. There is no scalable target registered for this service
|
||||||
|
|
|
@ -1411,7 +1411,7 @@ class CloudFrontValidationManager(object):
|
||||||
Comment=comment))
|
Comment=comment))
|
||||||
oai = client.create_cloud_front_origin_access_identity(**cfoai_config)['CloudFrontOriginAccessIdentity']['Id']
|
oai = client.create_cloud_front_origin_access_identity(**cfoai_config)['CloudFrontOriginAccessIdentity']['Id']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.module.fail_json_aws(e, msg="Couldn't create Origin Access Identity for id %s" % origin['id'])
|
self.module.fail_json_aws(e, msg="Couldn't create Origin Access Identity for id %s" % origin['id'])
|
||||||
return "origin-access-identity/cloudfront/%s" % oai
|
return "origin-access-identity/cloudfront/%s" % oai
|
||||||
|
|
||||||
def validate_origin(self, client, existing_config, origin, default_origin_path):
|
def validate_origin(self, client, existing_config, origin, default_origin_path):
|
||||||
|
|
|
@ -147,7 +147,7 @@ class CloudFrontOriginAccessIdentityServiceManager(object):
|
||||||
region, ec2_url, aws_connect_kwargs = get_aws_connection_info(self.module, boto3=True)
|
region, ec2_url, aws_connect_kwargs = get_aws_connection_info(self.module, boto3=True)
|
||||||
self.client = boto3_conn(self.module, conn_type='client', resource=resource, region=region, endpoint=ec2_url, **aws_connect_kwargs)
|
self.client = boto3_conn(self.module, conn_type='client', resource=resource, region=region, endpoint=ec2_url, **aws_connect_kwargs)
|
||||||
except (ClientError, BotoCoreError) as e:
|
except (ClientError, BotoCoreError) as e:
|
||||||
self.module.fail_json_aws(e, msg="Unable to establish connection.")
|
self.module.fail_json_aws(e, msg="Unable to establish connection.")
|
||||||
|
|
||||||
def create_origin_access_identity(self, caller_reference, comment):
|
def create_origin_access_identity(self, caller_reference, comment):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -242,14 +242,14 @@ def main():
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
if found_log_group and module.params['overwrite'] is True:
|
if found_log_group and module.params['overwrite'] is True:
|
||||||
changed = True
|
changed = True
|
||||||
delete_log_group(client=logs, log_group_name=module.params['log_group_name'], module=module)
|
delete_log_group(client=logs, log_group_name=module.params['log_group_name'], module=module)
|
||||||
found_log_group = create_log_group(client=logs,
|
found_log_group = create_log_group(client=logs,
|
||||||
log_group_name=module.params['log_group_name'],
|
log_group_name=module.params['log_group_name'],
|
||||||
kms_key_id=module.params['kms_key_id'],
|
kms_key_id=module.params['kms_key_id'],
|
||||||
tags=module.params['tags'],
|
tags=module.params['tags'],
|
||||||
retention=module.params['retention'],
|
retention=module.params['retention'],
|
||||||
module=module)
|
module=module)
|
||||||
elif not found_log_group:
|
elif not found_log_group:
|
||||||
changed = True
|
changed = True
|
||||||
found_log_group = create_log_group(client=logs,
|
found_log_group = create_log_group(client=logs,
|
||||||
|
|
|
@ -783,7 +783,7 @@ class AzureRMWebApps(AzureRMModuleBase):
|
||||||
if self.site_config.get(fx_version):
|
if self.site_config.get(fx_version):
|
||||||
if not getattr(existing_config, fx_version) or \
|
if not getattr(existing_config, fx_version) or \
|
||||||
getattr(existing_config, fx_version).upper() != self.site_config.get(fx_version).upper():
|
getattr(existing_config, fx_version).upper() != self.site_config.get(fx_version).upper():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -671,7 +671,7 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
|
||||||
if self.site_config.get(fx_version):
|
if self.site_config.get(fx_version):
|
||||||
if not getattr(existing_config, fx_version) or \
|
if not getattr(existing_config, fx_version) or \
|
||||||
getattr(existing_config, fx_version).upper() != self.site_config.get(fx_version).upper():
|
getattr(existing_config, fx_version).upper() != self.site_config.get(fx_version).upper():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if self.auto_swap_slot_name is False and existing_config.auto_swap_slot_name is not None:
|
if self.auto_swap_slot_name is False and existing_config.auto_swap_slot_name is not None:
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -263,7 +263,7 @@ class VmBootManager(PyVmomi):
|
||||||
if self.params.get('secure_boot_enabled') and \
|
if self.params.get('secure_boot_enabled') and \
|
||||||
self.params.get('boot_firmware') is None and \
|
self.params.get('boot_firmware') is None and \
|
||||||
self.vm.config.firmware == 'bios':
|
self.vm.config.firmware == 'bios':
|
||||||
self.module.fail_json(msg="EFI secure boot cannot be enabled when boot_firmware = bios. VM's boot_firmware currently set to bios")
|
self.module.fail_json(msg="EFI secure boot cannot be enabled when boot_firmware = bios. VM's boot_firmware currently set to bios")
|
||||||
|
|
||||||
kwargs.update({'efiSecureBootEnabled': self.params.get('secure_boot_enabled')})
|
kwargs.update({'efiSecureBootEnabled': self.params.get('secure_boot_enabled')})
|
||||||
change_needed = True
|
change_needed = True
|
||||||
|
|
|
@ -100,7 +100,7 @@ class AnsibleVultrOSFacts(Vultr):
|
||||||
|
|
||||||
|
|
||||||
def parse_oses_list(oses_list):
|
def parse_oses_list(oses_list):
|
||||||
return [os for id, os in oses_list.items()]
|
return [os for id, os in oses_list.items()]
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -190,7 +190,7 @@ def shard_find(client, shard):
|
||||||
else:
|
else:
|
||||||
s = shard
|
s = shard
|
||||||
for shard in client["config"].shards.find({"_id": s}):
|
for shard in client["config"].shards.find({"_id": s}):
|
||||||
return shard
|
return shard
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -349,9 +349,9 @@ def main():
|
||||||
msg='psycopg2 must be at least 2.4.3 in order to user the ssl_rootcert parameter')
|
msg='psycopg2 must be at least 2.4.3 in order to user the ssl_rootcert parameter')
|
||||||
|
|
||||||
if module.check_mode and concurrent:
|
if module.check_mode and concurrent:
|
||||||
module.fail_json(msg="Cannot concurrently create or drop index %s "
|
module.fail_json(msg="Cannot concurrently create or drop index %s "
|
||||||
"inside the transaction block. The check is possible "
|
"inside the transaction block. The check is possible "
|
||||||
"in not concurrent mode only" % idxname)
|
"in not concurrent mode only" % idxname)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
db_connection = psycopg2.connect(**kw)
|
db_connection = psycopg2.connect(**kw)
|
||||||
|
|
|
@ -101,7 +101,7 @@ class Namespace(object):
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
if self.state == 'present' and self.exists():
|
if self.state == 'present' and self.exists():
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
elif self.state == 'absent' and self.exists():
|
elif self.state == 'absent' and self.exists():
|
||||||
changed = True
|
changed = True
|
||||||
|
|
|
@ -319,14 +319,14 @@ def main():
|
||||||
if module.params['save']:
|
if module.params['save']:
|
||||||
result['changed'] = True
|
result['changed'] = True
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
cmd = {'command': 'copy running-config startup-config',
|
cmd = {'command': 'copy running-config startup-config',
|
||||||
'prompt': r'\(y/n\)\s?$', 'answer': 'y'}
|
'prompt': r'\(y/n\)\s?$', 'answer': 'y'}
|
||||||
run_commands(module, [cmd])
|
run_commands(module, [cmd])
|
||||||
result['saved'] = True
|
result['saved'] = True
|
||||||
else:
|
else:
|
||||||
module.warn('Skipping command `copy running-config startup-config`'
|
module.warn('Skipping command `copy running-config startup-config`'
|
||||||
'due to check_mode. Configuration not copied to '
|
'due to check_mode. Configuration not copied to '
|
||||||
'non-volatile storage')
|
'non-volatile storage')
|
||||||
|
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ def parse_key_id(line, dest):
|
||||||
|
|
||||||
def parse_auth(dest):
|
def parse_auth(dest):
|
||||||
if dest == 'authenticate':
|
if dest == 'authenticate':
|
||||||
return dest
|
return dest
|
||||||
|
|
||||||
|
|
||||||
def map_config_to_obj(module):
|
def map_config_to_obj(module):
|
||||||
|
|
|
@ -332,40 +332,40 @@ def map_obj_to_commands(updates, module):
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
|
|
||||||
if needs_update(want, have, 'route_import_ipv4'):
|
if needs_update(want, have, 'route_import_ipv4'):
|
||||||
cmd = 'address-family ipv4'
|
cmd = 'address-family ipv4'
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
for route in want['route_import_ipv4']:
|
for route in want['route_import_ipv4']:
|
||||||
cmd = 'route-target import %s' % route
|
cmd = 'route-target import %s' % route
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
|
||||||
cmd = 'exit-address-family'
|
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
|
cmd = 'exit-address-family'
|
||||||
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
|
|
||||||
if needs_update(want, have, 'route_export_ipv4'):
|
if needs_update(want, have, 'route_export_ipv4'):
|
||||||
cmd = 'address-family ipv4'
|
cmd = 'address-family ipv4'
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
for route in want['route_export_ipv4']:
|
for route in want['route_export_ipv4']:
|
||||||
cmd = 'route-target export %s' % route
|
cmd = 'route-target export %s' % route
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
|
||||||
cmd = 'exit-address-family'
|
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
|
cmd = 'exit-address-family'
|
||||||
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
|
|
||||||
if needs_update(want, have, 'route_import_ipv6'):
|
if needs_update(want, have, 'route_import_ipv6'):
|
||||||
cmd = 'address-family ipv6'
|
cmd = 'address-family ipv6'
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
for route in want['route_import_ipv6']:
|
for route in want['route_import_ipv6']:
|
||||||
cmd = 'route-target import %s' % route
|
cmd = 'route-target import %s' % route
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
|
||||||
cmd = 'exit-address-family'
|
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
|
cmd = 'exit-address-family'
|
||||||
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
|
|
||||||
if needs_update(want, have, 'route_export_ipv6'):
|
if needs_update(want, have, 'route_export_ipv6'):
|
||||||
cmd = 'address-family ipv6'
|
cmd = 'address-family ipv6'
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
for route in want['route_export_ipv6']:
|
for route in want['route_export_ipv6']:
|
||||||
cmd = 'route-target export %s' % route
|
cmd = 'route-target export %s' % route
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
|
||||||
cmd = 'exit-address-family'
|
|
||||||
add_command_to_vrf(want['name'], cmd, commands)
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
|
cmd = 'exit-address-family'
|
||||||
|
add_command_to_vrf(want['name'], cmd, commands)
|
||||||
|
|
||||||
if want['interfaces'] is not None:
|
if want['interfaces'] is not None:
|
||||||
# handle the deletes
|
# handle the deletes
|
||||||
|
|
|
@ -209,7 +209,7 @@ def get_admin_id(meraki, data, name=None, email=None):
|
||||||
admin_id = a['id']
|
admin_id = a['id']
|
||||||
elif meraki.params['email']:
|
elif meraki.params['email']:
|
||||||
if meraki.params['email'] == a['email']:
|
if meraki.params['email'] == a['email']:
|
||||||
return a['id']
|
return a['id']
|
||||||
if admin_id is None:
|
if admin_id is None:
|
||||||
meraki.fail_json(msg='No admin_id found')
|
meraki.fail_json(msg='No admin_id found')
|
||||||
return admin_id
|
return admin_id
|
||||||
|
|
|
@ -144,11 +144,11 @@ def assemble_payload(meraki):
|
||||||
|
|
||||||
|
|
||||||
def get_rules(meraki, net_id, number):
|
def get_rules(meraki, net_id, number):
|
||||||
path = meraki.construct_path('get_all', net_id=net_id)
|
path = meraki.construct_path('get_all', net_id=net_id)
|
||||||
path = path + number + '/l3FirewallRules'
|
path = path + number + '/l3FirewallRules'
|
||||||
response = meraki.request(path, method='GET')
|
response = meraki.request(path, method='GET')
|
||||||
if meraki.status == 200:
|
if meraki.status == 200:
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
def get_ssid_number(name, data):
|
def get_ssid_number(name, data):
|
||||||
|
|
|
@ -211,10 +211,10 @@ def assemble_payload(meraki):
|
||||||
|
|
||||||
|
|
||||||
def get_rules(meraki, net_id):
|
def get_rules(meraki, net_id):
|
||||||
path = meraki.construct_path('get_all', net_id=net_id)
|
path = meraki.construct_path('get_all', net_id=net_id)
|
||||||
response = meraki.request(path, method='GET')
|
response = meraki.request(path, method='GET')
|
||||||
if meraki.status == 200:
|
if meraki.status == 200:
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -181,7 +181,7 @@ def set_snmp(meraki, org_id):
|
||||||
meraki.params['v3_auth_pass'] is None or
|
meraki.params['v3_auth_pass'] is None or
|
||||||
meraki.params['v3_priv_mode'] is None or
|
meraki.params['v3_priv_mode'] is None or
|
||||||
meraki.params['v3_priv_pass'] is None):
|
meraki.params['v3_priv_pass'] is None):
|
||||||
meraki.fail_json(msg='v3_auth_mode, v3_auth_pass, v3_priv_mode, and v3_auth_pass are required')
|
meraki.fail_json(msg='v3_auth_mode, v3_auth_pass, v3_priv_mode, and v3_auth_pass are required')
|
||||||
payload = {'v3Enabled': meraki.params['v3_enabled'],
|
payload = {'v3Enabled': meraki.params['v3_enabled'],
|
||||||
'v3AuthMode': meraki.params['v3_auth_mode'].upper(),
|
'v3AuthMode': meraki.params['v3_auth_mode'].upper(),
|
||||||
'v3AuthPass': meraki.params['v3_auth_pass'],
|
'v3AuthPass': meraki.params['v3_auth_pass'],
|
||||||
|
|
|
@ -168,7 +168,7 @@ def main():
|
||||||
cli += ' %s community-string %s ' % (command, comm_str)
|
cli += ' %s community-string %s ' % (command, comm_str)
|
||||||
|
|
||||||
if command != 'snmp-community-delete' and community_type:
|
if command != 'snmp-community-delete' and community_type:
|
||||||
cli += ' community-type ' + community_type
|
cli += ' community-type ' + community_type
|
||||||
|
|
||||||
run_cli(module, cli, state_map)
|
run_cli(module, cli, state_map)
|
||||||
|
|
||||||
|
|
|
@ -272,13 +272,13 @@ def main():
|
||||||
commands, parents = state_absent(module, existing, proposed)
|
commands, parents = state_absent(module, existing, proposed)
|
||||||
|
|
||||||
if commands:
|
if commands:
|
||||||
candidate = CustomNetworkConfig(indent=3)
|
candidate = CustomNetworkConfig(indent=3)
|
||||||
candidate.add(commands, parents=parents)
|
candidate.add(commands, parents=parents)
|
||||||
candidate = candidate.items_text()
|
candidate = candidate.items_text()
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
load_config(module, candidate)
|
load_config(module, candidate)
|
||||||
results['changed'] = True
|
results['changed'] = True
|
||||||
results['commands'] = candidate
|
results['commands'] = candidate
|
||||||
else:
|
else:
|
||||||
results['commands'] = []
|
results['commands'] = []
|
||||||
module.exit_json(**results)
|
module.exit_json(**results)
|
||||||
|
|
|
@ -383,15 +383,15 @@ def config_igmp_interface(delta, existing, existing_oif_prefix_source):
|
||||||
commands.append(CMDS.get('oif_prefix').format(pf))
|
commands.append(CMDS.get('oif_prefix').format(pf))
|
||||||
if existing_oif_prefix_source:
|
if existing_oif_prefix_source:
|
||||||
for each in existing_oif_prefix_source:
|
for each in existing_oif_prefix_source:
|
||||||
# remove stale prefix/sources
|
# remove stale prefix/sources
|
||||||
pf = each['prefix']
|
pf = each['prefix']
|
||||||
src = ''
|
src = ''
|
||||||
if 'source' in each.keys():
|
if 'source' in each.keys():
|
||||||
src = each['source']
|
src = each['source']
|
||||||
if src:
|
if src:
|
||||||
commands.append('no ' + CMDS.get('oif_prefix_source').format(pf, src))
|
commands.append('no ' + CMDS.get('oif_prefix_source').format(pf, src))
|
||||||
else:
|
else:
|
||||||
commands.append('no ' + CMDS.get('oif_prefix').format(pf))
|
commands.append('no ' + CMDS.get('oif_prefix').format(pf))
|
||||||
elif key == 'oif_routemap':
|
elif key == 'oif_routemap':
|
||||||
if value == 'default':
|
if value == 'default':
|
||||||
if existing.get(key):
|
if existing.get(key):
|
||||||
|
|
|
@ -196,7 +196,7 @@ def run(module, result):
|
||||||
result['updates'] = total_commands
|
result['updates'] = total_commands
|
||||||
|
|
||||||
if module.params['save']:
|
if module.params['save']:
|
||||||
total_commands.append('configuration write')
|
total_commands.append('configuration write')
|
||||||
if total_commands:
|
if total_commands:
|
||||||
result['changed'] = True
|
result['changed'] = True
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
|
|
|
@ -170,7 +170,7 @@ def map_config_to_obj(module):
|
||||||
obj['key'] = module.params['key']
|
obj['key'] = module.params['key']
|
||||||
obj['value'] = col_value_to_dict[module.params['key']]
|
obj['value'] = col_value_to_dict[module.params['key']]
|
||||||
else:
|
else:
|
||||||
obj['value'] = str(col_value.strip())
|
obj['value'] = str(col_value.strip())
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
smtp.ehlo()
|
smtp.ehlo()
|
||||||
except smtplib.SMTPException as e:
|
except smtplib.SMTPException as e:
|
||||||
module.fail_json(rc=1, msg='Helo failed for host %s:%s: %s' % (host, port, to_native(e)), exception=traceback.format_exc())
|
module.fail_json(rc=1, msg='Helo failed for host %s:%s: %s' % (host, port, to_native(e)), exception=traceback.format_exc())
|
||||||
|
|
||||||
if int(code) > 0:
|
if int(code) > 0:
|
||||||
if not secure_state and secure in ('starttls', 'try'):
|
if not secure_state and secure in ('starttls', 'try'):
|
||||||
|
|
|
@ -837,7 +837,7 @@ class DnfModule(YumDnf):
|
||||||
if self.allow_downgrade:
|
if self.allow_downgrade:
|
||||||
self.base.package_install(pkg)
|
self.base.package_install(pkg)
|
||||||
else:
|
else:
|
||||||
self.base.package_install(pkg)
|
self.base.package_install(pkg)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.module.fail_json(
|
self.module.fail_json(
|
||||||
msg="Error occured attempting remote rpm operation: {0}".format(to_native(e)),
|
msg="Error occured attempting remote rpm operation: {0}".format(to_native(e)),
|
||||||
|
|
|
@ -159,11 +159,11 @@ def run_module():
|
||||||
'{1} '.format(alu, to_native(e)),
|
'{1} '.format(alu, to_native(e)),
|
||||||
**result)
|
**result)
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg='No such storage group named '
|
module.fail_json(msg='No such storage group named '
|
||||||
'{0}'.format(module.params['name']),
|
'{0}'.format(module.params['name']),
|
||||||
**result)
|
**result)
|
||||||
except VNXCredentialError as e:
|
except VNXCredentialError as e:
|
||||||
module.fail_json(msg='{0}'.format(to_native(e)), **result)
|
module.fail_json(msg='{0}'.format(to_native(e)), **result)
|
||||||
|
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
|
@ -490,15 +490,15 @@ class ElementSWSnapShotSchedule(object):
|
||||||
if schedule_detail.frequency.days != temp_frequency.days or \
|
if schedule_detail.frequency.days != temp_frequency.days or \
|
||||||
schedule_detail.frequency.hours != temp_frequency.hours or \
|
schedule_detail.frequency.hours != temp_frequency.hours or \
|
||||||
schedule_detail.frequency.minutes != temp_frequency.minutes:
|
schedule_detail.frequency.minutes != temp_frequency.minutes:
|
||||||
update_schedule = True
|
update_schedule = True
|
||||||
changed = True
|
changed = True
|
||||||
elif self.schedule_type == "DaysOfMonthFrequency":
|
elif self.schedule_type == "DaysOfMonthFrequency":
|
||||||
# Check if there is any change in schedule.frequency, If schedule_type is days_of_month
|
# Check if there is any change in schedule.frequency, If schedule_type is days_of_month
|
||||||
if len(schedule_detail.frequency.monthdays) != len(temp_frequency.monthdays) or \
|
if len(schedule_detail.frequency.monthdays) != len(temp_frequency.monthdays) or \
|
||||||
schedule_detail.frequency.hours != temp_frequency.hours or \
|
schedule_detail.frequency.hours != temp_frequency.hours or \
|
||||||
schedule_detail.frequency.minutes != temp_frequency.minutes:
|
schedule_detail.frequency.minutes != temp_frequency.minutes:
|
||||||
update_schedule = True
|
update_schedule = True
|
||||||
changed = True
|
changed = True
|
||||||
elif len(schedule_detail.frequency.monthdays) == len(temp_frequency.monthdays):
|
elif len(schedule_detail.frequency.monthdays) == len(temp_frequency.monthdays):
|
||||||
actual_frequency_monthday = schedule_detail.frequency.monthdays
|
actual_frequency_monthday = schedule_detail.frequency.monthdays
|
||||||
temp_frequency_monthday = temp_frequency.monthdays
|
temp_frequency_monthday = temp_frequency.monthdays
|
||||||
|
@ -511,15 +511,15 @@ class ElementSWSnapShotSchedule(object):
|
||||||
if len(schedule_detail.frequency.weekdays) != len(temp_frequency.weekdays) or \
|
if len(schedule_detail.frequency.weekdays) != len(temp_frequency.weekdays) or \
|
||||||
schedule_detail.frequency.hours != temp_frequency.hours or \
|
schedule_detail.frequency.hours != temp_frequency.hours or \
|
||||||
schedule_detail.frequency.minutes != temp_frequency.minutes:
|
schedule_detail.frequency.minutes != temp_frequency.minutes:
|
||||||
update_schedule = True
|
update_schedule = True
|
||||||
changed = True
|
changed = True
|
||||||
elif len(schedule_detail.frequency.weekdays) == len(temp_frequency.weekdays):
|
elif len(schedule_detail.frequency.weekdays) == len(temp_frequency.weekdays):
|
||||||
actual_frequency_weekdays = schedule_detail.frequency.weekdays
|
actual_frequency_weekdays = schedule_detail.frequency.weekdays
|
||||||
temp_frequency_weekdays = temp_frequency.weekdays
|
temp_frequency_weekdays = temp_frequency.weekdays
|
||||||
if len([actual_weekday for actual_weekday, temp_weekday in
|
if len([actual_weekday for actual_weekday, temp_weekday in
|
||||||
zip(actual_frequency_weekdays, temp_frequency_weekdays) if actual_weekday != temp_weekday]) != 0:
|
zip(actual_frequency_weekdays, temp_frequency_weekdays) if actual_weekday != temp_weekday]) != 0:
|
||||||
update_schedule = True
|
update_schedule = True
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
update_schedule = True
|
update_schedule = True
|
||||||
changed = True
|
changed = True
|
||||||
|
|
|
@ -340,8 +340,8 @@ class ElementOSVolume(object):
|
||||||
volume_qos = volume_detail.qos.__dict__
|
volume_qos = volume_detail.qos.__dict__
|
||||||
if volume_qos['min_iops'] != self.qos['minIOPS'] or volume_qos['max_iops'] != self.qos['maxIOPS'] \
|
if volume_qos['min_iops'] != self.qos['minIOPS'] or volume_qos['max_iops'] != self.qos['maxIOPS'] \
|
||||||
or volume_qos['burst_iops'] != self.qos['burstIOPS']:
|
or volume_qos['burst_iops'] != self.qos['burstIOPS']:
|
||||||
update_volume = True
|
update_volume = True
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
# If check fails, do nothing
|
# If check fails, do nothing
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -233,7 +233,7 @@ class ElementOSVolumeClone(object):
|
||||||
result_message = ""
|
result_message = ""
|
||||||
|
|
||||||
if self.get_account_id() is None:
|
if self.get_account_id() is None:
|
||||||
self.module.fail_json(msg="Account id not found: %s" % (self.account_id))
|
self.module.fail_json(msg="Account id not found: %s" % (self.account_id))
|
||||||
|
|
||||||
# there is only one state. other operations
|
# there is only one state. other operations
|
||||||
# are part of the volume module
|
# are part of the volume module
|
||||||
|
@ -245,7 +245,7 @@ class ElementOSVolumeClone(object):
|
||||||
if self.get_src_volume_id() is not None:
|
if self.get_src_volume_id() is not None:
|
||||||
# check for a valid snapshot
|
# check for a valid snapshot
|
||||||
if self.src_snapshot_id and not self.get_snapshot_id():
|
if self.src_snapshot_id and not self.get_snapshot_id():
|
||||||
self.module.fail_json(msg="Snapshot id not found: %s" % (self.src_snapshot_id))
|
self.module.fail_json(msg="Snapshot id not found: %s" % (self.src_snapshot_id))
|
||||||
# change required
|
# change required
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -94,12 +94,12 @@ class NetAppONTAPCommand(object):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""
|
"""
|
||||||
Execute action from playbook
|
Execute action from playbook
|
||||||
"""
|
"""
|
||||||
command = NetAppONTAPCommand()
|
command = NetAppONTAPCommand()
|
||||||
command.apply()
|
command.apply()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -294,8 +294,8 @@ class DataLoader:
|
||||||
|
|
||||||
# if path is in role and 'tasks' not there already, add it into the search
|
# if path is in role and 'tasks' not there already, add it into the search
|
||||||
if (is_role or self._is_role(path)) and b_mydir.endswith(b'tasks'):
|
if (is_role or self._is_role(path)) and b_mydir.endswith(b'tasks'):
|
||||||
search.append(os.path.join(os.path.dirname(b_mydir), b_dirname, b_source))
|
search.append(os.path.join(os.path.dirname(b_mydir), b_dirname, b_source))
|
||||||
search.append(os.path.join(b_mydir, b_source))
|
search.append(os.path.join(b_mydir, b_source))
|
||||||
else:
|
else:
|
||||||
# don't add dirname if user already is using it in source
|
# don't add dirname if user already is using it in source
|
||||||
if b_source.split(b'/')[0] != dirname:
|
if b_source.split(b'/')[0] != dirname:
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
|
|
||||||
class ModuleDocFragment(object):
|
class ModuleDocFragment(object):
|
||||||
# GCP doc fragment.
|
# GCP doc fragment.
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
options:
|
options:
|
||||||
project:
|
project:
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -75,7 +75,7 @@ try:
|
||||||
if LooseVersion(requests.__version__) < LooseVersion('1.1.0'):
|
if LooseVersion(requests.__version__) < LooseVersion('1.1.0'):
|
||||||
raise ImportError
|
raise ImportError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise AnsibleError('This script requires python-requests 1.1 as a minimum version')
|
raise AnsibleError('This script requires python-requests 1.1 as a minimum version')
|
||||||
|
|
||||||
from requests.auth import HTTPBasicAuth
|
from requests.auth import HTTPBasicAuth
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue