mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-13 08:30:50 -07:00
remove unnecessary brackets in conditions (#10328)
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.16) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.16) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
* remove unnecessary brackets in conditions * add changelog frag
This commit is contained in:
parent
5a5b2d2eed
commit
682a89cdf5
32 changed files with 88 additions and 56 deletions
32
changelogs/fragments/10328-redundant-brackets.yml
Normal file
32
changelogs/fragments/10328-redundant-brackets.yml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
minor_changes:
|
||||||
|
- logstash callback plugin - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- keycloak module utils - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- python_runner module utils - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- cloudflare_dns - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- crypttab - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- datadog_monitor - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- gitlab_deploy_key - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- gitlab_group_access_token - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- gitlab_hook - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- gitlab_project_access_token - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- gitlab_runner - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- ipa_group - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- jenkins_build - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- jenkins_build_info - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- nmcli - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- oneandone_firewall_policy - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- oneandone_load_balancer - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- oneandone_monitoring_policy - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- onepassword_info - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- osx_defaults - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- ovh_ip_loadbalancing_backend - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- packet_device - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- pagerduty - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- pingdom - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- rhevm - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- rocketchat - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- sensu_silence - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- sl_vm - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- urpmi - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- xattr - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
||||||
|
- xml - remove redundant brackets in conditionals, no functional changes (https://github.com/ansible-collections/community.general/pull/10328).
|
|
@ -182,7 +182,7 @@ class CallbackModule(CallbackBase):
|
||||||
data['status'] = "OK"
|
data['status'] = "OK"
|
||||||
data['ansible_playbook'] = playbook._file_name
|
data['ansible_playbook'] = playbook._file_name
|
||||||
|
|
||||||
if (self.ls_format_version == "v2"):
|
if self.ls_format_version == "v2":
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"START PLAYBOOK | %s", data['ansible_playbook'], extra=data
|
"START PLAYBOOK | %s", data['ansible_playbook'], extra=data
|
||||||
)
|
)
|
||||||
|
@ -207,7 +207,7 @@ class CallbackModule(CallbackBase):
|
||||||
data['ansible_playbook_duration'] = runtime.total_seconds()
|
data['ansible_playbook_duration'] = runtime.total_seconds()
|
||||||
data['ansible_result'] = json.dumps(summarize_stat) # deprecated field
|
data['ansible_result'] = json.dumps(summarize_stat) # deprecated field
|
||||||
|
|
||||||
if (self.ls_format_version == "v2"):
|
if self.ls_format_version == "v2":
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"FINISH PLAYBOOK | %s", json.dumps(summarize_stat), extra=data
|
"FINISH PLAYBOOK | %s", json.dumps(summarize_stat), extra=data
|
||||||
)
|
)
|
||||||
|
@ -226,7 +226,7 @@ class CallbackModule(CallbackBase):
|
||||||
data['ansible_play_id'] = self.play_id
|
data['ansible_play_id'] = self.play_id
|
||||||
data['ansible_play_name'] = self.play_name
|
data['ansible_play_name'] = self.play_name
|
||||||
|
|
||||||
if (self.ls_format_version == "v2"):
|
if self.ls_format_version == "v2":
|
||||||
self.logger.info("START PLAY | %s", self.play_name, extra=data)
|
self.logger.info("START PLAY | %s", self.play_name, extra=data)
|
||||||
else:
|
else:
|
||||||
self.logger.info("ansible play", extra=data)
|
self.logger.info("ansible play", extra=data)
|
||||||
|
@ -251,7 +251,7 @@ class CallbackModule(CallbackBase):
|
||||||
data['ansible_task'] = task_name
|
data['ansible_task'] = task_name
|
||||||
data['ansible_facts'] = self._dump_results(result._result)
|
data['ansible_facts'] = self._dump_results(result._result)
|
||||||
|
|
||||||
if (self.ls_format_version == "v2"):
|
if self.ls_format_version == "v2":
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"SETUP FACTS | %s", self._dump_results(result._result), extra=data
|
"SETUP FACTS | %s", self._dump_results(result._result), extra=data
|
||||||
)
|
)
|
||||||
|
@ -272,7 +272,7 @@ class CallbackModule(CallbackBase):
|
||||||
data['ansible_task_id'] = self.task_id
|
data['ansible_task_id'] = self.task_id
|
||||||
data['ansible_result'] = self._dump_results(result._result)
|
data['ansible_result'] = self._dump_results(result._result)
|
||||||
|
|
||||||
if (self.ls_format_version == "v2"):
|
if self.ls_format_version == "v2":
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"TASK OK | %s | RESULT | %s",
|
"TASK OK | %s | RESULT | %s",
|
||||||
task_name, self._dump_results(result._result), extra=data
|
task_name, self._dump_results(result._result), extra=data
|
||||||
|
@ -293,7 +293,7 @@ class CallbackModule(CallbackBase):
|
||||||
data['ansible_task_id'] = self.task_id
|
data['ansible_task_id'] = self.task_id
|
||||||
data['ansible_result'] = self._dump_results(result._result)
|
data['ansible_result'] = self._dump_results(result._result)
|
||||||
|
|
||||||
if (self.ls_format_version == "v2"):
|
if self.ls_format_version == "v2":
|
||||||
self.logger.info("TASK SKIPPED | %s", task_name, extra=data)
|
self.logger.info("TASK SKIPPED | %s", task_name, extra=data)
|
||||||
else:
|
else:
|
||||||
self.logger.info("ansible skipped", extra=data)
|
self.logger.info("ansible skipped", extra=data)
|
||||||
|
@ -307,7 +307,7 @@ class CallbackModule(CallbackBase):
|
||||||
data['ansible_play_name'] = self.play_name
|
data['ansible_play_name'] = self.play_name
|
||||||
data['imported_file'] = imported_file
|
data['imported_file'] = imported_file
|
||||||
|
|
||||||
if (self.ls_format_version == "v2"):
|
if self.ls_format_version == "v2":
|
||||||
self.logger.info("IMPORT | %s", imported_file, extra=data)
|
self.logger.info("IMPORT | %s", imported_file, extra=data)
|
||||||
else:
|
else:
|
||||||
self.logger.info("ansible import", extra=data)
|
self.logger.info("ansible import", extra=data)
|
||||||
|
@ -321,7 +321,7 @@ class CallbackModule(CallbackBase):
|
||||||
data['ansible_play_name'] = self.play_name
|
data['ansible_play_name'] = self.play_name
|
||||||
data['imported_file'] = missing_file
|
data['imported_file'] = missing_file
|
||||||
|
|
||||||
if (self.ls_format_version == "v2"):
|
if self.ls_format_version == "v2":
|
||||||
self.logger.info("NOT IMPORTED | %s", missing_file, extra=data)
|
self.logger.info("NOT IMPORTED | %s", missing_file, extra=data)
|
||||||
else:
|
else:
|
||||||
self.logger.info("ansible import", extra=data)
|
self.logger.info("ansible import", extra=data)
|
||||||
|
@ -345,7 +345,7 @@ class CallbackModule(CallbackBase):
|
||||||
data['ansible_result'] = self._dump_results(result._result)
|
data['ansible_result'] = self._dump_results(result._result)
|
||||||
|
|
||||||
self.errors += 1
|
self.errors += 1
|
||||||
if (self.ls_format_version == "v2"):
|
if self.ls_format_version == "v2":
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
"TASK FAILED | %s | HOST | %s | RESULT | %s",
|
"TASK FAILED | %s | HOST | %s | RESULT | %s",
|
||||||
task_name, self.hostname,
|
task_name, self.hostname,
|
||||||
|
@ -368,7 +368,7 @@ class CallbackModule(CallbackBase):
|
||||||
data['ansible_result'] = self._dump_results(result._result)
|
data['ansible_result'] = self._dump_results(result._result)
|
||||||
|
|
||||||
self.errors += 1
|
self.errors += 1
|
||||||
if (self.ls_format_version == "v2"):
|
if self.ls_format_version == "v2":
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
"UNREACHABLE | %s | HOST | %s | RESULT | %s",
|
"UNREACHABLE | %s | HOST | %s | RESULT | %s",
|
||||||
task_name, self.hostname,
|
task_name, self.hostname,
|
||||||
|
@ -391,7 +391,7 @@ class CallbackModule(CallbackBase):
|
||||||
data['ansible_result'] = self._dump_results(result._result)
|
data['ansible_result'] = self._dump_results(result._result)
|
||||||
|
|
||||||
self.errors += 1
|
self.errors += 1
|
||||||
if (self.ls_format_version == "v2"):
|
if self.ls_format_version == "v2":
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
"ASYNC FAILED | %s | HOST | %s | RESULT | %s",
|
"ASYNC FAILED | %s | HOST | %s | RESULT | %s",
|
||||||
task_name, self.hostname,
|
task_name, self.hostname,
|
||||||
|
|
|
@ -1961,7 +1961,7 @@ class KeycloakAPI(object):
|
||||||
and composite["name"] == existing_composite["name"]):
|
and composite["name"] == existing_composite["name"]):
|
||||||
composite_found = True
|
composite_found = True
|
||||||
break
|
break
|
||||||
if (not composite_found and ('state' not in composite or composite['state'] == 'present')):
|
if not composite_found and ('state' not in composite or composite['state'] == 'present'):
|
||||||
if "client_id" in composite and composite['client_id'] is not None:
|
if "client_id" in composite and composite['client_id'] is not None:
|
||||||
client_roles = self.get_client_roles(clientid=composite['client_id'], realm=realm)
|
client_roles = self.get_client_roles(clientid=composite['client_id'], realm=realm)
|
||||||
for client_role in client_roles:
|
for client_role in client_roles:
|
||||||
|
|
|
@ -19,7 +19,7 @@ class PythonRunner(CmdRunner):
|
||||||
self.venv = venv
|
self.venv = venv
|
||||||
self.has_venv = venv is not None
|
self.has_venv = venv is not None
|
||||||
|
|
||||||
if (os.path.isabs(python) or '/' in python):
|
if os.path.isabs(python) or '/' in python:
|
||||||
self.python = python
|
self.python = python
|
||||||
elif self.has_venv:
|
elif self.has_venv:
|
||||||
if path_prefix is None:
|
if path_prefix is None:
|
||||||
|
|
|
@ -501,13 +501,13 @@ class CloudflareAPI(object):
|
||||||
if (self.type == 'AAAA') and (self.value is not None):
|
if (self.type == 'AAAA') and (self.value is not None):
|
||||||
self.value = self.value.lower()
|
self.value = self.value.lower()
|
||||||
|
|
||||||
if (self.type == 'SRV'):
|
if self.type == 'SRV':
|
||||||
if (self.proto is not None) and (not self.proto.startswith('_')):
|
if (self.proto is not None) and (not self.proto.startswith('_')):
|
||||||
self.proto = '_{0}'.format(self.proto)
|
self.proto = '_{0}'.format(self.proto)
|
||||||
if (self.service is not None) and (not self.service.startswith('_')):
|
if (self.service is not None) and (not self.service.startswith('_')):
|
||||||
self.service = '_{0}'.format(self.service)
|
self.service = '_{0}'.format(self.service)
|
||||||
|
|
||||||
if (self.type == 'TLSA'):
|
if self.type == 'TLSA':
|
||||||
if (self.proto is not None) and (not self.proto.startswith('_')):
|
if (self.proto is not None) and (not self.proto.startswith('_')):
|
||||||
self.proto = '_{0}'.format(self.proto)
|
self.proto = '_{0}'.format(self.proto)
|
||||||
if (self.port is not None):
|
if (self.port is not None):
|
||||||
|
@ -516,7 +516,7 @@ class CloudflareAPI(object):
|
||||||
if not self.record.endswith(self.zone):
|
if not self.record.endswith(self.zone):
|
||||||
self.record = join_str('.', self.record, self.zone)
|
self.record = join_str('.', self.record, self.zone)
|
||||||
|
|
||||||
if (self.type == 'DS'):
|
if self.type == 'DS':
|
||||||
if self.record == self.zone:
|
if self.record == self.zone:
|
||||||
self.module.fail_json(msg="DS records only apply to subdomains.")
|
self.module.fail_json(msg="DS records only apply to subdomains.")
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ class CloudflareAPI(object):
|
||||||
search_record = self.record
|
search_record = self.record
|
||||||
new_record = None
|
new_record = None
|
||||||
|
|
||||||
if (self.type in ['A', 'AAAA', 'CNAME', 'TXT', 'MX', 'NS', 'PTR']):
|
if self.type in ['A', 'AAAA', 'CNAME', 'TXT', 'MX', 'NS', 'PTR']:
|
||||||
if not self.value:
|
if not self.value:
|
||||||
self.module.fail_json(msg="You must provide a non-empty value to create this record type")
|
self.module.fail_json(msg="You must provide a non-empty value to create this record type")
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ class CloudflareAPI(object):
|
||||||
"ttl": self.ttl
|
"ttl": self.ttl
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.type in ['A', 'AAAA', 'CNAME']):
|
if self.type in ['A', 'AAAA', 'CNAME']:
|
||||||
new_record["proxied"] = self.proxied
|
new_record["proxied"] = self.proxied
|
||||||
|
|
||||||
if self.type == 'MX':
|
if self.type == 'MX':
|
||||||
|
@ -873,7 +873,7 @@ class CloudflareAPI(object):
|
||||||
if ('proxied' in new_record) and ('proxied' in cur_record) and (cur_record['proxied'] != self.proxied):
|
if ('proxied' in new_record) and ('proxied' in cur_record) and (cur_record['proxied'] != self.proxied):
|
||||||
do_update = True
|
do_update = True
|
||||||
if ('data' in new_record) and ('data' in cur_record):
|
if ('data' in new_record) and ('data' in cur_record):
|
||||||
if (cur_record['data'] != new_record['data']):
|
if cur_record['data'] != new_record['data']:
|
||||||
do_update = True
|
do_update = True
|
||||||
if (self.type == 'CNAME') and (cur_record['content'] != new_record['content']):
|
if (self.type == 'CNAME') and (cur_record['content'] != new_record['content']):
|
||||||
do_update = True
|
do_update = True
|
||||||
|
|
|
@ -116,7 +116,7 @@ def main():
|
||||||
('backing_device', backing_device),
|
('backing_device', backing_device),
|
||||||
('password', password),
|
('password', password),
|
||||||
('opts', opts)):
|
('opts', opts)):
|
||||||
if (arg is not None and (' ' in arg or '\t' in arg or arg == '')):
|
if arg is not None and (' ' in arg or '\t' in arg or arg == ''):
|
||||||
module.fail_json(msg="invalid '%s': contains white space or is empty" % arg_name,
|
module.fail_json(msg="invalid '%s': contains white space or is empty" % arg_name,
|
||||||
**module.params)
|
**module.params)
|
||||||
|
|
||||||
|
|
|
@ -435,7 +435,7 @@ def mute_monitor(module):
|
||||||
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']:
|
elif monitor['options']['silenced']:
|
||||||
module.fail_json(msg="Monitor is already muted. Datadog does not allow to modify muted alerts, consider unmuting it first.")
|
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 and len(set(monitor['options']['silenced']) ^ set(module.params['silenced'])) == 0):
|
elif module.params['silenced'] is not None and len(set(monitor['options']['silenced']) ^ set(module.params['silenced'])) == 0:
|
||||||
module.exit_json(changed=False)
|
module.exit_json(changed=False)
|
||||||
try:
|
try:
|
||||||
if module.params['silenced'] is None or module.params['silenced'] == "":
|
if module.params['silenced'] is None or module.params['silenced'] == "":
|
||||||
|
|
|
@ -208,7 +208,7 @@ class GitLabDeployKey(object):
|
||||||
'''
|
'''
|
||||||
def find_deploy_key(self, project, key_title):
|
def find_deploy_key(self, project, key_title):
|
||||||
for deploy_key in project.keys.list(**list_all_kwargs):
|
for deploy_key in project.keys.list(**list_all_kwargs):
|
||||||
if (deploy_key.title == key_title):
|
if deploy_key.title == key_title:
|
||||||
return deploy_key
|
return deploy_key
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -195,7 +195,7 @@ class GitLabGroupAccessToken(object):
|
||||||
def find_access_token(self, group, name):
|
def find_access_token(self, group, name):
|
||||||
access_tokens = [x for x in group.access_tokens.list(all=True) if not getattr(x, 'revoked', False)]
|
access_tokens = [x for x in group.access_tokens.list(all=True) if not getattr(x, 'revoked', False)]
|
||||||
for access_token in access_tokens:
|
for access_token in access_tokens:
|
||||||
if (access_token.name == name):
|
if access_token.name == name:
|
||||||
self.access_token_object = access_token
|
self.access_token_object = access_token
|
||||||
return False
|
return False
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -271,7 +271,7 @@ class GitLabHook(object):
|
||||||
'''
|
'''
|
||||||
def find_hook(self, project, hook_url):
|
def find_hook(self, project, hook_url):
|
||||||
for hook in project.hooks.list(**list_all_kwargs):
|
for hook in project.hooks.list(**list_all_kwargs):
|
||||||
if (hook.url == hook_url):
|
if hook.url == hook_url:
|
||||||
return hook
|
return hook
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -193,7 +193,7 @@ class GitLabProjectAccessToken(object):
|
||||||
def find_access_token(self, project, name):
|
def find_access_token(self, project, name):
|
||||||
access_tokens = [x for x in project.access_tokens.list(all=True) if not getattr(x, 'revoked', False)]
|
access_tokens = [x for x in project.access_tokens.list(all=True) if not getattr(x, 'revoked', False)]
|
||||||
for access_token in access_tokens:
|
for access_token in access_tokens:
|
||||||
if (access_token.name == name):
|
if access_token.name == name:
|
||||||
self.access_token_object = access_token
|
self.access_token_object = access_token
|
||||||
return False
|
return False
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -393,10 +393,10 @@ class GitLabRunner(object):
|
||||||
# python-gitlab 2.2 through at least 2.5 returns a list of dicts for list() instead of a Runner
|
# python-gitlab 2.2 through at least 2.5 returns a list of dicts for list() instead of a Runner
|
||||||
# object, so we need to handle both
|
# object, so we need to handle both
|
||||||
if hasattr(runner, "description"):
|
if hasattr(runner, "description"):
|
||||||
if (runner.description == description):
|
if runner.description == description:
|
||||||
return self._gitlab.runners.get(runner.id)
|
return self._gitlab.runners.get(runner.id)
|
||||||
else:
|
else:
|
||||||
if (runner['description'] == description):
|
if runner['description'] == description:
|
||||||
return self._gitlab.runners.get(runner['id'])
|
return self._gitlab.runners.get(runner['id'])
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -261,7 +261,7 @@ def ensure(module, client):
|
||||||
nonposix=module.params['nonposix'])
|
nonposix=module.params['nonposix'])
|
||||||
ipa_group = client.group_find(name=name)
|
ipa_group = client.group_find(name=name)
|
||||||
|
|
||||||
if (not (external or external_user is None)):
|
if not (external or external_user is None):
|
||||||
module.fail_json("external_user can only be set if external = True")
|
module.fail_json("external_user can only be set if external = True")
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
|
|
|
@ -180,11 +180,11 @@ class JenkinsBuild:
|
||||||
|
|
||||||
def get_jenkins_connection(self):
|
def get_jenkins_connection(self):
|
||||||
try:
|
try:
|
||||||
if (self.user and self.password):
|
if self.user and self.password:
|
||||||
return jenkins.Jenkins(self.jenkins_url, self.user, self.password)
|
return jenkins.Jenkins(self.jenkins_url, self.user, self.password)
|
||||||
elif (self.user and self.token):
|
elif self.user and self.token:
|
||||||
return jenkins.Jenkins(self.jenkins_url, self.user, self.token)
|
return jenkins.Jenkins(self.jenkins_url, self.user, self.token)
|
||||||
elif (self.user and not (self.password or self.token)):
|
elif self.user and not (self.password or self.token):
|
||||||
return jenkins.Jenkins(self.jenkins_url, self.user)
|
return jenkins.Jenkins(self.jenkins_url, self.user)
|
||||||
else:
|
else:
|
||||||
return jenkins.Jenkins(self.jenkins_url)
|
return jenkins.Jenkins(self.jenkins_url)
|
||||||
|
|
|
@ -138,11 +138,11 @@ class JenkinsBuildInfo:
|
||||||
|
|
||||||
def get_jenkins_connection(self):
|
def get_jenkins_connection(self):
|
||||||
try:
|
try:
|
||||||
if (self.user and self.password):
|
if self.user and self.password:
|
||||||
return jenkins.Jenkins(self.jenkins_url, self.user, self.password)
|
return jenkins.Jenkins(self.jenkins_url, self.user, self.password)
|
||||||
elif (self.user and self.token):
|
elif self.user and self.token:
|
||||||
return jenkins.Jenkins(self.jenkins_url, self.user, self.token)
|
return jenkins.Jenkins(self.jenkins_url, self.user, self.token)
|
||||||
elif (self.user and not (self.password or self.token)):
|
elif self.user and not (self.password or self.token):
|
||||||
return jenkins.Jenkins(self.jenkins_url, self.user)
|
return jenkins.Jenkins(self.jenkins_url, self.user)
|
||||||
else:
|
else:
|
||||||
return jenkins.Jenkins(self.jenkins_url)
|
return jenkins.Jenkins(self.jenkins_url)
|
||||||
|
|
|
@ -2484,7 +2484,7 @@ class Nmcli(object):
|
||||||
|
|
||||||
for line in out.splitlines():
|
for line in out.splitlines():
|
||||||
prefix = '%s.' % setting
|
prefix = '%s.' % setting
|
||||||
if (line.startswith(prefix)):
|
if line.startswith(prefix):
|
||||||
pair = line.split(':', 1)
|
pair = line.split(':', 1)
|
||||||
property = pair[0].strip().replace(prefix, '')
|
property = pair[0].strip().replace(prefix, '')
|
||||||
properties.append(property)
|
properties.append(property)
|
||||||
|
|
|
@ -288,7 +288,7 @@ def _add_firewall_rules(module, oneandone_conn, firewall_id, rules):
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
firewall_policy_id = get_firewall_policy(oneandone_conn, firewall_id)
|
firewall_policy_id = get_firewall_policy(oneandone_conn, firewall_id)
|
||||||
if (firewall_rules and firewall_policy_id):
|
if firewall_rules and firewall_policy_id:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,7 @@ def _add_load_balancer_rules(module, oneandone_conn, load_balancer_id, rules):
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
lb_id = get_load_balancer(oneandone_conn, load_balancer_id)
|
lb_id = get_load_balancer(oneandone_conn, load_balancer_id)
|
||||||
if (load_balancer_rules and lb_id):
|
if load_balancer_rules and lb_id:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -537,7 +537,7 @@ def _add_processes(module, oneandone_conn, monitoring_policy_id, processes):
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
mp_id = get_monitoring_policy(oneandone_conn, monitoring_policy_id)
|
mp_id = get_monitoring_policy(oneandone_conn, monitoring_policy_id)
|
||||||
if (monitoring_policy_processes and mp_id):
|
if monitoring_policy_processes and mp_id:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ class OnePasswordInfo(object):
|
||||||
def _parse_field(self, data_json, item_id, field_name, section_title=None):
|
def _parse_field(self, data_json, item_id, field_name, section_title=None):
|
||||||
data = json.loads(data_json)
|
data = json.loads(data_json)
|
||||||
|
|
||||||
if ('documentAttributes' in data['details']):
|
if 'documentAttributes' in data['details']:
|
||||||
# This is actually a document, let's fetch the document data instead!
|
# This is actually a document, let's fetch the document data instead!
|
||||||
document = self._run(["get", "document", data['overview']['title']])
|
document = self._run(["get", "document", data['overview']['title']])
|
||||||
return {'document': document[1].strip()}
|
return {'document': document[1].strip()}
|
||||||
|
@ -219,7 +219,7 @@ class OnePasswordInfo(object):
|
||||||
|
|
||||||
# Some types of 1Password items have a 'password' field directly alongside the 'fields' attribute,
|
# Some types of 1Password items have a 'password' field directly alongside the 'fields' attribute,
|
||||||
# not inside it, so we need to check there first.
|
# not inside it, so we need to check there first.
|
||||||
if (field_name in data['details']):
|
if field_name in data['details']:
|
||||||
return {field_name: data['details'][field_name]}
|
return {field_name: data['details'][field_name]}
|
||||||
|
|
||||||
# Otherwise we continue looking inside the 'fields' attribute for the specified field.
|
# Otherwise we continue looking inside the 'fields' attribute for the specified field.
|
||||||
|
|
|
@ -191,7 +191,7 @@ class OSXDefaults(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_int(value):
|
def is_int(value):
|
||||||
as_str = str(value)
|
as_str = str(value)
|
||||||
if (as_str.startswith("-")):
|
if as_str.startswith("-"):
|
||||||
return as_str[1:].isdigit()
|
return as_str[1:].isdigit()
|
||||||
else:
|
else:
|
||||||
return as_str.isdigit()
|
return as_str.isdigit()
|
||||||
|
|
|
@ -244,7 +244,7 @@ def main():
|
||||||
'parameters. Error returned by OVH api was : {0}'
|
'parameters. Error returned by OVH api was : {0}'
|
||||||
.format(apiError))
|
.format(apiError))
|
||||||
|
|
||||||
if (backendProperties['weight'] != weight):
|
if backendProperties['weight'] != weight:
|
||||||
# Change weight
|
# Change weight
|
||||||
try:
|
try:
|
||||||
client.post(
|
client.post(
|
||||||
|
@ -263,7 +263,7 @@ def main():
|
||||||
.format(apiError))
|
.format(apiError))
|
||||||
moduleChanged = True
|
moduleChanged = True
|
||||||
|
|
||||||
if (backendProperties['probe'] != probe):
|
if backendProperties['probe'] != probe:
|
||||||
# Change probe
|
# Change probe
|
||||||
backendProperties['probe'] = probe
|
backendProperties['probe'] = probe
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -420,12 +420,12 @@ def get_hostname_list(module):
|
||||||
# at this point, hostnames is a list
|
# at this point, hostnames is a list
|
||||||
hostnames = [h.strip() for h in hostnames]
|
hostnames = [h.strip() for h in hostnames]
|
||||||
|
|
||||||
if (len(hostnames) > 1) and (count > 1):
|
if len(hostnames) > 1 and count > 1:
|
||||||
_msg = ("If you set count>1, you should only specify one hostname "
|
_msg = ("If you set count>1, you should only specify one hostname "
|
||||||
"with the %d formatter, not a list of hostnames.")
|
"with the %d formatter, not a list of hostnames.")
|
||||||
raise Exception(_msg)
|
raise Exception(_msg)
|
||||||
|
|
||||||
if (len(hostnames) == 1) and (count > 0):
|
if len(hostnames) == 1 and count > 0:
|
||||||
hostname_spec = hostnames[0]
|
hostname_spec = hostnames[0]
|
||||||
count_range = range(count_offset, count_offset + count)
|
count_range = range(count_offset, count_offset + count)
|
||||||
if re.search(r"%\d{0,2}d", hostname_spec):
|
if re.search(r"%\d{0,2}d", hostname_spec):
|
||||||
|
|
|
@ -203,7 +203,7 @@ class PagerDutyRequest(object):
|
||||||
return False, json_out, True
|
return False, json_out, True
|
||||||
|
|
||||||
def _create_services_payload(self, service):
|
def _create_services_payload(self, service):
|
||||||
if (isinstance(service, list)):
|
if isinstance(service, list):
|
||||||
return [{'id': s, 'type': 'service_reference'} for s in service]
|
return [{'id': s, 'type': 'service_reference'} for s in service]
|
||||||
else:
|
else:
|
||||||
return [{'id': service, 'type': 'service_reference'}]
|
return [{'id': service, 'type': 'service_reference'}]
|
||||||
|
|
|
@ -132,10 +132,10 @@ def main():
|
||||||
passwd = module.params['passwd']
|
passwd = module.params['passwd']
|
||||||
key = module.params['key']
|
key = module.params['key']
|
||||||
|
|
||||||
if (state == "paused" or state == "stopped"):
|
if state == "paused" or state == "stopped":
|
||||||
(rc, name, result) = pause(checkid, uid, passwd, key)
|
(rc, name, result) = pause(checkid, uid, passwd, key)
|
||||||
|
|
||||||
if (state == "running" or state == "started"):
|
if state == "running" or state == "started":
|
||||||
(rc, name, result) = unpause(checkid, uid, passwd, key)
|
(rc, name, result) = unpause(checkid, uid, passwd, key)
|
||||||
|
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
|
|
|
@ -812,7 +812,7 @@ class RHEVConn(object):
|
||||||
setChanged()
|
setChanged()
|
||||||
HOST = self.get_Host(host_name)
|
HOST = self.get_Host(host_name)
|
||||||
state = HOST.status.state
|
state = HOST.status.state
|
||||||
while (state != 'non_operational' and state != 'up'):
|
while state != 'non_operational' and state != 'up':
|
||||||
HOST = self.get_Host(host_name)
|
HOST = self.get_Host(host_name)
|
||||||
state = HOST.status.state
|
state = HOST.status.state
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
|
@ -181,7 +181,7 @@ def build_payload_for_rocketchat(module, text, channel, username, icon_url, icon
|
||||||
elif text is not None:
|
elif text is not None:
|
||||||
payload = dict(attachments=[dict(text=text, color=color)])
|
payload = dict(attachments=[dict(text=text, color=color)])
|
||||||
if channel is not None:
|
if channel is not None:
|
||||||
if (channel[0] == '#') or (channel[0] == '@'):
|
if channel[0] == '#' or channel[0] == '@':
|
||||||
payload['channel'] = channel
|
payload['channel'] = channel
|
||||||
else:
|
else:
|
||||||
payload['channel'] = '#' + channel
|
payload['channel'] = '#' + channel
|
||||||
|
|
|
@ -202,7 +202,7 @@ def create(
|
||||||
expire_on_resolve, reason, subscription):
|
expire_on_resolve, reason, subscription):
|
||||||
(rc, out, changed) = query(module, url, check, subscription)
|
(rc, out, changed) = query(module, url, check, subscription)
|
||||||
for i in out:
|
for i in out:
|
||||||
if (i['subscription'] == subscription):
|
if i['subscription'] == subscription:
|
||||||
if (
|
if (
|
||||||
(check is None or check == i['check']) and
|
(check is None or check == i['check']) and
|
||||||
(
|
(
|
||||||
|
|
|
@ -319,9 +319,9 @@ def create_virtual_instance(module):
|
||||||
return False, None
|
return False, None
|
||||||
|
|
||||||
# Check if OS or Image Template is provided (Can't be both, defaults to OS)
|
# Check if OS or Image Template is provided (Can't be both, defaults to OS)
|
||||||
if (module.params.get('os_code') is not 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'] = ''
|
module.params['image_id'] = ''
|
||||||
elif (module.params.get('image_id') is not 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['os_code'] = ''
|
||||||
module.params['disks'] = [] # Blank out disks since it will use the template
|
module.params['disks'] = [] # Blank out disks since it will use the template
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -184,7 +184,7 @@ def install_packages(module, pkgspec, root, force=True, no_recommends=True):
|
||||||
|
|
||||||
|
|
||||||
def root_option(root):
|
def root_option(root):
|
||||||
if (root):
|
if root:
|
||||||
return "--root=%s" % (root)
|
return "--root=%s" % (root)
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
|
|
@ -209,7 +209,7 @@ def main():
|
||||||
not (namespace == 'user' and key.startswith('user.'))):
|
not (namespace == 'user' and key.startswith('user.'))):
|
||||||
key = '%s.%s' % (namespace, key)
|
key = '%s.%s' % (namespace, key)
|
||||||
|
|
||||||
if (state == 'present' or value is not None):
|
if state == 'present' or value is not None:
|
||||||
current = get_xattr(module, path, key, follow)
|
current = get_xattr(module, path, key, follow)
|
||||||
if current is None or key not in current or value != current[key]:
|
if current is None or key not in current or value != current[key]:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
|
|
|
@ -635,7 +635,7 @@ def check_or_make_target(module, tree, xpath, namespaces):
|
||||||
# module.fail_json(msg="now tree=%s" % etree.tostring(tree, pretty_print=True))
|
# module.fail_json(msg="now tree=%s" % etree.tostring(tree, pretty_print=True))
|
||||||
elif eoa == "":
|
elif eoa == "":
|
||||||
for node in tree.xpath(inner_xpath, namespaces=namespaces):
|
for node in tree.xpath(inner_xpath, namespaces=namespaces):
|
||||||
if (node.text != eoa_value):
|
if node.text != eoa_value:
|
||||||
node.text = eoa_value
|
node.text = eoa_value
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue