summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/modules/cloud/amazon/aws_kms.py4
-rw-r--r--lib/ansible/modules/cloud/amazon/ecs_task.py10
-rw-r--r--lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py4
-rw-r--r--lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py2
-rw-r--r--lib/ansible/modules/cloud/openstack/os_server.py3
-rw-r--r--lib/ansible/modules/cloud/vmware/vsphere_guest.py7
-rw-r--r--lib/ansible/modules/database/mongodb/mongodb_user.py2
-rw-r--r--lib/ansible/modules/net_tools/dnsmadeeasy.py10
-rw-r--r--lib/ansible/modules/net_tools/snmp_facts.py2
-rw-r--r--lib/ansible/modules/network/aos/aos_blueprint.py8
-rw-r--r--lib/ansible/modules/network/aos/aos_device.py12
-rw-r--r--lib/ansible/modules/network/aos/aos_external_router.py8
-rw-r--r--lib/ansible/modules/network/aos/aos_ip_pool.py8
-rw-r--r--lib/ansible/modules/network/aos/aos_logical_device.py8
-rw-r--r--lib/ansible/modules/network/aos/aos_logical_device_map.py8
-rw-r--r--lib/ansible/modules/network/aos/aos_rack_type.py8
-rw-r--r--lib/ansible/modules/network/aos/aos_template.py8
-rw-r--r--lib/ansible/modules/network/sros/sros_rollback.py2
-rw-r--r--lib/ansible/modules/packaging/language/maven_artifact.py2
19 files changed, 56 insertions, 60 deletions
diff --git a/lib/ansible/modules/cloud/amazon/aws_kms.py b/lib/ansible/modules/cloud/amazon/aws_kms.py
index 27750f60d7..eeed72b9be 100644
--- a/lib/ansible/modules/cloud/amazon/aws_kms.py
+++ b/lib/ansible/modules/cloud/amazon/aws_kms.py
@@ -182,7 +182,7 @@ def do_grant(kms, keyarn, role_arn, granttypes, mode='grant', dry_run=True, clea
statement['Principal']['AWS'] = valid_entries
had_invalid_entries = True
- if not role_arn in statement['Principal']['AWS']: # needs to be added.
+ if role_arn not in statement['Principal']['AWS']: # needs to be added.
changes_needed[granttype] = 'add'
statement['Principal']['AWS'].append(role_arn)
elif role_arn in statement['Principal']['AWS']: # not one the places the role should be
@@ -281,7 +281,7 @@ def main():
# check the grant types for 'grant' only.
if mode == 'grant':
for g in module.params['grant_types']:
- if not g in statement_label:
+ if g not in statement_label:
module.fail_json(msg='{} is an unknown grant type.'.format(g))
ret = do_grant(kms, module.params['key_arn'], module.params['role_arn'], module.params['grant_types'],
diff --git a/lib/ansible/modules/cloud/amazon/ecs_task.py b/lib/ansible/modules/cloud/amazon/ecs_task.py
index aa4cb6ad90..9b2f39a7df 100644
--- a/lib/ansible/modules/cloud/amazon/ecs_task.py
+++ b/lib/ansible/modules/cloud/amazon/ecs_task.py
@@ -249,23 +249,23 @@ def main():
# Validate Inputs
if module.params['operation'] == 'run':
- if not 'task_definition' in module.params and module.params['task_definition'] is None:
+ if 'task_definition' not in module.params and module.params['task_definition'] is None:
module.fail_json(msg="To run a task, a task_definition must be specified")
task_to_list = module.params['task_definition']
status_type = "RUNNING"
if module.params['operation'] == 'start':
- if not 'task_definition' in module.params and module.params['task_definition'] is None:
+ if 'task_definition' not in module.params and module.params['task_definition'] is None:
module.fail_json(msg="To start a task, a task_definition must be specified")
- if not 'container_instances' in module.params and module.params['container_instances'] is None:
+ if 'container_instances' not in module.params and module.params['container_instances'] is None:
module.fail_json(msg="To start a task, container instances must be specified")
task_to_list = module.params['task']
status_type = "RUNNING"
if module.params['operation'] == 'stop':
- if not 'task' in module.params and module.params['task'] is None:
+ if 'task' not in module.params and module.params['task'] is None:
module.fail_json(msg="To stop a task, a task must be specified")
- if not 'task_definition' in module.params and module.params['task_definition'] is None:
+ if 'task_definition' not in module.params and module.params['task_definition'] is None:
module.fail_json(msg="To stop a task, a task definition must be specified")
task_to_list = module.params['task_definition']
status_type = "STOPPED"
diff --git a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py
index 942d6b0082..df991870b9 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py
@@ -453,7 +453,7 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
)
]
)
- #nic.name = self.name
+ # nic.name = self.name
nic.ip_configurations[0].subnet = Subnet(id=subnet.id)
nic.ip_configurations[0].name = 'default'
nic.network_security_group = NetworkSecurityGroup(id=nsg.id,
@@ -483,7 +483,7 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
results['ip_configuration']['subnet']['name'])
nic.ip_configurations[0].subnet = Subnet(id=subnet.id)
nic.ip_configurations[0].name = results['ip_configuration']['name']
- #nic.name = name=results['name'],
+ # nic.name = name=results['name'],
if results['ip_configuration'].get('private_ip_address'):
nic.ip_configurations[0].private_ip_address = results['ip_configuration']['private_ip_address']
diff --git a/lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py b/lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py
index e34d99381b..b03eea2c49 100644
--- a/lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py
+++ b/lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py
@@ -796,7 +796,7 @@ class ClcLoadBalancer:
for node in nodes_to_add:
if not node.get('status'):
node['status'] = 'enabled'
- if not node in nodes:
+ if node not in nodes:
changed = True
nodes.append(node)
if changed is True and not self.module.check_mode:
diff --git a/lib/ansible/modules/cloud/openstack/os_server.py b/lib/ansible/modules/cloud/openstack/os_server.py
index 751546b745..c4748beb79 100644
--- a/lib/ansible/modules/cloud/openstack/os_server.py
+++ b/lib/ansible/modules/cloud/openstack/os_server.py
@@ -669,8 +669,7 @@ def _get_server_state(module, cloud):
if server and state == 'present':
if server.status not in ('ACTIVE', 'SHUTOFF', 'PAUSED', 'SUSPENDED'):
module.fail_json(
- msg="The instance is available but not Active state: "
- + server.status)
+ msg="The instance is available but not Active state: " + server.status)
(ip_changed, server) = _check_ips(module, cloud, server)
(sg_changed, server) = _check_security_groups(module, cloud, server)
(server_changed, server) = _update_server(module, cloud, server)
diff --git a/lib/ansible/modules/cloud/vmware/vsphere_guest.py b/lib/ansible/modules/cloud/vmware/vsphere_guest.py
index d7cb384a2a..4bbc141749 100644
--- a/lib/ansible/modules/cloud/vmware/vsphere_guest.py
+++ b/lib/ansible/modules/cloud/vmware/vsphere_guest.py
@@ -525,17 +525,14 @@ def find_datastore(module, s, datastore, config_target):
ds = None
if config_target:
for d in config_target.Datastore:
- if (d.Datastore.Accessible and
- (datastore and d.Datastore.Name == datastore)
- or (not datastore)):
+ if d.Datastore.Accessible and (datastore and d.Datastore.Name == datastore) or (not datastore):
ds = d.Datastore.Datastore
datastore = d.Datastore.Name
break
else:
for ds_mor, ds_name in s.get_datastores().items():
ds_props = VIProperty(s, ds_mor)
- if (ds_props.summary.accessible and (datastore and ds_name == datastore)
- or (not datastore)):
+ if ds_props.summary.accessible and (datastore and ds_name == datastore) or (not datastore):
ds = ds_mor
datastore = ds_name
if not ds:
diff --git a/lib/ansible/modules/database/mongodb/mongodb_user.py b/lib/ansible/modules/database/mongodb/mongodb_user.py
index 9e00e967e4..29fd4345be 100644
--- a/lib/ansible/modules/database/mongodb/mongodb_user.py
+++ b/lib/ansible/modules/database/mongodb/mongodb_user.py
@@ -442,7 +442,7 @@ def main():
module.fail_json(msg='Unable to add or update user: %s' % to_native(e), exception=traceback.format_exc())
# Here we can check password change if mongo provide a query for that : https://jira.mongodb.org/browse/SERVER-22848
- #newuinfo = user_find(client, user, db_name)
+ # newuinfo = user_find(client, user, db_name)
# if uinfo['role'] == newuinfo['role'] and CheckPasswordHere:
# module.exit_json(changed=False, user=user)
diff --git a/lib/ansible/modules/net_tools/dnsmadeeasy.py b/lib/ansible/modules/net_tools/dnsmadeeasy.py
index f560f32d87..e4093359af 100644
--- a/lib/ansible/modules/net_tools/dnsmadeeasy.py
+++ b/lib/ansible/modules/net_tools/dnsmadeeasy.py
@@ -494,7 +494,7 @@ class DME2(object):
return self.query(self.record_url, 'GET')['data']
def _instMap(self, type):
- #@TODO cache this call so it's executed only once per ansible execution
+ # @TODO cache this call so it's executed only once per ansible execution
map = {}
results = {}
@@ -512,15 +512,15 @@ class DME2(object):
return json.dumps(data, separators=(',', ':'))
def createRecord(self, data):
- #@TODO update the cache w/ resultant record + id when impleneted
+ # @TODO update the cache w/ resultant record + id when impleneted
return self.query(self.record_url, 'POST', data)
def updateRecord(self, record_id, data):
- #@TODO update the cache w/ resultant record + id when impleneted
+ # @TODO update the cache w/ resultant record + id when impleneted
return self.query(self.record_url + '/' + str(record_id), 'PUT', data)
def deleteRecord(self, record_id):
- #@TODO remove record from the cache when impleneted
+ # @TODO remove record from the cache when impleneted
return self.query(self.record_url + '/' + str(record_id), 'DELETE')
def getMonitor(self, record_id):
@@ -676,7 +676,7 @@ def main():
# Follow Keyword Controlled Behavior
if state == 'present':
# return the record if no value is specified
- if not "value" in new_record:
+ if "value" not in new_record:
if not current_record:
module.fail_json(
msg="A record with name '%s' does not exist for domain '%s.'" % (record_name, module.params['domain']))
diff --git a/lib/ansible/modules/net_tools/snmp_facts.py b/lib/ansible/modules/net_tools/snmp_facts.py
index c37c1837a6..063dbe9062 100644
--- a/lib/ansible/modules/net_tools/snmp_facts.py
+++ b/lib/ansible/modules/net_tools/snmp_facts.py
@@ -356,7 +356,7 @@ def main():
'address': ipv4_networks[ipv4_network]['address'],
'netmask': ipv4_networks[ipv4_network]['netmask']
}
- if not current_interface in interface_to_ipv4:
+ if current_interface not in interface_to_ipv4:
interface_to_ipv4[current_interface] = []
interface_to_ipv4[current_interface].append(current_network)
else:
diff --git a/lib/ansible/modules/network/aos/aos_blueprint.py b/lib/ansible/modules/network/aos/aos_blueprint.py
index f61f9ba203..df74271854 100644
--- a/lib/ansible/modules/network/aos/aos_blueprint.py
+++ b/lib/ansible/modules/network/aos/aos_blueprint.py
@@ -245,9 +245,9 @@ def aos_blueprint(module):
elif margs['id'] is not None:
item_id = margs['id']
- #----------------------------------------------------
+ # ----------------------------------------------------
# Find Object if available based on ID or Name
- #----------------------------------------------------
+ # ----------------------------------------------------
try:
my_blueprint = find_collection_item(aos.Blueprints,
item_name=item_name,
@@ -255,9 +255,9 @@ def aos_blueprint(module):
except:
module.fail_json(msg="Unable to find the Blueprint based on name or ID, something went wrong")
- #----------------------------------------------------
+ # ----------------------------------------------------
# Proceed based on State value
- #----------------------------------------------------
+ # ----------------------------------------------------
if margs['state'] == 'absent':
ensure_absent(module, aos, my_blueprint)
diff --git a/lib/ansible/modules/network/aos/aos_device.py b/lib/ansible/modules/network/aos/aos_device.py
index 717083d774..885e505a13 100644
--- a/lib/ansible/modules/network/aos/aos_device.py
+++ b/lib/ansible/modules/network/aos/aos_device.py
@@ -158,9 +158,9 @@ def aos_device(module):
elif margs['name'] is not None:
item_name = margs['name']
- #----------------------------------------------------
+ # ----------------------------------------------------
# Find Object if available based on ID or Name
- #----------------------------------------------------
+ # ----------------------------------------------------
dev = find_collection_item(aos.Devices,
item_name=item_name,
item_id=item_id)
@@ -168,9 +168,9 @@ def aos_device(module):
if dev.exists is False:
module.fail_json(msg="unknown device '%s'" % margs['name'])
- #----------------------------------------------------
+ # ----------------------------------------------------
# Valid device state for reference
- #----------------------------------------------------
+ # ----------------------------------------------------
# DEVICE_STATE_IS_ACTIVE = 1;
# DEVICE_STATE_IS_READY = 2;
# DEVICE_STATE_IS_NOCOMMS = 3;
@@ -184,9 +184,9 @@ def aos_device(module):
# DEVICE_STATE_OOS_MAINT = 11;
# DEVICE_STATE_OOS_REBOOTING = 12;
# DEVICE_STATE_ERROR = 13;
- #----------------------------------------------------
+ # ----------------------------------------------------
# State == Normal
- #----------------------------------------------------
+ # ----------------------------------------------------
if margs['state'] == 'normal':
aos_device_normal(module, aos, dev)
diff --git a/lib/ansible/modules/network/aos/aos_external_router.py b/lib/ansible/modules/network/aos/aos_external_router.py
index e693811aab..37bb041e11 100644
--- a/lib/ansible/modules/network/aos/aos_external_router.py
+++ b/lib/ansible/modules/network/aos/aos_external_router.py
@@ -288,9 +288,9 @@ def ext_router(module):
elif margs['id'] is not None:
item_id = margs['id']
- #----------------------------------------------------
+ # ----------------------------------------------------
# Find Object if available based on ID or Name
- #----------------------------------------------------
+ # ----------------------------------------------------
try:
my_ext_router = find_collection_item(aos.ExternalRouters,
item_name=item_name,
@@ -298,9 +298,9 @@ def ext_router(module):
except:
module.fail_json(msg="Unable to find the IP Pool based on name or ID, something went wrong")
- #----------------------------------------------------
+ # ----------------------------------------------------
# Proceed based on State value
- #----------------------------------------------------
+ # ----------------------------------------------------
if margs['state'] == 'absent':
ext_router_absent(module, aos, my_ext_router)
diff --git a/lib/ansible/modules/network/aos/aos_ip_pool.py b/lib/ansible/modules/network/aos/aos_ip_pool.py
index 41c7e16754..82fac9d820 100644
--- a/lib/ansible/modules/network/aos/aos_ip_pool.py
+++ b/lib/ansible/modules/network/aos/aos_ip_pool.py
@@ -300,9 +300,9 @@ def ip_pool(module):
elif margs['id'] is not None:
item_id = margs['id']
- #----------------------------------------------------
+ # ----------------------------------------------------
# Find Object if available based on ID or Name
- #----------------------------------------------------
+ # ----------------------------------------------------
try:
my_pool = find_collection_item(aos.IpPools,
item_name=item_name,
@@ -310,9 +310,9 @@ def ip_pool(module):
except:
module.fail_json(msg="Unable to find the IP Pool based on name or ID, something went wrong")
- #----------------------------------------------------
+ # ----------------------------------------------------
# Proceed based on State value
- #----------------------------------------------------
+ # ----------------------------------------------------
if margs['state'] == 'absent':
ip_pool_absent(module, aos, my_pool)
diff --git a/lib/ansible/modules/network/aos/aos_logical_device.py b/lib/ansible/modules/network/aos/aos_logical_device.py
index 76412dfc33..0baaeaf216 100644
--- a/lib/ansible/modules/network/aos/aos_logical_device.py
+++ b/lib/ansible/modules/network/aos/aos_logical_device.py
@@ -214,16 +214,16 @@ def logical_device(module):
elif margs['id'] is not None:
item_id = margs['id']
- #----------------------------------------------------
+ # ----------------------------------------------------
# Find Object if available based on ID or Name
- #----------------------------------------------------
+ # ----------------------------------------------------
my_logical_dev = find_collection_item(aos.LogicalDevices,
item_name=item_name,
item_id=item_id)
- #----------------------------------------------------
+ # ----------------------------------------------------
# Proceed based on State value
- #----------------------------------------------------
+ # ----------------------------------------------------
if margs['state'] == 'absent':
logical_device_absent(module, aos, my_logical_dev)
diff --git a/lib/ansible/modules/network/aos/aos_logical_device_map.py b/lib/ansible/modules/network/aos/aos_logical_device_map.py
index 44d089b784..d2bc96ff1b 100644
--- a/lib/ansible/modules/network/aos/aos_logical_device_map.py
+++ b/lib/ansible/modules/network/aos/aos_logical_device_map.py
@@ -234,9 +234,9 @@ def logical_device_map(module):
elif margs['id'] is not None:
item_id = margs['id']
- #----------------------------------------------------
+ # ----------------------------------------------------
# Find Object if available based on ID or Name
- #----------------------------------------------------
+ # ----------------------------------------------------
try:
my_log_dev_map = find_collection_item(aos.LogicalDeviceMaps,
item_name=item_name,
@@ -244,9 +244,9 @@ def logical_device_map(module):
except:
module.fail_json(msg="Unable to find the Logical Device Map based on name or ID, something went wrong")
- #----------------------------------------------------
+ # ----------------------------------------------------
# Proceed based on State value
- #----------------------------------------------------
+ # ----------------------------------------------------
if margs['state'] == 'absent':
logical_device_map_absent(module, aos, my_log_dev_map)
diff --git a/lib/ansible/modules/network/aos/aos_rack_type.py b/lib/ansible/modules/network/aos/aos_rack_type.py
index 3be22595c1..b8dea17312 100644
--- a/lib/ansible/modules/network/aos/aos_rack_type.py
+++ b/lib/ansible/modules/network/aos/aos_rack_type.py
@@ -211,16 +211,16 @@ def rack_type(module):
elif margs['id'] is not None:
item_id = margs['id']
- #----------------------------------------------------
+ # ----------------------------------------------------
# Find Object if available based on ID or Name
- #----------------------------------------------------
+ # ----------------------------------------------------
my_rack_type = find_collection_item(aos.RackTypes,
item_name=item_name,
item_id=item_id)
- #----------------------------------------------------
+ # ----------------------------------------------------
# Proceed based on State value
- #----------------------------------------------------
+ # ----------------------------------------------------
if margs['state'] == 'absent':
rack_type_absent(module, aos, my_rack_type)
diff --git a/lib/ansible/modules/network/aos/aos_template.py b/lib/ansible/modules/network/aos/aos_template.py
index c87dee2ca1..a8b0c3a6fe 100644
--- a/lib/ansible/modules/network/aos/aos_template.py
+++ b/lib/ansible/modules/network/aos/aos_template.py
@@ -225,9 +225,9 @@ def aos_template(module):
elif margs['id'] is not None:
item_id = margs['id']
- #----------------------------------------------------
+ # ----------------------------------------------------
# Find Object if available based on ID or Name
- #----------------------------------------------------
+ # ----------------------------------------------------
try:
my_template = find_collection_item(aos.DesignTemplates,
item_name=item_name,
@@ -235,9 +235,9 @@ def aos_template(module):
except:
module.fail_json(msg="Unable to find the IP Pool based on name or ID, something went wrong")
- #----------------------------------------------------
+ # ----------------------------------------------------
# Proceed based on State value
- #----------------------------------------------------
+ # ----------------------------------------------------
if margs['state'] == 'absent':
template_absent(module, aos, my_template)
diff --git a/lib/ansible/modules/network/sros/sros_rollback.py b/lib/ansible/modules/network/sros/sros_rollback.py
index 41f9e3b095..923996dd2a 100644
--- a/lib/ansible/modules/network/sros/sros_rollback.py
+++ b/lib/ansible/modules/network/sros/sros_rollback.py
@@ -202,7 +202,7 @@ def main():
configobjs = candidate.difference(config)
if configobjs:
- #commands = dumps(configobjs, 'lines')
+ # commands = dumps(configobjs, 'lines')
commands = dumps(configobjs, 'commands')
commands = sanitize_config(commands.split('\n'))
diff --git a/lib/ansible/modules/packaging/language/maven_artifact.py b/lib/ansible/modules/packaging/language/maven_artifact.py
index 2a8cd8bbc2..e44a11a625 100644
--- a/lib/ansible/modules/packaging/language/maven_artifact.py
+++ b/lib/ansible/modules/packaging/language/maven_artifact.py
@@ -441,7 +441,7 @@ def main():
b_dest = to_bytes(dest, errors='surrogate_or_strict')
keep_name = module.params["keep_name"]
- #downloader = MavenDownloader(module, repository_url, repository_username, repository_password)
+ # downloader = MavenDownloader(module, repository_url, repository_username, repository_password)
downloader = MavenDownloader(module, repository_url)
try: