PEP 8 cleanup. (#20789)

* PEP 8 E703 cleanup.
* PEP 8 E701 cleanup.
* PEP 8 E711 cleanup.
* PEP 8 W191 and E101 cleanup.
This commit is contained in:
Matt Clay 2017-01-28 00:12:11 -08:00 committed by GitHub
commit d0d1158c5e
72 changed files with 184 additions and 174 deletions

View file

@ -189,7 +189,7 @@ def find_vpc(module, vpc_conn, vpc_id=None, cidr=None):
A VPC object that matches either an ID or CIDR and one or more tag values
"""
if vpc_id == None and cidr == None:
if vpc_id is None and cidr is None:
module.fail_json(
msg='You must specify either a vpc_id or a cidr block + list of unique tags, aborting'
)
@ -565,7 +565,7 @@ def create_vpc(module, vpc_conn):
old_rt = vpc_conn.get_all_route_tables(
filters={'association.subnet_id': rsn.id, 'vpc_id': vpc.id}
)
old_rt = [ x for x in old_rt if x.id != None ]
old_rt = [ x for x in old_rt if x.id is not None ]
if len(old_rt) == 1:
old_rt = old_rt[0]
association_id = None

View file

@ -410,7 +410,7 @@ def main():
list_origin_access_identities = module.params.get('list_origin_access_identities')
list_distributions = module.params.get('list_distributions')
list_distributions_by_web_acl_id = module.params.get('list_distributions_by_web_acl_id');
list_distributions_by_web_acl_id = module.params.get('list_distributions_by_web_acl_id')
list_invalidations = module.params.get('list_invalidations')
list_streaming_distributions = module.params.get('list_streaming_distributions')

View file

@ -1040,7 +1040,7 @@ def create_instances(module, ec2, vpc, override_count=None):
running_instances = []
count_remaining = int(count)
if id != None:
if id is not None:
filter_dict = {'client-token':id, 'instance-state-name' : 'running'}
previous_reservations = ec2.get_all_instances(None, filter_dict)
for res in previous_reservations:

View file

@ -506,7 +506,7 @@ def deregister_image(module, ec2):
wait_timeout = int(module.params.get('wait_timeout'))
img = ec2.get_image(image_id)
if img == None:
if img is None:
module.fail_json(msg = "Image %s does not exist" % image_id, changed=False)
# Get all associated snapshot ids before deregistering image otherwise this information becomes unavailable
@ -562,7 +562,7 @@ def update_image(module, ec2, image_id):
launch_permissions['user_ids'] = [str(user_id) for user_id in launch_permissions['user_ids']]
img = ec2.get_image(image_id)
if img == None:
if img is None:
module.fail_json(msg = "Image %s does not exist" % image_id, changed=False)
try:

View file

@ -210,7 +210,8 @@ def match_asg_tags(tags_to_match, asg):
for tag in asg['Tags']:
if key == tag['Key'] and value == tag['Value']:
break
else: return False
else:
return False
return True
def find_asgs(conn, module, name=None, tags=None):

View file

@ -886,7 +886,7 @@ class ElbManager(object):
self._disable_zones(zones_to_disable)
def _set_security_groups(self):
if self.security_group_ids != None and set(self.elb.security_groups) != set(self.security_group_ids):
if self.security_group_ids is not None and set(self.elb.security_groups) != set(self.security_group_ids):
self.elb_conn.apply_security_groups_to_lb(self.name, self.security_group_ids)
self.changed = True

View file

@ -298,16 +298,16 @@ def main():
# First check if we were given a dhcp_options_id
if not params['dhcp_options_id']:
# No, so create new_options from the parameters
if params['dns_servers'] != None:
if params['dns_servers'] is not None:
new_options['domain-name-servers'] = params['dns_servers']
if params['netbios_name_servers'] != None:
if params['netbios_name_servers'] is not None:
new_options['netbios-name-servers'] = params['netbios_name_servers']
if params['ntp_servers'] != None:
if params['ntp_servers'] is not None:
new_options['ntp-servers'] = params['ntp_servers']
if params['domain_name'] != None:
if params['domain_name'] is not None:
# needs to be a list for comparison with boto objects later
new_options['domain-name'] = [ params['domain_name'] ]
if params['netbios_node_type'] != None:
if params['netbios_node_type'] is not None:
# needs to be a list for comparison with boto objects later
new_options['netbios-node-type'] = [ str(params['netbios_node_type']) ]
# If we were given a vpc_id then we need to look at the options on that

View file

@ -312,14 +312,14 @@ def check_tags(client, module, existing_vgw, vpn_gateway_id):
tags_list[tags['Key']] = tags['Value']
# if existing tags don't match the tags arg, delete existing and recreate with new list
if params['Tags'] != None and tags_list != params['Tags']:
if params['Tags'] is not None and tags_list != params['Tags']:
delete_tags(client, module, vpn_gateway_id)
create_tags(client, module, vpn_gateway_id)
vgw = find_vgw(client, module)
changed = True
#if no tag args are supplied, delete any existing tags with the exception of the name tag
if params['Tags'] == None and tags_list != {}:
if params['Tags'] is None and tags_list != {}:
tags_to_delete = []
for tags in existing_vgw[0]['Tags']:
if tags['Key'] != 'Name':

View file

@ -163,7 +163,7 @@ def main():
except ValueError as e:
decrypted = None
if decrypted == None:
if decrypted is None:
module.exit_json(win_password='', changed=False)
else:
if wait:

View file

@ -304,14 +304,14 @@ def main():
policy_name = module.params.get('policy_name')
skip = module.params.get('skip_duplicates')
if module.params.get('policy_document') != None and module.params.get('policy_json') != None:
if module.params.get('policy_document') is not None and module.params.get('policy_json') is not None:
module.fail_json(msg='Only one of "policy_document" or "policy_json" may be set')
if module.params.get('policy_document') != None:
if module.params.get('policy_document') is not None:
with open(module.params.get('policy_document'), 'r') as json_data:
pdoc = json.dumps(json.load(json_data))
json_data.close()
elif module.params.get('policy_json') != None:
elif module.params.get('policy_json') is not None:
pdoc = module.params.get('policy_json')
# if its a string, assume it is already JSON
if not isinstance(pdoc, basestring):

View file

@ -325,7 +325,7 @@ def get_zone_by_name(conn, module, zone_name, want_private, zone_id, want_vpc_id
# only save this zone id if the private status of the zone matches
# the private_zone_in boolean specified in the params
private_zone = module.boolean(zone.config.get('PrivateZone', False))
if private_zone == want_private and ((zone.name == zone_name and zone_id == None) or zone.id.replace('/hostedzone/', '') == zone_id):
if private_zone == want_private and ((zone.name == zone_name and zone_id is None) or zone.id.replace('/hostedzone/', '') == zone_id):
if want_vpc_id:
# NOTE: These details aren't available in other boto methods, hence the necessary
# extra API call
@ -464,13 +464,13 @@ def main():
module.fail_json(msg = "parameter 'value' must contain a single dns name for alias create/delete")
elif not alias_hosted_zone_id_in:
module.fail_json(msg = "parameter 'alias_hosted_zone_id' required for alias create/delete")
elif ( weight_in!=None or region_in!=None or failover_in!=None ) and identifier_in==None:
elif ( weight_in is not None or region_in is not None or failover_in is not None ) and identifier_in is None:
module.fail_json(msg= "If you specify failover, region or weight you must also specify identifier")
if command_in == 'create':
if ( weight_in!=None or region_in!=None or failover_in!=None ) and identifier_in==None:
if ( weight_in is not None or region_in is not None or failover_in is not None ) and identifier_in is None:
module.fail_json(msg= "If you specify failover, region or weight you must also specify identifier")
elif ( weight_in==None and region_in==None and failover_in==None ) and identifier_in!=None:
elif ( weight_in is None and region_in is None and failover_in is None ) and identifier_in is not None:
module.fail_json(msg= "You have specified identifier which makes sense only if you specify one of: weight, region or failover.")

View file

@ -643,7 +643,7 @@ def main():
# Delete an object from a bucket, not the entire bucket
if mode == 'delobj':
if obj is None:
module.fail_json(msg="object parameter is required", failed=True);
module.fail_json(msg="object parameter is required", failed=True)
if bucket:
bucketrtn = bucket_check(module, s3, bucket)
if bucketrtn is True:

View file

@ -276,7 +276,8 @@ from types import MethodType
import json
def _wait_for_completion(azure, promise, wait_timeout, msg):
if not promise: return
if not promise:
return
wait_timeout = time.time() + wait_timeout
while wait_timeout > time.time():
operation_result = azure.get_operation_status(promise.request_id)

View file

@ -1553,12 +1553,12 @@ class DockerManager(object):
image_matches = running_image in repo_tags
if command == None:
if command is None:
command_matches = True
else:
command_matches = (command == details['Config']['Cmd'])
if entrypoint == None:
if entrypoint is None:
entrypoint_matches = True
else:
entrypoint_matches = (

View file

@ -176,7 +176,7 @@ try:
from ast import literal_eval
HAS_PYTHON26 = True
except ImportError:
HAS_PYTHON26 = False;
HAS_PYTHON26 = False
try:
from google.cloud import pubsub

View file

@ -88,7 +88,7 @@ try:
from ast import literal_eval
HAS_PYTHON26 = True
except ImportError:
HAS_PYTHON26 = False;
HAS_PYTHON26 = False
try:
from google.cloud import pubsub

View file

@ -382,7 +382,7 @@ def vm_status(conn, vmname):
# Get VM object and return it's name if object exists
def get_vm(conn, vmname):
vm = conn.vms.get(name=vmname)
if vm == None:
if vm is None:
name = "empty"
else:
name = vm.get_name()

View file

@ -139,7 +139,7 @@ def _system_state_change(module, project):
else:
changed=True
return changed;
return changed
def main():

View file

@ -223,7 +223,8 @@ uuid_match = re.compile(
def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
if not promise: return
if not promise:
return
wait_timeout = time.time() + wait_timeout
while wait_timeout > time.time():
time.sleep(5)

View file

@ -105,7 +105,8 @@ uuid_match = re.compile(
def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
if not promise: return
if not promise:
return
wait_timeout = time.time() + wait_timeout
while wait_timeout > time.time():
time.sleep(5)

View file

@ -107,7 +107,8 @@ uuid_match = re.compile(
def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
if not promise: return
if not promise:
return
wait_timeout = time.time() + wait_timeout
while wait_timeout > time.time():
time.sleep(5)

View file

@ -157,7 +157,8 @@ uuid_match = re.compile(
def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
if not promise: return
if not promise:
return
wait_timeout = time.time() + wait_timeout
while wait_timeout > time.time():
time.sleep(5)

View file

@ -105,7 +105,8 @@ uuid_match = re.compile(
def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
if not promise: return
if not promise:
return
wait_timeout = time.time() + wait_timeout
while wait_timeout > time.time():
time.sleep(5)

View file

@ -270,9 +270,9 @@ def create_virtual_instance(module):
# Check if OS or Image Template is provided (Can't be both, defaults to OS)
if (module.params.get('os_code') != None and module.params.get('os_code') != ''):
if (module.params.get('os_code') is not None and module.params.get('os_code') != ''):
module.params['image_id'] = ''
elif (module.params.get('image_id') != None and module.params.get('image_id') != ''):
elif (module.params.get('image_id') is not None and module.params.get('image_id') != ''):
module.params['os_code'] = ''
module.params['disks'] = [] # Blank out disks since it will use the template
else:
@ -302,7 +302,7 @@ def create_virtual_instance(module):
post_uri = module.params.get('post_uri'),
tags = tags)
if instance != None and instance['id'] > 0:
if instance is not None and instance['id'] > 0:
return True, instance
else:
return False, None
@ -325,7 +325,7 @@ def wait_for_instance(module,id):
def cancel_instance(module):
canceled = True
if module.params.get('instance_id') == None and (module.params.get('tags') or module.params.get('hostname') or module.params.get('domain')):
if module.params.get('instance_id') is None and (module.params.get('tags') or module.params.get('hostname') or module.params.get('domain')):
tags = module.params.get('tags')
if isinstance(tags, basestring):
tags = [module.params.get('tags')]

View file

@ -1190,7 +1190,8 @@ def _find_path_in_tree(tree, path):
def _get_folderid_for_path(vsphere_client, datacenter, path):
content = vsphere_client._retrieve_properties_traversal(property_names=['name', 'parent'], obj_type=MORTypes.Folder)
if not content: return {}
if not content:
return {}
node_list = [
{

View file

@ -234,7 +234,7 @@ def remove_value(module):
index, existing = consul_api.kv.get(
key, recurse=module.params.get('recurse'))
changed = existing != None
changed = existing is not None
if changed and not module.check_mode:
consul_api.kv.delete(key, module.params.get('recurse'))

View file

@ -238,7 +238,7 @@ class InvalidPrivsError(Exception):
# User Authentication Management was change in MySQL 5.7
# This is a generic check for if the server version is less than version 5.7
def server_version_check(cursor):
cursor.execute("SELECT VERSION()");
cursor.execute("SELECT VERSION()")
result = cursor.fetchone()
version_str = result[0]
version = version_str.split('.')

View file

@ -329,7 +329,7 @@ def main():
module.fail_json(msg="'entry' MUST NOT be set when 'state=query'.")
default_flag, etype, entity, permissions = split_entry(entry)
if default_flag != None:
if default_flag is not None:
default = default_flag
if get_platform().lower() == 'freebsd':

View file

@ -227,7 +227,8 @@ def sizefilter(st, size):
def contentfilter(fsname, pattern):
'''filter files which contain the given expression'''
if pattern is None: return True
if pattern is None:
return True
try:
f = open(fsname)

View file

@ -349,8 +349,10 @@ class ZipArchive(object):
continue
# Check first and seventh field in order to skip header/footer
if len(pcs[0]) != 7 and len(pcs[0]) != 10: continue
if len(pcs[6]) != 15: continue
if len(pcs[0]) != 7 and len(pcs[0]) != 10:
continue
if len(pcs[6]) != 15:
continue
# Possible entries:
# -rw-rws--- 1.9 unx 2802 t- defX 11-Aug-91 13:48 perms.2660

View file

@ -109,15 +109,15 @@ def post_annotation(annotation, api_key):
def create_annotation(module):
''' Takes ansible module object '''
annotation = {}
if module.params['duration'] != None:
if module.params['duration'] is not None:
duration = module.params['duration']
else:
duration = 0
if module.params['start'] != None:
if module.params['start'] is not None:
start = module.params['start']
else:
start = int(time.time())
if module.params['stop'] != None:
if module.params['stop'] is not None:
stop = module.params['stop']
else:
stop = int(time.time())+ duration

View file

@ -117,15 +117,15 @@ def post_annotation(module):
params = {}
params['title'] = title
if module.params['source'] != None:
if module.params['source'] is not None:
params['source'] = module.params['source']
if module.params['description'] != None:
if module.params['description'] is not None:
params['description'] = module.params['description']
if module.params['start_time'] != None:
if module.params['start_time'] is not None:
params['start_time'] = module.params['start_time']
if module.params['end_time'] != None:
if module.params['end_time'] is not None:
params['end_time'] = module.params['end_time']
if module.params['links'] != None:
if module.params['links'] is not None:
params['links'] = module.params['links']
json_body = module.jsonify(params)

View file

@ -276,8 +276,10 @@ def main():
# check if we need to update
if rr['ttl'] != ttl or rr['prio'] != priority:
data = {}
if ttl: data['ttl'] = ttl
if priority: data['prio'] = priority
if ttl:
data['ttl'] = ttl
if priority:
data['prio'] = priority
if module.check_mode:
module.exit_json(changed=True)
else:
@ -291,8 +293,10 @@ def main():
'record_type': record_type,
'content': value,
}
if ttl: data['ttl'] = ttl
if priority: data['prio'] = priority
if ttl:
data['ttl'] = ttl
if priority:
data['prio'] = priority
if module.check_mode:
module.exit_json(changed=True)
else:

View file

@ -332,9 +332,9 @@ class ExoDnsRecord(ExoDns):
def present_record(self):
record = self.get_record()
if not record:
record = self._create_record(record);
record = self._create_record(record)
else:
record = self._update_record(record);
record = self._update_record(record)
return record
def absent_record(self):

View file

@ -209,10 +209,10 @@ def main():
module.fail_json(msg='Community not set when using snmp version 2')
if m_args['version'] == "v3":
if m_args['username'] == None:
if m_args['username'] is None:
module.fail_json(msg='Username not set when using snmp version 3')
if m_args['level'] == "authPriv" and m_args['privacy'] == None:
if m_args['level'] == "authPriv" and m_args['privacy'] is None:
module.fail_json(msg='Privacy algorithm not set when using authPriv')

View file

@ -252,7 +252,7 @@ def main():
sendgrid_lib_args = [api_key, bcc, cc, headers, from_name, html_body, attachments]
if any(lib_arg != None for lib_arg in sendgrid_lib_args) and not HAS_SENDGRID:
if any(lib_arg is not None for lib_arg in sendgrid_lib_args) and not HAS_SENDGRID:
module.fail_json(msg='You must install the sendgrid python library if you want to use any of the following arguments: api_key, bcc, cc, headers, from_name, html_body, attachments')
response, info = post_sendgrid_api(module, username, password,

View file

@ -77,7 +77,8 @@ def get_local_version(pear_output):
for line in lines:
if 'Installed ' in line:
installed = line.rsplit(None, 1)[-1].strip()
if installed == '-': continue
if installed == '-':
continue
return installed
return None

View file

@ -103,7 +103,8 @@ except ImportError:
HAS_LAYMAN_API = False
class ModuleError(Exception): pass
class ModuleError(Exception):
pass
def init_layman(config=None):
@ -201,7 +202,8 @@ def uninstall_overlay(module, name):
module.exit_json(changed=True, msg=mymsg)
layman.delete_repos(name)
if layman.get_errors(): raise ModuleError(layman.get_errors())
if layman.get_errors():
raise ModuleError(layman.get_errors())
return True

View file

@ -161,9 +161,9 @@ def get_package_state(names, pkg_spec, module):
# find multiple packages with that name.
pkg_spec[name]['installed_names'] = [installed_name for installed_name in stdout.splitlines()]
module.debug("get_package_state(): installed_names = %s" % pkg_spec[name]['installed_names'])
pkg_spec[name]['installed_state'] = True;
pkg_spec[name]['installed_state'] = True
else:
pkg_spec[name]['installed_state'] = False;
pkg_spec[name]['installed_state'] = False
# Function used to make sure a package is present.
def package_present(names, pkg_spec, module):

View file

@ -111,7 +111,7 @@ def modify_publisher(module, params):
if name in existing:
for option in ['origin', 'mirror', 'sticky', 'enabled']:
if params[option] != None:
if params[option] is not None:
if params[option] != existing[name][option]:
return set_publisher(module, params)
else:
@ -124,21 +124,21 @@ def set_publisher(module, params):
name = params['name']
args = []
if params['origin'] != None:
if params['origin'] is not None:
args.append('--remove-origin=*')
args.extend(['--add-origin=' + u for u in params['origin']])
if params['mirror'] != None:
if params['mirror'] is not None:
args.append('--remove-mirror=*')
args.extend(['--add-mirror=' + u for u in params['mirror']])
if params['sticky'] != None and params['sticky']:
if params['sticky'] is not None and params['sticky']:
args.append('--sticky')
elif params['sticky'] != None:
elif params['sticky'] is not None:
args.append('--non-sticky')
if params['enabled'] != None and params['enabled']:
if params['enabled'] is not None and params['enabled']:
args.append('--enable')
elif params['enabled'] != None:
elif params['enabled'] is not None:
args.append('--disable')
rc, out, err = module.run_command(

View file

@ -140,7 +140,7 @@ def main():
changed = False
msg = "No changed"
rc = 0
if ( state == 'present' or state == 'latest' ) and depot == None:
if ( state == 'present' or state == 'latest' ) and depot is None:
output = "depot parameter is mandatory in present or latest task"
module.fail_json(name=name, msg=output, rc=rc)

View file

@ -515,10 +515,10 @@ def main():
## Verify required params are provided
if module.params['source'] == None and module.params['permanent'] == None:
if module.params['source'] is None and module.params['permanent'] is None:
module.fail_json(msg='permanent is a required parameter')
if module.params['interface'] != None and module.params['zone'] == None:
if module.params['interface'] is not None and module.params['zone'] is None:
module.fail(msg='zone is a required parameter')
if module.params['immediate'] and fw_offline:
@ -531,14 +531,14 @@ def main():
rich_rule = module.params['rich_rule']
source = module.params['source']
if module.params['port'] != None:
if module.params['port'] is not None:
port, protocol = module.params['port'].split('/')
if protocol == None:
if protocol is None:
module.fail_json(msg='improper port format (missing protocol?)')
else:
port = None
if module.params['zone'] != None:
if module.params['zone'] is not None:
zone = module.params['zone']
else:
if fw_offline:
@ -554,21 +554,21 @@ def main():
masquerade = module.params['masquerade']
modification_count = 0
if service != None:
if service is not None:
modification_count += 1
if port != None:
if port is not None:
modification_count += 1
if rich_rule != None:
if rich_rule is not None:
modification_count += 1
if interface != None:
if interface is not None:
modification_count += 1
if masquerade != None:
if masquerade is not None:
modification_count += 1
if modification_count > 1:
module.fail_json(msg='can only operate on port, service, rich_rule or interface at once')
if service != None:
if service is not None:
if immediate and permanent:
is_enabled_permanent = action_handler(
get_service_enabled_permanent,
@ -676,7 +676,7 @@ def main():
# FIXME - source type does not handle non-permanent mode, this was an
# oversight in the past.
if source != None:
if source is not None:
is_enabled = action_handler(get_source, (zone, source))
if desired_state == "enabled":
if is_enabled == False:
@ -695,7 +695,7 @@ def main():
changed=True
msgs.append("Removed %s from zone %s" % (source, zone))
if port != None:
if port is not None:
if immediate and permanent:
is_enabled_permanent = action_handler(
get_port_enabled_permanent,
@ -800,7 +800,7 @@ def main():
msgs.append("Changed port %s to %s" % ("%s/%s" % (port, protocol), \
desired_state))
if rich_rule != None:
if rich_rule is not None:
if immediate and permanent:
is_enabled_permanent = action_handler(
get_rich_rule_enabled_permanent,
@ -903,7 +903,7 @@ def main():
if changed == True:
msgs.append("Changed rich_rule %s to %s" % (rich_rule, desired_state))
if interface != None:
if interface is not None:
if immediate and permanent:
is_enabled_permanent = action_handler(
get_interface_permanent,
@ -986,7 +986,7 @@ def main():
changed=True
msgs.append("Removed %s from zone %s" % (interface, zone))
if masquerade != None:
if masquerade is not None:
if immediate and permanent:
is_enabled_permanent = action_handler(

View file

@ -436,13 +436,13 @@ def main():
# Clean up if last element is empty. Consider that yml can look like this:
# cluster="{% for host in groups['glusterfs'] %}{{ hostvars[host]['private_ip'] }},{% endfor %}"
if cluster != None and len(cluster) > 1 and cluster[-1] == '':
if cluster is not None and len(cluster) > 1 and cluster[-1] == '':
cluster = cluster[0:-1]
if cluster == None or cluster[0] == '':
if cluster is None or cluster[0] == '':
cluster = [myhostname]
if brick_paths != None and "," in brick_paths:
if brick_paths is not None and "," in brick_paths:
brick_paths = brick_paths.split(",")
else:
brick_paths = [brick_paths]

View file

@ -262,7 +262,7 @@ def main():
# Determine if the "--yes" option should be used
version_found = get_lvm_version(module)
if version_found == None:
if version_found is None:
module.fail_json(msg="Failed to get LVM version number")
version_yesopt = mkversion(2, 2, 99) # First LVM with the "--yes" option
if version_found >= version_yesopt:
@ -320,7 +320,8 @@ def main():
try:
float(size)
if not size[0].isdigit(): raise ValueError()
if not size[0].isdigit():
raise ValueError()
except ValueError:
module.fail_json(msg="Bad size specification of '%s'" % size)

View file

@ -1953,7 +1953,7 @@ class AIX(User):
else:
(rc2, out2, err2) = (None, '', '')
if rc != None:
if rc is not None:
return (rc, out+out2, err+err2)
else:
return (rc2, out+out2, err+err2)

View file

@ -374,7 +374,7 @@ def main():
if HAS_BEAUTIFULSOUP is False:
module.fail_json(msg="python module 'BeautifulSoup' is required!")
if module.params['state'] != None:
if module.params['state'] is not None:
states = module.params['state'].split(',')
if (len(states) > 1) and (("present" in states) or ("enabled" in states)):
module.fail_json(msg="state present/enabled is mutually exclusive with other states!")