mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
PEP 8 E111 & E114 cleanup. (#20838)
This commit is contained in:
parent
1609afbd12
commit
cb76200c7d
119 changed files with 339 additions and 378 deletions
|
@ -130,18 +130,18 @@ def generate_inv_from_api(enterprise_entity,config):
|
|||
if (config.getboolean('defaults', 'public_ip_only')) == True:
|
||||
for link in vmcollection['links']:
|
||||
if (link['type']=='application/vnd.abiquo.publicip+json' and link['rel']=='ip'):
|
||||
vm_nic = link['title']
|
||||
break
|
||||
vm_nic = link['title']
|
||||
break
|
||||
else:
|
||||
vm_nic = None
|
||||
vm_nic = None
|
||||
# Otherwise, assigning defined network interface IP address
|
||||
else:
|
||||
for link in vmcollection['links']:
|
||||
if (link['rel']==config.get('defaults', 'default_net_interface')):
|
||||
vm_nic = link['title']
|
||||
break
|
||||
vm_nic = link['title']
|
||||
break
|
||||
else:
|
||||
vm_nic = None
|
||||
vm_nic = None
|
||||
|
||||
vm_state = True
|
||||
# From abiquo.ini: Only adding to inventory VMs deployed
|
||||
|
|
|
@ -735,7 +735,7 @@ class DockerInventory(object):
|
|||
|
||||
cert_path = def_cert_path or self._args.cert_path or self._env_args.cert_path
|
||||
if cert_path and cert_path == self._env_args.cert_path:
|
||||
cert_path = os.path.join(cert_path, 'cert.pem')
|
||||
cert_path = os.path.join(cert_path, 'cert.pem')
|
||||
|
||||
cacert_path = def_cacert_path or self._args.cacert_path or self._env_args.cert_path
|
||||
if cacert_path and cacert_path == self._env_args.cert_path:
|
||||
|
|
|
@ -308,13 +308,13 @@ class Ec2Inventory(object):
|
|||
if self.all_instances:
|
||||
self.ec2_instance_states = ec2_valid_instance_states
|
||||
elif config.has_option('ec2', 'instance_states'):
|
||||
for instance_state in config.get('ec2', 'instance_states').split(','):
|
||||
instance_state = instance_state.strip()
|
||||
if instance_state not in ec2_valid_instance_states:
|
||||
continue
|
||||
self.ec2_instance_states.append(instance_state)
|
||||
for instance_state in config.get('ec2', 'instance_states').split(','):
|
||||
instance_state = instance_state.strip()
|
||||
if instance_state not in ec2_valid_instance_states:
|
||||
continue
|
||||
self.ec2_instance_states.append(instance_state)
|
||||
else:
|
||||
self.ec2_instance_states = ['running']
|
||||
self.ec2_instance_states = ['running']
|
||||
|
||||
# Return all RDS instances? (if RDS is enabled)
|
||||
if config.has_option('ec2', 'all_rds_instances') and self.rds_enabled:
|
||||
|
|
|
@ -151,7 +151,7 @@ from click.exceptions import UsageError
|
|||
from six import string_types
|
||||
|
||||
def warning(*objs):
|
||||
print("WARNING: ", *objs, file=sys.stderr)
|
||||
print("WARNING: ", *objs, file=sys.stderr)
|
||||
|
||||
|
||||
class NSoTInventory(object):
|
||||
|
|
|
@ -169,7 +169,7 @@ class SoftLayerInventory(object):
|
|||
|
||||
# Inventory: group by tag
|
||||
for tag in instance['tagReferences']:
|
||||
self.push(self.inventory, tag['tag']['name'], dest)
|
||||
self.push(self.inventory, tag['tag']['name'], dest)
|
||||
|
||||
def get_virtual_servers(self):
|
||||
'''Get all the CCI instances'''
|
||||
|
|
|
@ -187,7 +187,7 @@ if options.list:
|
|||
|
||||
groups[group_name].add(system['spacewalk_server_name'])
|
||||
if system['spacewalk_server_name'] in host_vars and not system['spacewalk_server_name'] in meta[ "hostvars" ]:
|
||||
meta[ "hostvars" ][ system['spacewalk_server_name'] ] = host_vars[ system['spacewalk_server_name'] ]
|
||||
meta[ "hostvars" ][ system['spacewalk_server_name'] ] = host_vars[ system['spacewalk_server_name'] ]
|
||||
|
||||
except (OSError) as e:
|
||||
print('Problem executing the command "%s system-groups-systems": %s' %
|
||||
|
|
|
@ -24,10 +24,10 @@ except ImportError:
|
|||
import simplejson as json
|
||||
|
||||
class SetEncoder(json.JSONEncoder):
|
||||
def default(self, obj):
|
||||
if isinstance(obj, set):
|
||||
return list(obj)
|
||||
return json.JSONEncoder.default(self, obj)
|
||||
def default(self, obj):
|
||||
if isinstance(obj, set):
|
||||
return list(obj)
|
||||
return json.JSONEncoder.default(self, obj)
|
||||
|
||||
VBOX="VBoxManage"
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ result['all'] = {}
|
|||
pipe = Popen(['zoneadm', 'list', '-ip'], stdout=PIPE, universal_newlines=True)
|
||||
result['all']['hosts'] = []
|
||||
for l in pipe.stdout.readlines():
|
||||
# 1:work:running:/zones/work:3126dc59-9a07-4829-cde9-a816e4c5040e:native:shared
|
||||
s = l.split(':')
|
||||
if s[1] != 'global':
|
||||
result['all']['hosts'].append(s[1])
|
||||
# 1:work:running:/zones/work:3126dc59-9a07-4829-cde9-a816e4c5040e:native:shared
|
||||
s = l.split(':')
|
||||
if s[1] != 'global':
|
||||
result['all']['hosts'].append(s[1])
|
||||
|
||||
result['all']['vars'] = {}
|
||||
result['all']['vars']['ansible_connection'] = 'zone'
|
||||
|
|
|
@ -36,13 +36,13 @@ if _system_six:
|
|||
# If we need some things from even newer versions of six, then we need to
|
||||
# use our bundled copy instead
|
||||
|
||||
if ( # Added in six-1.8.0
|
||||
not hasattr(_system_six.moves, 'shlex_quote') or
|
||||
# Added in six-1.4.0
|
||||
not hasattr(_system_six, 'byte2int') or
|
||||
not hasattr(_system_six, 'add_metaclass') or
|
||||
not hasattr(_system_six.moves, 'urllib')
|
||||
):
|
||||
if ( # Added in six-1.8.0
|
||||
not hasattr(_system_six.moves, 'shlex_quote') or
|
||||
# Added in six-1.4.0
|
||||
not hasattr(_system_six, 'byte2int') or
|
||||
not hasattr(_system_six, 'add_metaclass') or
|
||||
not hasattr(_system_six.moves, 'urllib')
|
||||
):
|
||||
|
||||
_system_six = False
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ class GalaxyRole(object):
|
|||
tmp_file = self.fetch(role_data)
|
||||
|
||||
else:
|
||||
raise AnsibleError("No valid role data found")
|
||||
raise AnsibleError("No valid role data found")
|
||||
|
||||
|
||||
if tmp_file:
|
||||
|
|
|
@ -376,9 +376,9 @@ class AzureRMModuleBase(object):
|
|||
dependencies = dict()
|
||||
if enum_modules:
|
||||
for module_name in enum_modules:
|
||||
mod = importlib.import_module(module_name)
|
||||
for mod_class_name, mod_class_obj in inspect.getmembers(mod, predicate=inspect.isclass):
|
||||
dependencies[mod_class_name] = mod_class_obj
|
||||
mod = importlib.import_module(module_name)
|
||||
for mod_class_name, mod_class_obj in inspect.getmembers(mod, predicate=inspect.isclass):
|
||||
dependencies[mod_class_name] = mod_class_obj
|
||||
self.log("dependencies: ")
|
||||
self.log(str(dependencies))
|
||||
serializer = Serializer(classes=dependencies)
|
||||
|
|
|
@ -1399,7 +1399,7 @@ class AnsibleModule(object):
|
|||
','.join(sorted(list(unsupported_parameters))),
|
||||
','.join(sorted(self.argument_spec.keys()))))
|
||||
if self.check_mode and not self.supports_check_mode:
|
||||
self.exit_json(skipped=True, msg="remote module (%s) does not support check mode" % self._name)
|
||||
self.exit_json(skipped=True, msg="remote module (%s) does not support check mode" % self._name)
|
||||
|
||||
def _count_terms(self, check):
|
||||
count = 0
|
||||
|
|
|
@ -249,7 +249,7 @@ class AnsibleDockerClient(Client):
|
|||
tls_config = TLSConfig(**kwargs)
|
||||
return tls_config
|
||||
except TLSParameterError as exc:
|
||||
self.fail("TLS config error: %s" % exc)
|
||||
self.fail("TLS config error: %s" % exc)
|
||||
|
||||
def _get_connect_params(self):
|
||||
auth = self.auth_params
|
||||
|
|
|
@ -68,7 +68,7 @@ def run_commands(module, commands):
|
|||
module.fail_json(msg=err)
|
||||
|
||||
try:
|
||||
out = module.from_json(out)
|
||||
out = module.from_json(out)
|
||||
except ValueError:
|
||||
out = str(out).strip()
|
||||
|
||||
|
|
|
@ -325,7 +325,7 @@ class Facts(object):
|
|||
|
||||
def get_pkg_mgr_facts(self):
|
||||
if self.facts['system'] == 'OpenBSD':
|
||||
self.facts['pkg_mgr'] = 'openbsd_pkg'
|
||||
self.facts['pkg_mgr'] = 'openbsd_pkg'
|
||||
else:
|
||||
self.facts['pkg_mgr'] = 'unknown'
|
||||
for pkg in Facts.PKG_MGRS:
|
||||
|
@ -476,9 +476,9 @@ class Facts(object):
|
|||
def get_apparmor_facts(self):
|
||||
self.facts['apparmor'] = {}
|
||||
if os.path.exists('/sys/kernel/security/apparmor'):
|
||||
self.facts['apparmor']['status'] = 'enabled'
|
||||
self.facts['apparmor']['status'] = 'enabled'
|
||||
else:
|
||||
self.facts['apparmor']['status'] = 'disabled'
|
||||
self.facts['apparmor']['status'] = 'disabled'
|
||||
|
||||
def get_caps_facts(self):
|
||||
capsh_path = self.module.get_bin_path('capsh')
|
||||
|
@ -884,7 +884,7 @@ class Distribution(object):
|
|||
# example pattern are 13.04 13.0 13
|
||||
distribution_version = re.search('^VERSION_ID="?([0-9]+\.?[0-9]*)"?', line)
|
||||
if distribution_version:
|
||||
self.facts['distribution_version'] = distribution_version.group(1)
|
||||
self.facts['distribution_version'] = distribution_version.group(1)
|
||||
if 'open' in data.lower():
|
||||
release = re.search("^PRETTY_NAME=[^(]+ \(?([^)]+?)\)", line)
|
||||
if release:
|
||||
|
@ -1071,8 +1071,8 @@ class LinuxHardware(Hardware):
|
|||
self.facts["%s_mb" % key.lower()] = int(val) // 1024
|
||||
|
||||
if key in self.MEMORY_FACTS:
|
||||
val = data[1].strip().split(' ')[0]
|
||||
memstats[key.lower()] = int(val) // 1024
|
||||
val = data[1].strip().split(' ')[0]
|
||||
memstats[key.lower()] = int(val) // 1024
|
||||
|
||||
if None not in (memstats.get('memtotal'), memstats.get('memfree')):
|
||||
memstats['real:used'] = memstats['memtotal'] - memstats['memfree']
|
||||
|
@ -1811,8 +1811,8 @@ class OpenBSDHardware(Hardware):
|
|||
}
|
||||
|
||||
for mib in sysctl_to_dmi:
|
||||
if mib in self.sysctl:
|
||||
self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib]
|
||||
if mib in self.sysctl:
|
||||
self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib]
|
||||
|
||||
class FreeBSDHardware(Hardware):
|
||||
"""
|
||||
|
@ -2040,8 +2040,8 @@ class NetBSDHardware(Hardware):
|
|||
}
|
||||
|
||||
for mib in sysctl_to_dmi:
|
||||
if mib in self.sysctl:
|
||||
self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib]
|
||||
if mib in self.sysctl:
|
||||
self.facts[sysctl_to_dmi[mib]] = self.sysctl[mib]
|
||||
|
||||
class AIX(Hardware):
|
||||
"""
|
||||
|
@ -2283,8 +2283,8 @@ class HPUX(Hardware):
|
|||
if os.access("/dev/kmem", os.R_OK):
|
||||
rc, out, err = self.module.run_command("echo 'phys_mem_pages/D' | adb -k /stand/vmunix /dev/kmem | tail -1 | awk '{print $2}'", use_unsafe_shell=True)
|
||||
if not err:
|
||||
data = out
|
||||
self.facts['memtotal_mb'] = int(data) / 256
|
||||
data = out
|
||||
self.facts['memtotal_mb'] = int(data) / 256
|
||||
else:
|
||||
rc, out, err = self.module.run_command("/usr/contrib/bin/machinfo | grep Memory", use_unsafe_shell=True)
|
||||
data = re.search('Memory[\ :=]*([0-9]*).*MB.*',out).groups()[0].strip()
|
||||
|
@ -2308,7 +2308,7 @@ class HPUX(Hardware):
|
|||
self.facts['firmware_version'] = out.split(separator)[1].strip()
|
||||
rc, out, err = self.module.run_command("/usr/contrib/bin/machinfo |grep -i 'Machine serial number' ",use_unsafe_shell=True)
|
||||
if rc == 0 and out:
|
||||
self.facts['product_serial'] = out.split(separator)[1].strip()
|
||||
self.facts['product_serial'] = out.split(separator)[1].strip()
|
||||
|
||||
class Darwin(Hardware):
|
||||
"""
|
||||
|
@ -2926,18 +2926,18 @@ class HPUXNetwork(Network):
|
|||
interfaces = self.get_interfaces_info()
|
||||
self.facts['interfaces'] = interfaces.keys()
|
||||
for iface in interfaces:
|
||||
self.facts[iface] = interfaces[iface]
|
||||
self.facts[iface] = interfaces[iface]
|
||||
return self.facts
|
||||
|
||||
def get_default_interfaces(self):
|
||||
rc, out, err = self.module.run_command("/usr/bin/netstat -nr")
|
||||
lines = out.splitlines()
|
||||
for line in lines:
|
||||
words = line.split()
|
||||
if len(words) > 1:
|
||||
if words[0] == 'default':
|
||||
self.facts['default_interface'] = words[4]
|
||||
self.facts['default_gateway'] = words[1]
|
||||
words = line.split()
|
||||
if len(words) > 1:
|
||||
if words[0] == 'default':
|
||||
self.facts['default_interface'] = words[4]
|
||||
self.facts['default_gateway'] = words[1]
|
||||
|
||||
def get_interfaces_info(self):
|
||||
interfaces = {}
|
||||
|
@ -3122,7 +3122,7 @@ class OpenBSDNetwork(GenericBsdIfconfigNetwork):
|
|||
|
||||
# OpenBSD 'ifconfig -a' does not have information about aliases
|
||||
def get_interfaces_info(self, ifconfig_path, ifconfig_options='-aA'):
|
||||
return super(OpenBSDNetwork, self).get_interfaces_info(ifconfig_path, ifconfig_options)
|
||||
return super(OpenBSDNetwork, self).get_interfaces_info(ifconfig_path, ifconfig_options)
|
||||
|
||||
# Return macaddress instead of lladdr
|
||||
def parse_lladdr_line(self, words, current_if, ips):
|
||||
|
|
|
@ -101,7 +101,7 @@ def get_fqdn(repo_url):
|
|||
return result
|
||||
|
||||
def check_hostkey(module, fqdn):
|
||||
return not not_in_host_file(module, fqdn)
|
||||
return not not_in_host_file(module, fqdn)
|
||||
|
||||
# this is a variant of code found in connection_plugins/paramiko.py and we should modify
|
||||
# the paramiko code to import and use this.
|
||||
|
|
|
@ -226,7 +226,7 @@ def connect_to_api(module, disconnect_atexit=True):
|
|||
|
||||
def get_all_objs(content, vimtype, folder=None, recurse=True):
|
||||
if not folder:
|
||||
folder = content.rootFolder
|
||||
folder = content.rootFolder
|
||||
|
||||
obj = {}
|
||||
container = content.viewManager.CreateContainerView(folder, vimtype, recurse)
|
||||
|
|
|
@ -184,9 +184,9 @@ def do_grant(kms, keyarn, role_arn, granttypes, mode='grant', dry_run=True, clea
|
|||
if not dry_run:
|
||||
statement['Principal']['AWS'].append(role_arn)
|
||||
elif role_arn in statement['Principal']['AWS']: # not one the places the role should be
|
||||
changes_needed[granttype] = 'remove'
|
||||
if not dry_run:
|
||||
statement['Principal']['AWS'].remove(role_arn)
|
||||
changes_needed[granttype] = 'remove'
|
||||
if not dry_run:
|
||||
statement['Principal']['AWS'].remove(role_arn)
|
||||
|
||||
elif mode == 'deny' and statement['Sid'] == statement_label[granttype] and role_arn in statement['Principal']['AWS']:
|
||||
# we don't selectively deny. that's a grant with a
|
||||
|
|
|
@ -222,7 +222,7 @@ class CloudFormationServiceManager:
|
|||
result = response.get(result_key)
|
||||
next_token = response.get('NextToken')
|
||||
if not next_token:
|
||||
return result
|
||||
return result
|
||||
return result + self.paginated_response(func, result_key, next_token)
|
||||
|
||||
def to_dict(items, key, value):
|
||||
|
@ -246,7 +246,7 @@ def main():
|
|||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=False)
|
||||
|
||||
if not HAS_BOTO3:
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
|
||||
# Describe the stack
|
||||
service_mgr = CloudFormationServiceManager(module)
|
||||
|
|
|
@ -388,7 +388,7 @@ def main():
|
|||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=False)
|
||||
|
||||
if not HAS_BOTO3:
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
|
||||
service_mgr = CloudFrontServiceManager(module)
|
||||
|
||||
|
|
|
@ -139,13 +139,13 @@ class CloudTrailManager:
|
|||
ret = self.conn.describe_trails(trail_name_list=[name])
|
||||
trailList = ret.get('trailList', [])
|
||||
if len(trailList) == 1:
|
||||
return trailList[0]
|
||||
return trailList[0]
|
||||
return None
|
||||
|
||||
def exists(self, name=None):
|
||||
ret = self.view(name)
|
||||
if ret:
|
||||
return True
|
||||
return True
|
||||
return False
|
||||
|
||||
def enable_logging(self, name):
|
||||
|
@ -180,7 +180,7 @@ def main():
|
|||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_together=required_together)
|
||||
|
||||
if not HAS_BOTO:
|
||||
module.fail_json(msg='boto is required.')
|
||||
module.fail_json(msg='boto is required.')
|
||||
|
||||
ec2_url, access_key, secret_key, region = get_ec2_creds(module)
|
||||
aws_connect_params = dict(aws_access_key_id=access_key,
|
||||
|
|
|
@ -344,7 +344,7 @@ def validate_index(index, module):
|
|||
module.fail_json(msg='%s is not a valid option for an index' % key)
|
||||
for required_option in INDEX_REQUIRED_OPTIONS:
|
||||
if required_option not in index:
|
||||
module.fail_json(msg='%s is a required option for an index' % required_option)
|
||||
module.fail_json(msg='%s is a required option for an index' % required_option)
|
||||
if index['type'] not in INDEX_TYPE_OPTIONS:
|
||||
module.fail_json(msg='%s is not a valid index type, must be one of %s' % (index['type'], INDEX_TYPE_OPTIONS))
|
||||
|
||||
|
|
|
@ -1033,7 +1033,7 @@ def create_instances(module, ec2, vpc, override_count=None):
|
|||
grp_details = ec2.get_all_security_groups(group_ids=group_id)
|
||||
group_name = [grp_item.name for grp_item in grp_details]
|
||||
except boto.exception.NoAuthHandlerFound as e:
|
||||
module.fail_json(msg = str(e))
|
||||
module.fail_json(msg = str(e))
|
||||
|
||||
# Lookup any instances that much our run id.
|
||||
|
||||
|
@ -1065,11 +1065,11 @@ def create_instances(module, ec2, vpc, override_count=None):
|
|||
'user_data': user_data}
|
||||
|
||||
if ebs_optimized:
|
||||
params['ebs_optimized'] = ebs_optimized
|
||||
params['ebs_optimized'] = ebs_optimized
|
||||
|
||||
# 'tenancy' always has a default value, but it is not a valid parameter for spot instance request
|
||||
if not spot_price:
|
||||
params['tenancy'] = tenancy
|
||||
params['tenancy'] = tenancy
|
||||
|
||||
if boto_supports_profile_name_arg(ec2):
|
||||
params['instance_profile_name'] = instance_profile_name
|
||||
|
@ -1184,8 +1184,8 @@ def create_instances(module, ec2, vpc, override_count=None):
|
|||
if boto_supports_param_in_spot_request(ec2, 'placement_group'):
|
||||
params['placement_group'] = placement_group
|
||||
elif placement_group :
|
||||
module.fail_json(
|
||||
msg="placement_group parameter requires Boto version 2.3.0 or higher.")
|
||||
module.fail_json(
|
||||
msg="placement_group parameter requires Boto version 2.3.0 or higher.")
|
||||
|
||||
# You can't tell spot instances to 'stop'; they will always be
|
||||
# 'terminate'd. For convenience, we'll ignore the latter value.
|
||||
|
|
|
@ -178,7 +178,7 @@ def list_launch_configs(connection, module):
|
|||
launch_config['CreatedTime'] = str(launch_config['CreatedTime'])
|
||||
|
||||
if sort:
|
||||
snaked_launch_configs.sort(key=lambda e: e[sort], reverse=(sort_order=='descending'))
|
||||
snaked_launch_configs.sort(key=lambda e: e[sort], reverse=(sort_order=='descending'))
|
||||
|
||||
try:
|
||||
if sort and sort_start and sort_end:
|
||||
|
|
|
@ -176,12 +176,12 @@ def main():
|
|||
module.fail_json(msg="tags argument is required when state is absent")
|
||||
for (key, value) in set(tags.items()):
|
||||
if (key, value) not in set(tagdict.items()):
|
||||
baddict[key] = value
|
||||
if set(baddict) == set(tags):
|
||||
module.exit_json(msg="Nothing to remove here. Move along.", changed=False)
|
||||
baddict[key] = value
|
||||
if set(baddict) == set(tags):
|
||||
module.exit_json(msg="Nothing to remove here. Move along.", changed=False)
|
||||
for (key, value) in set(tags.items()):
|
||||
if (key, value) in set(tagdict.items()):
|
||||
dictremove[key] = value
|
||||
dictremove[key] = value
|
||||
tagger = ec2.delete_tags(resource, dictremove)
|
||||
gettags = ec2.get_all_tags(filters=filters)
|
||||
module.exit_json(msg="Tags %s removed for resource %s." % (dictremove,resource), changed=True)
|
||||
|
|
|
@ -333,7 +333,7 @@ def main():
|
|||
supplied_options = connection.get_all_dhcp_options(filters={'dhcp-options-id':params['dhcp_options_id']})
|
||||
if len(supplied_options) != 1:
|
||||
if params['state'] != 'absent':
|
||||
module.fail_json(msg=" a dhcp_options_id was supplied, but does not exist")
|
||||
module.fail_json(msg=" a dhcp_options_id was supplied, but does not exist")
|
||||
else:
|
||||
found = True
|
||||
dhcp_option = supplied_options[0]
|
||||
|
|
|
@ -131,7 +131,7 @@ def list_dhcp_options(client, module):
|
|||
|
||||
snaked_dhcp_options_array = []
|
||||
for dhcp_option in all_dhcp_options_array:
|
||||
snaked_dhcp_options_array.append(camel_dict_to_snake_dict(dhcp_option))
|
||||
snaked_dhcp_options_array.append(camel_dict_to_snake_dict(dhcp_option))
|
||||
|
||||
module.exit_json(dhcp_options=snaked_dhcp_options_array)
|
||||
|
||||
|
|
|
@ -387,7 +387,7 @@ def get_nat_gateways(client, subnet_id=None, nat_gateway_id=None,
|
|||
err_msg = '{0} Retrieving gateways'.format(DRY_RUN_MSGS)
|
||||
|
||||
except botocore.exceptions.ClientError as e:
|
||||
err_msg = str(e)
|
||||
err_msg = str(e)
|
||||
|
||||
return gateways_retrieved, err_msg, existing_gateways
|
||||
|
||||
|
@ -592,7 +592,7 @@ def get_eip_allocation_id_by_address(client, eip_address, check_mode=False):
|
|||
)
|
||||
|
||||
except botocore.exceptions.ClientError as e:
|
||||
err_msg = str(e)
|
||||
err_msg = str(e)
|
||||
|
||||
return allocation_id, err_msg
|
||||
|
||||
|
|
|
@ -353,10 +353,10 @@ def main():
|
|||
)
|
||||
|
||||
if not HAS_BOTO:
|
||||
module.fail_json(msg='boto is required.')
|
||||
module.fail_json(msg='boto is required.')
|
||||
|
||||
if not HAS_BOTO3:
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
|
||||
service_mgr = EcsServiceManager(module)
|
||||
|
||||
|
|
|
@ -217,10 +217,10 @@ def main():
|
|||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
|
||||
|
||||
if not HAS_BOTO:
|
||||
module.fail_json(msg='boto is required.')
|
||||
module.fail_json(msg='boto is required.')
|
||||
|
||||
if not HAS_BOTO3:
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
|
||||
show_details = module.params.get('details', False)
|
||||
|
||||
|
|
|
@ -248,10 +248,10 @@ def main():
|
|||
|
||||
# Validate Requirements
|
||||
if not HAS_BOTO:
|
||||
module.fail_json(msg='boto is required.')
|
||||
module.fail_json(msg='boto is required.')
|
||||
|
||||
if not HAS_BOTO3:
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
|
||||
# Validate Inputs
|
||||
if module.params['operation'] == 'run':
|
||||
|
|
|
@ -224,10 +224,10 @@ def main():
|
|||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
|
||||
|
||||
if not HAS_BOTO:
|
||||
module.fail_json(msg='boto is required.')
|
||||
module.fail_json(msg='boto is required.')
|
||||
|
||||
if not HAS_BOTO3:
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
|
||||
task_to_describe = None
|
||||
task_mgr = EcsTaskManager(module)
|
||||
|
|
|
@ -314,7 +314,7 @@ def main():
|
|||
# If VPC configuration is desired
|
||||
if vpc_subnet_ids or vpc_security_group_ids:
|
||||
if len(vpc_subnet_ids) < 1:
|
||||
module.fail_json(msg='At least 1 subnet is required')
|
||||
module.fail_json(msg='At least 1 subnet is required')
|
||||
|
||||
if len(vpc_security_group_ids) < 1:
|
||||
module.fail_json(msg='At least 1 security group is required')
|
||||
|
|
|
@ -352,7 +352,7 @@ class RDSConnection:
|
|||
try:
|
||||
self.connection = connect_to_aws(boto.rds, region, **aws_connect_params)
|
||||
except boto.exception.BotoServerError as e:
|
||||
module.fail_json(msg=e.error_message)
|
||||
module.fail_json(msg=e.error_message)
|
||||
|
||||
def get_db_instance(self, instancename):
|
||||
try:
|
||||
|
@ -438,7 +438,7 @@ class RDS2Connection:
|
|||
try:
|
||||
self.connection = connect_to_aws(boto.rds2, region, **aws_connect_params)
|
||||
except boto.exception.BotoServerError as e:
|
||||
module.fail_json(msg=e.error_message)
|
||||
module.fail_json(msg=e.error_message)
|
||||
|
||||
def get_db_instance(self, instancename):
|
||||
try:
|
||||
|
|
|
@ -282,8 +282,8 @@ def gather_files(fileroot, include=None, exclude=None):
|
|||
if include:
|
||||
found = False
|
||||
for x in include.split(','):
|
||||
if fnmatch.fnmatch(fn, x):
|
||||
found = True
|
||||
if fnmatch.fnmatch(fn, x):
|
||||
found = True
|
||||
if not found:
|
||||
# not on the include list, so we don't want it.
|
||||
continue
|
||||
|
@ -376,7 +376,7 @@ def filter_list(s3, bucket, s3filelist, strategy):
|
|||
keeplist = list(s3filelist)
|
||||
|
||||
for e in keeplist:
|
||||
e['_strategy'] = strategy
|
||||
e['_strategy'] = strategy
|
||||
|
||||
# init/fetch info from S3 if we're going to use it for comparisons
|
||||
if not strategy == 'force':
|
||||
|
|
|
@ -319,10 +319,10 @@ class SnsTopicManager(object):
|
|||
def ensure_gone(self):
|
||||
self.arn_topic = self._arn_topic_lookup()
|
||||
if self.arn_topic:
|
||||
self._get_topic_subs()
|
||||
if self.subscriptions_existing:
|
||||
self._delete_subscriptions()
|
||||
self._delete_topic()
|
||||
self._get_topic_subs()
|
||||
if self.subscriptions_existing:
|
||||
self._delete_subscriptions()
|
||||
self._delete_topic()
|
||||
|
||||
|
||||
def get_info(self):
|
||||
|
|
|
@ -258,11 +258,11 @@ try:
|
|||
import azure as windows_azure
|
||||
|
||||
if hasattr(windows_azure, '__version__') and LooseVersion(windows_azure.__version__) <= "0.11.1":
|
||||
from azure import WindowsAzureError as AzureException
|
||||
from azure import WindowsAzureMissingResourceError as AzureMissingException
|
||||
from azure import WindowsAzureError as AzureException
|
||||
from azure import WindowsAzureMissingResourceError as AzureMissingException
|
||||
else:
|
||||
from azure.common import AzureException as AzureException
|
||||
from azure.common import AzureMissingResourceHttpError as AzureMissingException
|
||||
from azure.common import AzureException as AzureException
|
||||
from azure.common import AzureMissingResourceHttpError as AzureMissingException
|
||||
|
||||
from azure.servicemanagement import (ServiceManagementService, OSVirtualHardDisk, SSH, PublicKeys,
|
||||
PublicKey, LinuxConfigurationSet, ConfigurationSetInputEndpoints,
|
||||
|
|
|
@ -508,7 +508,7 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
|
|||
id=pip.id,
|
||||
location=pip.location,
|
||||
resource_guid=pip.resource_guid)
|
||||
#name=pip.name,
|
||||
#name=pip.name,
|
||||
|
||||
if results['network_security_group'].get('id'):
|
||||
nsg = self.get_security_group(results['network_security_group']['name'])
|
||||
|
|
|
@ -605,7 +605,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||
self.log("Using image version {0}".format(self.image['version']))
|
||||
|
||||
if not self.storage_blob_name:
|
||||
self.storage_blob_name = self.name + '.vhd'
|
||||
self.storage_blob_name = self.name + '.vhd'
|
||||
|
||||
if self.storage_account_name:
|
||||
self.get_storage_account(self.storage_account_name)
|
||||
|
|
|
@ -286,7 +286,7 @@ class ClcPublicIp(object):
|
|||
result = None
|
||||
try:
|
||||
for ip_address in server.PublicIPs().public_ips:
|
||||
result = ip_address.Delete()
|
||||
result = ip_address.Delete()
|
||||
except CLCException as ex:
|
||||
self.module.fail_json(msg='Failed to remove public ip from the server : {0}. {1}'.format(
|
||||
server.id, ex.response_text
|
||||
|
|
|
@ -335,7 +335,7 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack):
|
|||
|
||||
poll_async = self.module.params.get('poll_async')
|
||||
if poll_async:
|
||||
firewall_rule = self.poll_job(res, 'firewallrule')
|
||||
firewall_rule = self.poll_job(res, 'firewallrule')
|
||||
return firewall_rule
|
||||
|
||||
|
||||
|
@ -359,7 +359,7 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack):
|
|||
|
||||
poll_async = self.module.params.get('poll_async')
|
||||
if poll_async:
|
||||
res = self.poll_job(res, 'firewallrule')
|
||||
res = self.poll_job(res, 'firewallrule')
|
||||
return firewall_rule
|
||||
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ class AnsibleCloudStackSecurityGroupRule(AnsibleCloudStack):
|
|||
args['projectid'] = self.get_project('id')
|
||||
sgs = self.cs.listSecurityGroups(**args)
|
||||
if not sgs or 'securitygroup' not in sgs:
|
||||
self.module.fail_json(msg="security group '%s' not found" % security_group_name)
|
||||
self.module.fail_json(msg="security group '%s' not found" % security_group_name)
|
||||
return sgs['securitygroup'][0]
|
||||
|
||||
|
||||
|
|
|
@ -291,8 +291,8 @@ class ImageManager(DockerBaseClass):
|
|||
# If name contains a tag, it takes precedence over tag parameter.
|
||||
repo, repo_tag = parse_repository_tag(self.name)
|
||||
if repo_tag:
|
||||
self.name = repo
|
||||
self.tag = repo_tag
|
||||
self.name = repo
|
||||
self.tag = repo_tag
|
||||
|
||||
if self.state in ['present', 'build']:
|
||||
self.present()
|
||||
|
|
|
@ -520,8 +520,8 @@ def get_stdout(path_name):
|
|||
new_line = re.sub(r'\x1b\[.+m', '', line.encode('ascii'))
|
||||
full_stdout += new_line
|
||||
if new_line.strip():
|
||||
# Assuming last line contains the error message
|
||||
last_line = new_line.strip().encode('utf-8')
|
||||
# Assuming last line contains the error message
|
||||
last_line = new_line.strip().encode('utf-8')
|
||||
fd.close()
|
||||
os.remove(path_name)
|
||||
return full_stdout, last_line
|
||||
|
|
|
@ -332,7 +332,7 @@ def handle_put(module, gs, bucket, obj, overwrite, src, expiration):
|
|||
|
||||
# If bucket exists but key doesn't, just upload.
|
||||
if bucket_rc and not key_rc:
|
||||
upload_gsfile(module, gs, bucket, obj, src, expiration)
|
||||
upload_gsfile(module, gs, bucket, obj, src, expiration)
|
||||
|
||||
def handle_delete(module, gs, bucket, obj):
|
||||
if bucket and not obj:
|
||||
|
|
|
@ -287,7 +287,7 @@ def main():
|
|||
json_output['ipv4_range'] = network.cidr
|
||||
if network and mode == 'custom' and subnet_name:
|
||||
if not hasattr(gce, 'ex_get_subnetwork'):
|
||||
module.fail_json(msg="Update libcloud to a more recent version (>1.0) that supports network 'mode' parameter", changed=False)
|
||||
module.fail_json(msg="Update libcloud to a more recent version (>1.0) that supports network 'mode' parameter", changed=False)
|
||||
|
||||
subnet = gce.ex_get_subnetwork(subnet_name, region=subnet_region)
|
||||
json_output['subnet_name'] = subnet_name
|
||||
|
|
|
@ -220,7 +220,7 @@ def main():
|
|||
except ResourceNotFoundError:
|
||||
module.fail_json(msg='Instance %s not found in zone %s' % (instance_name, zone), changed=False)
|
||||
except GoogleBaseError as e:
|
||||
module.fail_json(msg=str(e), changed=False, exception=traceback.format_exc())
|
||||
module.fail_json(msg=str(e), changed=False, exception=traceback.format_exc())
|
||||
|
||||
# Tag nodes
|
||||
instance_pattern_matches = []
|
||||
|
|
|
@ -626,10 +626,10 @@ class RHEVConn(object):
|
|||
setFailed()
|
||||
return False
|
||||
elif int(DISK.size) < (1024 * 1024 * 1024 * int(disksize)):
|
||||
setMsg("Shrinking disks is not supported")
|
||||
setMsg(str(e))
|
||||
setFailed()
|
||||
return False
|
||||
setMsg("Shrinking disks is not supported")
|
||||
setMsg(str(e))
|
||||
setFailed()
|
||||
return False
|
||||
else:
|
||||
setMsg("The size of the disk is correct")
|
||||
if str(DISK.interface) != str(diskinterface):
|
||||
|
|
|
@ -154,7 +154,7 @@ def get_vms(session):
|
|||
|
||||
vms = change_keys(recs, key='uuid')
|
||||
for vm in vms.values():
|
||||
xs_vms[vm['name_label']] = vm
|
||||
xs_vms[vm['name_label']] = vm
|
||||
return xs_vms
|
||||
|
||||
|
||||
|
@ -165,7 +165,7 @@ def get_srs(session):
|
|||
return None
|
||||
srs = change_keys(recs, key='uuid')
|
||||
for sr in srs.values():
|
||||
xs_srs[sr['name_label']] = sr
|
||||
xs_srs[sr['name_label']] = sr
|
||||
return xs_srs
|
||||
|
||||
def main():
|
||||
|
|
|
@ -443,14 +443,14 @@ def _create_server(module, nova):
|
|||
server = nova.servers.create(*bootargs, **bootkwargs)
|
||||
server = nova.servers.get(server.id)
|
||||
except Exception as e:
|
||||
module.fail_json( msg = "Error in creating instance: %s " % e.message)
|
||||
module.fail_json( msg = "Error in creating instance: %s " % e.message)
|
||||
if module.params['wait'] == 'yes':
|
||||
expire = time.time() + int(module.params['wait_for'])
|
||||
while time.time() < expire:
|
||||
try:
|
||||
server = nova.servers.get(server.id)
|
||||
except Exception as e:
|
||||
module.fail_json( msg = "Error in getting info from instance: %s" % e.message)
|
||||
module.fail_json( msg = "Error in getting info from instance: %s" % e.message)
|
||||
if server.status == 'ACTIVE':
|
||||
server = _add_floating_ip(module, nova, server)
|
||||
|
||||
|
@ -466,7 +466,7 @@ def _create_server(module, nova):
|
|||
|
||||
module.fail_json(msg = "Timeout waiting for the server to come up.. Please check manually")
|
||||
if server.status == 'ERROR':
|
||||
module.fail_json(msg = "Error in creating the server.. Please check manually")
|
||||
module.fail_json(msg = "Error in creating the server.. Please check manually")
|
||||
private = openstack_find_nova_addresses(getattr(server, 'addresses'), 'fixed', 'private')
|
||||
public = openstack_find_nova_addresses(getattr(server, 'addresses'), 'floating', 'public')
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ def _get_server_state(module, nova):
|
|||
server_info = info
|
||||
break
|
||||
except Exception as e:
|
||||
module.fail_json(msg = "Error in getting the server list: %s" % e.message)
|
||||
module.fail_json(msg = "Error in getting the server list: %s" % e.message)
|
||||
return server_info, server
|
||||
|
||||
def _get_port_id(neutron, module, instance_id):
|
||||
|
|
|
@ -267,12 +267,12 @@ def main():
|
|||
module.fail_json(msg='python-keystoneclient and either python-neutronclient or python-quantumclient are required')
|
||||
|
||||
if module.params['provider_network_type'] in ['vlan' , 'flat']:
|
||||
if not module.params['provider_physical_network']:
|
||||
module.fail_json(msg = " for vlan and flat networks, variable provider_physical_network should be set.")
|
||||
if not module.params['provider_physical_network']:
|
||||
module.fail_json(msg = " for vlan and flat networks, variable provider_physical_network should be set.")
|
||||
|
||||
if module.params['provider_network_type'] in ['vlan', 'gre']:
|
||||
if not module.params['provider_segmentation_id']:
|
||||
module.fail_json(msg = " for vlan & gre networks, variable provider_segmentation_id should be set.")
|
||||
if not module.params['provider_segmentation_id']:
|
||||
module.fail_json(msg = " for vlan & gre networks, variable provider_segmentation_id should be set.")
|
||||
|
||||
neutron = _get_neutron_client(module, module.params)
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ def _get_router_id(module, neutron):
|
|||
except Exception as e:
|
||||
module.fail_json(msg = "Error in getting the router list: %s " % e.message)
|
||||
if not routers['routers']:
|
||||
return None
|
||||
return None
|
||||
return routers['routers'][0]['id']
|
||||
|
||||
def _get_net_id(neutron, module):
|
||||
|
|
|
@ -201,7 +201,7 @@ def _get_net_id(neutron, module):
|
|||
except Exception as e:
|
||||
module.fail_json("Error in listing neutron networks: %s" % e.message)
|
||||
if not networks['networks']:
|
||||
return None
|
||||
return None
|
||||
return networks['networks'][0]['id']
|
||||
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ def _check_set_power_state(module, cloud, node):
|
|||
if 'power off' in str(node['power_state']):
|
||||
if (_is_false(module.params['power']) and
|
||||
_is_false(module.params['state'])):
|
||||
return False
|
||||
return False
|
||||
if (_is_false(module.params['power']) and
|
||||
_is_false(module.params['state'])):
|
||||
module.exit_json(
|
||||
|
|
|
@ -100,7 +100,7 @@ def process_object(
|
|||
if container_obj:
|
||||
if name:
|
||||
if cloud_obj.get_object_metadata(container, name):
|
||||
cloud_obj.delete_object(container, name)
|
||||
cloud_obj.delete_object(container, name)
|
||||
changed= True
|
||||
else:
|
||||
cloud_obj.delete_container(container)
|
||||
|
|
|
@ -176,7 +176,7 @@ def _can_update(subnet, module, cloud):
|
|||
else:
|
||||
module.fail_json(msg='No network found for %s' % network_name)
|
||||
if netid != subnet['network_id']:
|
||||
module.fail_json(msg='Cannot update network_name in existing \
|
||||
module.fail_json(msg='Cannot update network_name in existing \
|
||||
subnet')
|
||||
if ip_version and subnet['ip_version'] != ip_version:
|
||||
module.fail_json(msg='Cannot update ip_version in existing subnet')
|
||||
|
|
|
@ -500,7 +500,7 @@ def act_on_devices(target_state, module, packet_conn):
|
|||
created_devices = [create_single_device(module, packet_conn, n)
|
||||
for n in create_hostnames]
|
||||
if module.params.get('wait'):
|
||||
created_devices = wait_for_ips(module, packet_conn, created_devices)
|
||||
created_devices = wait_for_ips(module, packet_conn, created_devices)
|
||||
changed = True
|
||||
|
||||
processed_devices = created_devices + process_devices
|
||||
|
|
|
@ -169,10 +169,10 @@ def get_sshkey_selector(module):
|
|||
def selector(k):
|
||||
if 'key' in select_dict:
|
||||
# if key string is specified, compare only the key strings
|
||||
return k.key == select_dict['key']
|
||||
return k.key == select_dict['key']
|
||||
else:
|
||||
# if key string not specified, all the fields must match
|
||||
return all([select_dict[f] == getattr(k,f) for f in select_dict])
|
||||
return all([select_dict[f] == getattr(k,f) for f in select_dict])
|
||||
return selector
|
||||
|
||||
|
||||
|
|
|
@ -246,4 +246,4 @@ def main():
|
|||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.vca import *
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
|
|
@ -86,10 +86,10 @@ except ImportError:
|
|||
|
||||
|
||||
def find_vswitch_by_name(host, vswitch_name):
|
||||
for vss in host.config.network.vswitch:
|
||||
if vss.name == vswitch_name:
|
||||
return vss
|
||||
return None
|
||||
for vss in host.config.network.vswitch:
|
||||
if vss.name == vswitch_name:
|
||||
return vss
|
||||
return None
|
||||
|
||||
|
||||
class VMwareHostVirtualSwitch(object):
|
||||
|
|
|
@ -365,19 +365,19 @@ def parse_check(module):
|
|||
|
||||
if module.params.get('check_id') or module.params.get('script') or module.params.get('ttl') or module.params.get('http'):
|
||||
|
||||
return ConsulCheck(
|
||||
module.params.get('check_id'),
|
||||
module.params.get('check_name'),
|
||||
module.params.get('check_node'),
|
||||
module.params.get('check_host'),
|
||||
module.params.get('script'),
|
||||
module.params.get('interval'),
|
||||
module.params.get('ttl'),
|
||||
module.params.get('notes'),
|
||||
module.params.get('http'),
|
||||
module.params.get('timeout'),
|
||||
module.params.get('service_id'),
|
||||
)
|
||||
return ConsulCheck(
|
||||
module.params.get('check_id'),
|
||||
module.params.get('check_name'),
|
||||
module.params.get('check_node'),
|
||||
module.params.get('check_host'),
|
||||
module.params.get('script'),
|
||||
module.params.get('interval'),
|
||||
module.params.get('ttl'),
|
||||
module.params.get('notes'),
|
||||
module.params.get('http'),
|
||||
module.params.get('timeout'),
|
||||
module.params.get('service_id'),
|
||||
)
|
||||
|
||||
|
||||
def parse_service(module):
|
||||
|
|
|
@ -123,11 +123,11 @@ class PublicKey(object):
|
|||
|
||||
if not os.path.exists(self.path) or self.force:
|
||||
try:
|
||||
privatekey_content = open(self.privatekey_path, 'r').read()
|
||||
privatekey = crypto.load_privatekey(crypto.FILETYPE_PEM, privatekey_content)
|
||||
publickey_file = open(self.path, 'w')
|
||||
publickey_file.write(crypto.dump_publickey(crypto.FILETYPE_PEM, privatekey))
|
||||
publickey_file.close()
|
||||
privatekey_content = open(self.privatekey_path, 'r').read()
|
||||
privatekey = crypto.load_privatekey(crypto.FILETYPE_PEM, privatekey_content)
|
||||
publickey_file = open(self.path, 'w')
|
||||
publickey_file.write(crypto.dump_publickey(crypto.FILETYPE_PEM, privatekey))
|
||||
publickey_file.close()
|
||||
except (IOError, OSError):
|
||||
e = get_exception()
|
||||
raise PublicKeyError(e)
|
||||
|
|
|
@ -236,4 +236,4 @@ from ansible.module_utils.basic import *
|
|||
from ansible.module_utils.pycompat24 import get_exception
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
|
|
@ -194,10 +194,10 @@ def main():
|
|||
cursor = conn.cursor()
|
||||
except Exception as e:
|
||||
if "Unknown database" in str(e):
|
||||
errno, errstr = e.args
|
||||
module.fail_json(msg="ERROR: %s %s" % (errno, errstr))
|
||||
errno, errstr = e.args
|
||||
module.fail_json(msg="ERROR: %s %s" % (errno, errstr))
|
||||
else:
|
||||
module.fail_json(msg="unable to connect, check login_user and login_password are correct, or alternatively check your @sysconfdir@/freetds.conf / ${HOME}/.freetds.conf")
|
||||
module.fail_json(msg="unable to connect, check login_user and login_password are correct, or alternatively check your @sysconfdir@/freetds.conf / ${HOME}/.freetds.conf")
|
||||
|
||||
conn.autocommit(True)
|
||||
changed = False
|
||||
|
|
|
@ -223,7 +223,7 @@ def db_create(cursor, db, owner, template, encoding, lc_collate, lc_ctype):
|
|||
|
||||
def db_matches(cursor, db, owner, template, encoding, lc_collate, lc_ctype):
|
||||
if not db_exists(cursor, db):
|
||||
return False
|
||||
return False
|
||||
else:
|
||||
db_info = get_db_info(cursor, db)
|
||||
if (encoding and
|
||||
|
|
|
@ -139,7 +139,7 @@ def update_roles(role_facts, cursor, role,
|
|||
def check(role_facts, role, assigned_roles):
|
||||
role_key = role.lower()
|
||||
if role_key not in role_facts:
|
||||
return False
|
||||
return False
|
||||
if assigned_roles and cmp(sorted(assigned_roles), sorted(role_facts[role_key]['assigned_roles'])) != 0:
|
||||
return False
|
||||
return True
|
||||
|
|
|
@ -184,12 +184,12 @@ def update_roles(schema_facts, cursor, schema,
|
|||
cursor.execute("create role {0}".format(role))
|
||||
cursor.execute("grant usage on schema {0} to {1}".format(schema, role))
|
||||
for role in set(create_required) - set(create_existing):
|
||||
cursor.execute("grant create on schema {0} to {1}".format(schema, role))
|
||||
cursor.execute("grant create on schema {0} to {1}".format(schema, role))
|
||||
|
||||
def check(schema_facts, schema, usage_roles, create_roles, owner):
|
||||
schema_key = schema.lower()
|
||||
if schema_key not in schema_facts:
|
||||
return False
|
||||
return False
|
||||
if owner and owner.lower() == schema_facts[schema_key]['owner'].lower():
|
||||
return False
|
||||
if cmp(sorted(usage_roles), sorted(schema_facts[schema_key]['usage_roles'])) != 0:
|
||||
|
|
|
@ -195,7 +195,7 @@ def check(user_facts, user, profile, resource_pool,
|
|||
locked, password, expired, ldap, roles):
|
||||
user_key = user.lower()
|
||||
if user_key not in user_facts:
|
||||
return False
|
||||
return False
|
||||
if profile and profile != user_facts[user_key]['profile']:
|
||||
return False
|
||||
if resource_pool and resource_pool != user_facts[user_key]['resource_pool']:
|
||||
|
|
|
@ -231,16 +231,16 @@ def contentfilter(fsname, pattern):
|
|||
return True
|
||||
|
||||
try:
|
||||
f = open(fsname)
|
||||
prog = re.compile(pattern)
|
||||
for line in f:
|
||||
if prog.match (line):
|
||||
f.close()
|
||||
return True
|
||||
f = open(fsname)
|
||||
prog = re.compile(pattern)
|
||||
for line in f:
|
||||
if prog.match (line):
|
||||
f.close()
|
||||
return True
|
||||
|
||||
f.close()
|
||||
f.close()
|
||||
except:
|
||||
pass
|
||||
pass
|
||||
|
||||
return False
|
||||
|
||||
|
@ -337,7 +337,7 @@ def main():
|
|||
fsname=os.path.normpath(os.path.join(root, fsobj))
|
||||
|
||||
if os.path.basename(fsname).startswith('.') and not params['hidden']:
|
||||
continue
|
||||
continue
|
||||
|
||||
try:
|
||||
st = os.lstat(fsname)
|
||||
|
|
|
@ -134,17 +134,17 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
# match_opt
|
||||
|
||||
def match_opt(option, line):
|
||||
option = re.escape(option)
|
||||
return re.match(' *%s( |\t)*=' % option, line) \
|
||||
or re.match('# *%s( |\t)*=' % option, line) \
|
||||
or re.match('; *%s( |\t)*=' % option, line)
|
||||
option = re.escape(option)
|
||||
return re.match(' *%s( |\t)*=' % option, line) \
|
||||
or re.match('# *%s( |\t)*=' % option, line) \
|
||||
or re.match('; *%s( |\t)*=' % option, line)
|
||||
|
||||
# ==============================================================
|
||||
# match_active_opt
|
||||
|
||||
def match_active_opt(option, line):
|
||||
option = re.escape(option)
|
||||
return re.match(' *%s( |\t)*=' % option, line)
|
||||
option = re.escape(option)
|
||||
return re.match(' *%s( |\t)*=' % option, line)
|
||||
|
||||
# ==============================================================
|
||||
# do_ini
|
||||
|
|
|
@ -443,10 +443,10 @@ def main():
|
|||
ssh_opts = '-S none'
|
||||
|
||||
if not verify_host:
|
||||
ssh_opts = '%s -o StrictHostKeyChecking=no' % ssh_opts
|
||||
ssh_opts = '%s -o StrictHostKeyChecking=no' % ssh_opts
|
||||
|
||||
if ssh_args:
|
||||
ssh_opts = '%s %s' % (ssh_opts, ssh_args)
|
||||
ssh_opts = '%s %s' % (ssh_opts, ssh_args)
|
||||
|
||||
if source.startswith('"rsync://') and dest.startswith('"rsync://'):
|
||||
module.fail_json(msg='either src or dest must be a localhost', rc=1)
|
||||
|
|
|
@ -591,7 +591,7 @@ class TgzArchive(object):
|
|||
self.opts = module.params['extra_opts']
|
||||
self.module = module
|
||||
if self.module.check_mode:
|
||||
self.module.exit_json(skipped=True, msg="remote module (%s) does not support check mode when using gtar" % self.module._name)
|
||||
self.module.exit_json(skipped=True, msg="remote module (%s) does not support check mode when using gtar" % self.module._name)
|
||||
self.excludes = [ path.rstrip('/') for path in self.module.params['exclude']]
|
||||
# Prefer gtar (GNU tar) as it supports the compression options -z, -j and -J
|
||||
self.cmd_path = self.module.get_bin_path('gtar', None)
|
||||
|
|
|
@ -307,7 +307,7 @@ def delete_monitor(module):
|
|||
def mute_monitor(module):
|
||||
monitor = _get_monitor(module)
|
||||
if not monitor:
|
||||
module.fail_json(msg="Monitor %s not found!" % module.params['name'])
|
||||
module.fail_json(msg="Monitor %s not found!" % module.params['name'])
|
||||
elif monitor['options']['silenced']:
|
||||
module.fail_json(msg="Monitor is already muted. Datadog does not allow to modify muted alerts, consider unmuting it first.")
|
||||
elif (module.params['silenced'] is not None
|
||||
|
@ -327,7 +327,7 @@ def mute_monitor(module):
|
|||
def unmute_monitor(module):
|
||||
monitor = _get_monitor(module)
|
||||
if not monitor:
|
||||
module.fail_json(msg="Monitor %s not found!" % module.params['name'])
|
||||
module.fail_json(msg="Monitor %s not found!" % module.params['name'])
|
||||
elif not monitor['options']['silenced']:
|
||||
module.exit_json(changed=False)
|
||||
try:
|
||||
|
|
|
@ -144,21 +144,21 @@ def post_annotation(module):
|
|||
|
||||
def main():
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
user = dict(required=True),
|
||||
api_key = dict(required=True),
|
||||
name = dict(required=False),
|
||||
title = dict(required=True),
|
||||
source = dict(required=False),
|
||||
description = dict(required=False),
|
||||
start_time = dict(required=False, default=None, type='int'),
|
||||
end_time = dict(require=False, default=None, type='int'),
|
||||
links = dict(type='list')
|
||||
)
|
||||
)
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
user = dict(required=True),
|
||||
api_key = dict(required=True),
|
||||
name = dict(required=False),
|
||||
title = dict(required=True),
|
||||
source = dict(required=False),
|
||||
description = dict(required=False),
|
||||
start_time = dict(required=False, default=None, type='int'),
|
||||
end_time = dict(require=False, default=None, type='int'),
|
||||
links = dict(type='list')
|
||||
)
|
||||
)
|
||||
|
||||
post_annotation(module)
|
||||
post_annotation(module)
|
||||
|
||||
from ansible.module_utils.basic import *
|
||||
from ansible.module_utils.urls import *
|
||||
|
|
|
@ -567,8 +567,8 @@ def selector(module):
|
|||
to take given the right parameters"""
|
||||
|
||||
if module.params["target"] == "host":
|
||||
target = Host(module.params, module)
|
||||
target.site_facts()
|
||||
target = Host(module.params, module)
|
||||
target.site_facts()
|
||||
elif module.params["target"] == "hostgroup":
|
||||
# Validate target specific required parameters
|
||||
if module.params["fullpath"] is not None:
|
||||
|
|
|
@ -286,29 +286,29 @@ def sensu_check(module, path, name, state='present', backup=False):
|
|||
reasons.append('`{opt}\' was removed'.format(opt=opt))
|
||||
|
||||
if module.params['custom']:
|
||||
# Convert to json
|
||||
custom_params = module.params['custom']
|
||||
overwrited_fields = set(custom_params.keys()) & set(simple_opts + ['type','subdue','subdue_begin','subdue_end'])
|
||||
if overwrited_fields:
|
||||
msg = 'You can\'t overwriting standard module parameters via "custom". You are trying overwrite: {opt}'.format(opt=list(overwrited_fields))
|
||||
module.fail_json(msg=msg)
|
||||
# Convert to json
|
||||
custom_params = module.params['custom']
|
||||
overwrited_fields = set(custom_params.keys()) & set(simple_opts + ['type','subdue','subdue_begin','subdue_end'])
|
||||
if overwrited_fields:
|
||||
msg = 'You can\'t overwriting standard module parameters via "custom". You are trying overwrite: {opt}'.format(opt=list(overwrited_fields))
|
||||
module.fail_json(msg=msg)
|
||||
|
||||
for k,v in custom_params.items():
|
||||
if k in config['checks'][name]:
|
||||
if not config['checks'][name][k] == v:
|
||||
changed = True
|
||||
reasons.append('`custom param {opt}\' was changed'.format(opt=k))
|
||||
else:
|
||||
changed = True
|
||||
reasons.append('`custom param {opt}\' was added'.format(opt=k))
|
||||
check[k] = v
|
||||
simple_opts += custom_params.keys()
|
||||
for k,v in custom_params.items():
|
||||
if k in config['checks'][name]:
|
||||
if not config['checks'][name][k] == v:
|
||||
changed = True
|
||||
reasons.append('`custom param {opt}\' was changed'.format(opt=k))
|
||||
else:
|
||||
changed = True
|
||||
reasons.append('`custom param {opt}\' was added'.format(opt=k))
|
||||
check[k] = v
|
||||
simple_opts += custom_params.keys()
|
||||
|
||||
# Remove obsolete custom params
|
||||
for opt in set(config['checks'][name].keys()) - set(simple_opts + ['type','subdue','subdue_begin','subdue_end']):
|
||||
changed = True
|
||||
reasons.append('`custom param {opt}\' was deleted'.format(opt=opt))
|
||||
del check[opt]
|
||||
changed = True
|
||||
reasons.append('`custom param {opt}\' was deleted'.format(opt=opt))
|
||||
del check[opt]
|
||||
|
||||
if module.params['metric']:
|
||||
if 'type' not in check or check['type'] != 'metric':
|
||||
|
|
|
@ -405,7 +405,7 @@ def main():
|
|||
body = json.dumps(body)
|
||||
lower_header_keys = [key.lower() for key in dict_headers]
|
||||
if 'content-type' not in lower_header_keys:
|
||||
dict_headers['Content-Type'] = 'application/json'
|
||||
dict_headers['Content-Type'] = 'application/json'
|
||||
|
||||
# Grab all the http headers. Need this hack since passing multi-values is
|
||||
# currently a bit ugly. (e.g. headers='{"Content-Type":"application/json"}')
|
||||
|
|
|
@ -514,10 +514,10 @@ class CloudflareAPI(object):
|
|||
def ensure_dns_record(self,**kwargs):
|
||||
params = {}
|
||||
for param in ['port','priority','proto','proxied','service','ttl','type','record','value','weight','zone']:
|
||||
if param in kwargs:
|
||||
params[param] = kwargs[param]
|
||||
else:
|
||||
params[param] = getattr(self,param)
|
||||
if param in kwargs:
|
||||
params[param] = kwargs[param]
|
||||
else:
|
||||
params[param] = getattr(self,param)
|
||||
|
||||
search_value = params['value']
|
||||
search_record = params['record']
|
||||
|
|
|
@ -112,10 +112,10 @@ CL_LICENSE_PATH='/usr/cumulus/bin/cl-license'
|
|||
|
||||
def install_license(module):
|
||||
# license is not installed, install it
|
||||
_url = module.params.get('src')
|
||||
(_rc, out, _err) = module.run_command("%s -i %s" % (CL_LICENSE_PATH, _url))
|
||||
if _rc > 0:
|
||||
module.fail_json(msg=_err)
|
||||
_url = module.params.get('src')
|
||||
(_rc, out, _err) = module.run_command("%s -i %s" % (CL_LICENSE_PATH, _url))
|
||||
if _rc > 0:
|
||||
module.fail_json(msg=_err)
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -431,8 +431,8 @@ class Interfaces(FactsBase):
|
|||
match = re.search(r'Internet address is (\S+)', data)
|
||||
if match:
|
||||
if match.group(1) != "not":
|
||||
addr, masklen = match.group(1).split('/')
|
||||
return dict(address=addr, masklen=int(masklen))
|
||||
addr, masklen = match.group(1).split('/')
|
||||
return dict(address=addr, masklen=int(masklen))
|
||||
|
||||
def parse_mtu(self, data):
|
||||
match = re.search(r'MTU (\d+)', data)
|
||||
|
@ -463,7 +463,7 @@ class Interfaces(FactsBase):
|
|||
def parse_lineprotocol(self, data):
|
||||
match = re.search(r'line protocol is (\w+[ ]?\w*)\(?.*\)?$', data, re.M)
|
||||
if match:
|
||||
return match.group(1)
|
||||
return match.group(1)
|
||||
|
||||
def parse_operstatus(self, data):
|
||||
match = re.search(r'^(?:.+) is (.+),', data, re.M)
|
||||
|
|
|
@ -343,7 +343,7 @@ class ExoDnsRecord(ExoDns):
|
|||
self.result['diff']['before'] = record
|
||||
self.result['changed'] = True
|
||||
if not self.module.check_mode:
|
||||
self.api_query("/domains/%s/records/%s" % (self.domain, record['record']['id']), "DELETE")
|
||||
self.api_query("/domains/%s/records/%s" % (self.domain, record['record']['id']), "DELETE")
|
||||
return record
|
||||
|
||||
def get_result(self, resource):
|
||||
|
|
|
@ -342,7 +342,7 @@ def main():
|
|||
if monitors:
|
||||
monitors = []
|
||||
for monitor in module.params['monitors']:
|
||||
monitors.append(fq_name(partition, monitor))
|
||||
monitors.append(fq_name(partition, monitor))
|
||||
|
||||
# sanity check user supplied values
|
||||
if state == 'absent' and host is not None:
|
||||
|
|
|
@ -186,7 +186,7 @@ WAIT_INTERVAL=5
|
|||
|
||||
######################################################################
|
||||
class TimeoutException(Exception):
|
||||
pass
|
||||
pass
|
||||
|
||||
class HAProxy(object):
|
||||
"""
|
||||
|
@ -356,8 +356,8 @@ class HAProxy(object):
|
|||
|
||||
# Report change status
|
||||
if state_before != state_after:
|
||||
self.command_results['changed'] = True
|
||||
self.module.exit_json(**self.command_results)
|
||||
self.command_results['changed'] = True
|
||||
self.module.exit_json(**self.command_results)
|
||||
else:
|
||||
self.command_results['changed'] = False
|
||||
self.module.exit_json(**self.command_results)
|
||||
|
|
|
@ -163,7 +163,7 @@ def main():
|
|||
if type == 'chat':
|
||||
module.fail_json(msg="%s is not valid for the 'chat' type" % item)
|
||||
else:
|
||||
params[item] = module.params[item]
|
||||
params[item] = module.params[item]
|
||||
elif type == 'inbox':
|
||||
module.fail_json(msg="%s is required for the 'inbox' type" % item)
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ def main():
|
|||
e = get_exception()
|
||||
module.fail_json(rc=1, msg='Unable to start an encrypted session to %s:%s: %s' % (host, port, e))
|
||||
else:
|
||||
module.fail_json(rc=1, msg='Unable to Connect to %s:%s: %s' % (host, port, e))
|
||||
module.fail_json(rc=1, msg='Unable to Connect to %s:%s: %s' % (host, port, e))
|
||||
|
||||
|
||||
if (secure == 'always'):
|
||||
|
|
|
@ -140,14 +140,14 @@ def _is_package_installed(module, name, locallib, cpanm, version):
|
|||
os.environ["PERL5LIB"] = "%s/lib/perl5" % locallib
|
||||
cmd = "%s perl -e ' use %s" % (cmd, name)
|
||||
if version:
|
||||
cmd = "%s %s;'" % (cmd, version)
|
||||
cmd = "%s %s;'" % (cmd, version)
|
||||
else:
|
||||
cmd = "%s;'" % cmd
|
||||
cmd = "%s;'" % cmd
|
||||
res, stdout, stderr = module.run_command(cmd, check_rc=False)
|
||||
if res == 0:
|
||||
return True
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return False
|
||||
|
||||
def _build_cmd_line(name, from_path, notest, locallib, mirror, mirror_only, installdeps, cpanm, use_sudo):
|
||||
# this code should use "%s" like everything else and just return early but not fixing all of it now.
|
||||
|
|
|
@ -265,11 +265,11 @@ class MavenDownloader:
|
|||
url_to_use = url
|
||||
parsed_url = urlparse(url)
|
||||
if parsed_url.scheme=='s3':
|
||||
parsed_url = urlparse(url)
|
||||
bucket_name = parsed_url.netloc
|
||||
key_name = parsed_url.path[1:]
|
||||
client = boto3.client('s3',aws_access_key_id=self.module.params.get('username', ''), aws_secret_access_key=self.module.params.get('password', ''))
|
||||
url_to_use = client.generate_presigned_url('get_object',Params={'Bucket':bucket_name,'Key':key_name},ExpiresIn=10)
|
||||
parsed_url = urlparse(url)
|
||||
bucket_name = parsed_url.netloc
|
||||
key_name = parsed_url.path[1:]
|
||||
client = boto3.client('s3',aws_access_key_id=self.module.params.get('username', ''), aws_secret_access_key=self.module.params.get('password', ''))
|
||||
url_to_use = client.generate_presigned_url('get_object',Params={'Bucket':bucket_name,'Key':key_name},ExpiresIn=10)
|
||||
|
||||
req_timeout = self.module.params.get('timeout')
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ def main():
|
|||
changed = current != selection
|
||||
|
||||
if module.check_mode or not changed:
|
||||
module.exit_json(changed=changed, before=current, after=selection)
|
||||
module.exit_json(changed=changed, before=current, after=selection)
|
||||
|
||||
module.run_command([dpkg, '--set-selections'], data="%s %s" % (name, selection), check_rc=True)
|
||||
module.exit_json(changed=changed, before=current, after=selection)
|
||||
|
|
|
@ -318,7 +318,7 @@ def do_upgrade_packages(module, full=False):
|
|||
module.fail_json(msg="could not %s packages" % cmd)
|
||||
|
||||
def upgrade_packages(module):
|
||||
do_upgrade_packages(module)
|
||||
do_upgrade_packages(module)
|
||||
|
||||
def full_upgrade_packages(module):
|
||||
do_upgrade_packages(module, True)
|
||||
|
|
|
@ -320,7 +320,7 @@ class NailGun(object):
|
|||
|
||||
if len(repository) == 0:
|
||||
if 'releasever' in params:
|
||||
reposet.enable(data={'basearch': params['basearch'], 'releasever': params['releasever']})
|
||||
reposet.enable(data={'basearch': params['basearch'], 'releasever': params['releasever']})
|
||||
else:
|
||||
reposet.enable(data={'basearch': params['basearch']})
|
||||
|
||||
|
|
|
@ -134,9 +134,9 @@ class StackiHost:
|
|||
init_csrftoken = None
|
||||
for c in cookie_a:
|
||||
if "csrftoken" in c:
|
||||
init_csrftoken = c.replace("csrftoken=", "")
|
||||
init_csrftoken = init_csrftoken.rstrip("\r\n")
|
||||
break
|
||||
init_csrftoken = c.replace("csrftoken=", "")
|
||||
init_csrftoken = init_csrftoken.rstrip("\r\n")
|
||||
break
|
||||
|
||||
# Make Header Dictionary with initial CSRF
|
||||
header = {'csrftoken': init_csrftoken, 'X-CSRFToken': init_csrftoken,
|
||||
|
|
|
@ -279,7 +279,7 @@ def set_port_disabled_permanent(zone, port, protocol):
|
|||
def get_source(zone, source):
|
||||
fw_zone, fw_settings = get_fw_zone_settings(zone)
|
||||
if source in fw_settings.getSources():
|
||||
return True
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
@ -317,7 +317,7 @@ def get_interface_permanent(zone, interface):
|
|||
fw_zone, fw_settings = get_fw_zone_settings(zone)
|
||||
|
||||
if interface in fw_settings.getInterfaces():
|
||||
return True
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
|
|
@ -102,13 +102,13 @@ def parse_vgs(data):
|
|||
return vgs
|
||||
|
||||
def find_mapper_device_name(module, dm_device):
|
||||
dmsetup_cmd = module.get_bin_path('dmsetup', True)
|
||||
mapper_prefix = '/dev/mapper/'
|
||||
rc, dm_name, err = module.run_command("%s info -C --noheadings -o name %s" % (dmsetup_cmd, dm_device))
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed executing dmsetup command.", rc=rc, err=err)
|
||||
mapper_device = mapper_prefix + dm_name.rstrip()
|
||||
return mapper_device
|
||||
dmsetup_cmd = module.get_bin_path('dmsetup', True)
|
||||
mapper_prefix = '/dev/mapper/'
|
||||
rc, dm_name, err = module.run_command("%s info -C --noheadings -o name %s" % (dmsetup_cmd, dm_device))
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed executing dmsetup command.", rc=rc, err=err)
|
||||
mapper_device = mapper_prefix + dm_name.rstrip()
|
||||
return mapper_device
|
||||
|
||||
def parse_pvs(module, data):
|
||||
pvs = []
|
||||
|
|
|
@ -315,15 +315,15 @@ def main():
|
|||
if not '%' in size:
|
||||
# LVCREATE(8) -L --size option unit
|
||||
if size[-1].lower() in 'bskmgtpe':
|
||||
size_unit = size[-1].lower()
|
||||
size = size[0:-1]
|
||||
size_unit = size[-1].lower()
|
||||
size = size[0:-1]
|
||||
|
||||
try:
|
||||
float(size)
|
||||
if not size[0].isdigit():
|
||||
raise ValueError()
|
||||
float(size)
|
||||
if not size[0].isdigit():
|
||||
raise ValueError()
|
||||
except ValueError:
|
||||
module.fail_json(msg="Bad size specification of '%s'" % size)
|
||||
module.fail_json(msg="Bad size specification of '%s'" % size)
|
||||
|
||||
# when no unit, megabytes by default
|
||||
if size_opt == 'l':
|
||||
|
|
|
@ -326,10 +326,10 @@ class OSXDefaults(object):
|
|||
# Current value matches the given value. Nothing need to be done. Arrays need extra care
|
||||
if self.type == "array" and self.current_value is not None and not self.array_add and \
|
||||
set(self.current_value) == set(self.value):
|
||||
return False
|
||||
return False
|
||||
elif self.type == "array" and self.current_value is not None and self.array_add and \
|
||||
len(list(set(self.value) - set(self.current_value))) == 0:
|
||||
return False
|
||||
return False
|
||||
elif self.current_value == self.value:
|
||||
return False
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ def main():
|
|||
module.fail_json(msg="Not any of the command arguments %s given" % commands)
|
||||
|
||||
if(params['interface'] is not None and params['direction'] is None):
|
||||
module.fail_json(msg="Direction must be specified when creating a rule on an interface")
|
||||
module.fail_json(msg="Direction must be specified when creating a rule on an interface")
|
||||
|
||||
# Ensure ufw is available
|
||||
ufw_bin = module.get_bin_path('ufw', True)
|
||||
|
|
|
@ -1419,8 +1419,8 @@ class SunOS(User):
|
|||
cmd.append(','.join(new_groups))
|
||||
|
||||
if self.comment is not None and info[4] != self.comment:
|
||||
cmd.append('-c')
|
||||
cmd.append(self.comment)
|
||||
cmd.append('-c')
|
||||
cmd.append(self.comment)
|
||||
|
||||
if self.home is not None and info[5] != self.home:
|
||||
if self.move_home:
|
||||
|
@ -1563,7 +1563,7 @@ class DarwinUser(User):
|
|||
if max_uid < current_uid:
|
||||
max_uid = current_uid
|
||||
if max_system_uid < current_uid and current_uid < 500:
|
||||
max_system_uid = current_uid
|
||||
max_system_uid = current_uid
|
||||
|
||||
if system and (0 < max_system_uid < 499):
|
||||
return max_system_uid + 1
|
||||
|
@ -1923,8 +1923,8 @@ class AIX(User):
|
|||
cmd.append(','.join(groups))
|
||||
|
||||
if self.comment is not None and info[4] != self.comment:
|
||||
cmd.append('-c')
|
||||
cmd.append(self.comment)
|
||||
cmd.append('-c')
|
||||
cmd.append(self.comment)
|
||||
|
||||
if self.home is not None and info[5] != self.home:
|
||||
if self.move_home:
|
||||
|
|
|
@ -395,9 +395,9 @@ class PlayContext(Base):
|
|||
# become legacy updates -- from commandline
|
||||
if not new_info.become_pass:
|
||||
if new_info.become_method == 'sudo' and new_info.sudo_pass:
|
||||
setattr(new_info, 'become_pass', new_info.sudo_pass)
|
||||
setattr(new_info, 'become_pass', new_info.sudo_pass)
|
||||
elif new_info.become_method == 'su' and new_info.su_pass:
|
||||
setattr(new_info, 'become_pass', new_info.su_pass)
|
||||
setattr(new_info, 'become_pass', new_info.su_pass)
|
||||
|
||||
# become legacy updates -- from inventory file (inventory overrides
|
||||
# commandline)
|
||||
|
|
|
@ -127,7 +127,7 @@ class PlaybookInclude(Base, Conditional, Taggable):
|
|||
'''
|
||||
|
||||
if v is None:
|
||||
raise AnsibleParserError("include parameter is missing", obj=ds)
|
||||
raise AnsibleParserError("include parameter is missing", obj=ds)
|
||||
|
||||
# The include line must include at least one item, which is the filename
|
||||
# to include. Anything after that should be regarded as a parameter to the include
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue