diff --git a/changelogs/fragments/10328-redundant-brackets.yml b/changelogs/fragments/10328-redundant-brackets.yml new file mode 100644 index 0000000000..f8f74a336c --- /dev/null +++ b/changelogs/fragments/10328-redundant-brackets.yml @@ -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). diff --git a/plugins/callback/logstash.py b/plugins/callback/logstash.py index 7025338bf5..22fd45e08a 100644 --- a/plugins/callback/logstash.py +++ b/plugins/callback/logstash.py @@ -182,7 +182,7 @@ class CallbackModule(CallbackBase): data['status'] = "OK" data['ansible_playbook'] = playbook._file_name - if (self.ls_format_version == "v2"): + if self.ls_format_version == "v2": self.logger.info( "START PLAYBOOK | %s", data['ansible_playbook'], extra=data ) @@ -207,7 +207,7 @@ class CallbackModule(CallbackBase): data['ansible_playbook_duration'] = runtime.total_seconds() data['ansible_result'] = json.dumps(summarize_stat) # deprecated field - if (self.ls_format_version == "v2"): + if self.ls_format_version == "v2": self.logger.info( "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_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) else: self.logger.info("ansible play", extra=data) @@ -251,7 +251,7 @@ class CallbackModule(CallbackBase): data['ansible_task'] = task_name data['ansible_facts'] = self._dump_results(result._result) - if (self.ls_format_version == "v2"): + if self.ls_format_version == "v2": self.logger.info( "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_result'] = self._dump_results(result._result) - if (self.ls_format_version == "v2"): + if self.ls_format_version == "v2": self.logger.info( "TASK OK | %s | RESULT | %s", 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_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) else: self.logger.info("ansible skipped", extra=data) @@ -307,7 +307,7 @@ class CallbackModule(CallbackBase): data['ansible_play_name'] = self.play_name 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) else: self.logger.info("ansible import", extra=data) @@ -321,7 +321,7 @@ class CallbackModule(CallbackBase): data['ansible_play_name'] = self.play_name 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) else: self.logger.info("ansible import", extra=data) @@ -345,7 +345,7 @@ class CallbackModule(CallbackBase): data['ansible_result'] = self._dump_results(result._result) self.errors += 1 - if (self.ls_format_version == "v2"): + if self.ls_format_version == "v2": self.logger.error( "TASK FAILED | %s | HOST | %s | RESULT | %s", task_name, self.hostname, @@ -368,7 +368,7 @@ class CallbackModule(CallbackBase): data['ansible_result'] = self._dump_results(result._result) self.errors += 1 - if (self.ls_format_version == "v2"): + if self.ls_format_version == "v2": self.logger.error( "UNREACHABLE | %s | HOST | %s | RESULT | %s", task_name, self.hostname, @@ -391,7 +391,7 @@ class CallbackModule(CallbackBase): data['ansible_result'] = self._dump_results(result._result) self.errors += 1 - if (self.ls_format_version == "v2"): + if self.ls_format_version == "v2": self.logger.error( "ASYNC FAILED | %s | HOST | %s | RESULT | %s", task_name, self.hostname, diff --git a/plugins/module_utils/identity/keycloak/keycloak.py b/plugins/module_utils/identity/keycloak/keycloak.py index 40fd249b5c..e053eca305 100644 --- a/plugins/module_utils/identity/keycloak/keycloak.py +++ b/plugins/module_utils/identity/keycloak/keycloak.py @@ -1961,7 +1961,7 @@ class KeycloakAPI(object): and composite["name"] == existing_composite["name"]): composite_found = True 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: client_roles = self.get_client_roles(clientid=composite['client_id'], realm=realm) for client_role in client_roles: diff --git a/plugins/module_utils/python_runner.py b/plugins/module_utils/python_runner.py index b65867c61e..a8e9e651be 100644 --- a/plugins/module_utils/python_runner.py +++ b/plugins/module_utils/python_runner.py @@ -19,7 +19,7 @@ class PythonRunner(CmdRunner): self.venv = venv 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 elif self.has_venv: if path_prefix is None: diff --git a/plugins/modules/cloudflare_dns.py b/plugins/modules/cloudflare_dns.py index 973145bc6f..fa7c923689 100644 --- a/plugins/modules/cloudflare_dns.py +++ b/plugins/modules/cloudflare_dns.py @@ -501,13 +501,13 @@ class CloudflareAPI(object): if (self.type == 'AAAA') and (self.value is not None): self.value = self.value.lower() - if (self.type == 'SRV'): + if self.type == 'SRV': if (self.proto is not None) and (not self.proto.startswith('_')): self.proto = '_{0}'.format(self.proto) if (self.service is not None) and (not self.service.startswith('_')): 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('_')): self.proto = '_{0}'.format(self.proto) if (self.port is not None): @@ -516,7 +516,7 @@ class CloudflareAPI(object): if not self.record.endswith(self.zone): self.record = join_str('.', self.record, self.zone) - if (self.type == 'DS'): + if self.type == 'DS': if self.record == self.zone: self.module.fail_json(msg="DS records only apply to subdomains.") @@ -722,7 +722,7 @@ class CloudflareAPI(object): search_record = self.record 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: 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 } - if (self.type in ['A', 'AAAA', 'CNAME']): + if self.type in ['A', 'AAAA', 'CNAME']: new_record["proxied"] = self.proxied 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): do_update = True 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 if (self.type == 'CNAME') and (cur_record['content'] != new_record['content']): do_update = True diff --git a/plugins/modules/crypttab.py b/plugins/modules/crypttab.py index 05a5afb082..1e9c3db880 100644 --- a/plugins/modules/crypttab.py +++ b/plugins/modules/crypttab.py @@ -116,7 +116,7 @@ def main(): ('backing_device', backing_device), ('password', password), ('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.params) diff --git a/plugins/modules/datadog_monitor.py b/plugins/modules/datadog_monitor.py index eec0db0d32..36139ea067 100644 --- a/plugins/modules/datadog_monitor.py +++ b/plugins/modules/datadog_monitor.py @@ -435,7 +435,7 @@ def mute_monitor(module): 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 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) try: if module.params['silenced'] is None or module.params['silenced'] == "": diff --git a/plugins/modules/gitlab_deploy_key.py b/plugins/modules/gitlab_deploy_key.py index f5ae130324..1214ce87e7 100644 --- a/plugins/modules/gitlab_deploy_key.py +++ b/plugins/modules/gitlab_deploy_key.py @@ -208,7 +208,7 @@ class GitLabDeployKey(object): ''' def find_deploy_key(self, project, key_title): 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 ''' diff --git a/plugins/modules/gitlab_group_access_token.py b/plugins/modules/gitlab_group_access_token.py index 3da3e42114..e31369fbfd 100644 --- a/plugins/modules/gitlab_group_access_token.py +++ b/plugins/modules/gitlab_group_access_token.py @@ -195,7 +195,7 @@ class GitLabGroupAccessToken(object): 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)] for access_token in access_tokens: - if (access_token.name == name): + if access_token.name == name: self.access_token_object = access_token return False return False diff --git a/plugins/modules/gitlab_hook.py b/plugins/modules/gitlab_hook.py index cb132c8aaa..5db0b9f8b1 100644 --- a/plugins/modules/gitlab_hook.py +++ b/plugins/modules/gitlab_hook.py @@ -271,7 +271,7 @@ class GitLabHook(object): ''' def find_hook(self, project, hook_url): for hook in project.hooks.list(**list_all_kwargs): - if (hook.url == hook_url): + if hook.url == hook_url: return hook ''' diff --git a/plugins/modules/gitlab_project_access_token.py b/plugins/modules/gitlab_project_access_token.py index 07d3985633..9714655b39 100644 --- a/plugins/modules/gitlab_project_access_token.py +++ b/plugins/modules/gitlab_project_access_token.py @@ -193,7 +193,7 @@ class GitLabProjectAccessToken(object): 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)] for access_token in access_tokens: - if (access_token.name == name): + if access_token.name == name: self.access_token_object = access_token return False return False diff --git a/plugins/modules/gitlab_runner.py b/plugins/modules/gitlab_runner.py index 62875c552a..e0be13f494 100644 --- a/plugins/modules/gitlab_runner.py +++ b/plugins/modules/gitlab_runner.py @@ -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 # object, so we need to handle both if hasattr(runner, "description"): - if (runner.description == description): + if runner.description == description: return self._gitlab.runners.get(runner.id) else: - if (runner['description'] == description): + if runner['description'] == description: return self._gitlab.runners.get(runner['id']) ''' diff --git a/plugins/modules/ipa_group.py b/plugins/modules/ipa_group.py index 60077a2c6a..47b5b3b2a9 100644 --- a/plugins/modules/ipa_group.py +++ b/plugins/modules/ipa_group.py @@ -261,7 +261,7 @@ def ensure(module, client): nonposix=module.params['nonposix']) 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") changed = False diff --git a/plugins/modules/jenkins_build.py b/plugins/modules/jenkins_build.py index cec8fcc490..83c2ee6e15 100644 --- a/plugins/modules/jenkins_build.py +++ b/plugins/modules/jenkins_build.py @@ -180,11 +180,11 @@ class JenkinsBuild: def get_jenkins_connection(self): try: - if (self.user and self.password): + if self.user and 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) - 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) else: return jenkins.Jenkins(self.jenkins_url) diff --git a/plugins/modules/jenkins_build_info.py b/plugins/modules/jenkins_build_info.py index f252eb504a..7d08ec91ce 100644 --- a/plugins/modules/jenkins_build_info.py +++ b/plugins/modules/jenkins_build_info.py @@ -138,11 +138,11 @@ class JenkinsBuildInfo: def get_jenkins_connection(self): try: - if (self.user and self.password): + if self.user and 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) - 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) else: return jenkins.Jenkins(self.jenkins_url) diff --git a/plugins/modules/nmcli.py b/plugins/modules/nmcli.py index 0af9f64ee9..d2608fab8d 100644 --- a/plugins/modules/nmcli.py +++ b/plugins/modules/nmcli.py @@ -2484,7 +2484,7 @@ class Nmcli(object): for line in out.splitlines(): prefix = '%s.' % setting - if (line.startswith(prefix)): + if line.startswith(prefix): pair = line.split(':', 1) property = pair[0].strip().replace(prefix, '') properties.append(property) diff --git a/plugins/modules/oneandone_firewall_policy.py b/plugins/modules/oneandone_firewall_policy.py index d0b5319aad..f949767ef3 100644 --- a/plugins/modules/oneandone_firewall_policy.py +++ b/plugins/modules/oneandone_firewall_policy.py @@ -288,7 +288,7 @@ def _add_firewall_rules(module, oneandone_conn, firewall_id, rules): if module.check_mode: 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 False diff --git a/plugins/modules/oneandone_load_balancer.py b/plugins/modules/oneandone_load_balancer.py index 2d19a98adf..5cd5da79d4 100644 --- a/plugins/modules/oneandone_load_balancer.py +++ b/plugins/modules/oneandone_load_balancer.py @@ -344,7 +344,7 @@ def _add_load_balancer_rules(module, oneandone_conn, load_balancer_id, rules): if module.check_mode: 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 False diff --git a/plugins/modules/oneandone_monitoring_policy.py b/plugins/modules/oneandone_monitoring_policy.py index a0aa17611e..627e693e5a 100644 --- a/plugins/modules/oneandone_monitoring_policy.py +++ b/plugins/modules/oneandone_monitoring_policy.py @@ -537,7 +537,7 @@ def _add_processes(module, oneandone_conn, monitoring_policy_id, processes): if module.check_mode: 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 False diff --git a/plugins/modules/onepassword_info.py b/plugins/modules/onepassword_info.py index 00fa847c07..77daf481bf 100644 --- a/plugins/modules/onepassword_info.py +++ b/plugins/modules/onepassword_info.py @@ -209,7 +209,7 @@ class OnePasswordInfo(object): def _parse_field(self, data_json, item_id, field_name, section_title=None): 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! document = self._run(["get", "document", data['overview']['title']]) 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, # 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]} # Otherwise we continue looking inside the 'fields' attribute for the specified field. diff --git a/plugins/modules/osx_defaults.py b/plugins/modules/osx_defaults.py index 75bd03b4ad..bc8a7afd5e 100644 --- a/plugins/modules/osx_defaults.py +++ b/plugins/modules/osx_defaults.py @@ -191,7 +191,7 @@ class OSXDefaults(object): @staticmethod def is_int(value): as_str = str(value) - if (as_str.startswith("-")): + if as_str.startswith("-"): return as_str[1:].isdigit() else: return as_str.isdigit() diff --git a/plugins/modules/ovh_ip_loadbalancing_backend.py b/plugins/modules/ovh_ip_loadbalancing_backend.py index cefb9231bd..8bf294a1d5 100644 --- a/plugins/modules/ovh_ip_loadbalancing_backend.py +++ b/plugins/modules/ovh_ip_loadbalancing_backend.py @@ -244,7 +244,7 @@ def main(): 'parameters. Error returned by OVH api was : {0}' .format(apiError)) - if (backendProperties['weight'] != weight): + if backendProperties['weight'] != weight: # Change weight try: client.post( @@ -263,7 +263,7 @@ def main(): .format(apiError)) moduleChanged = True - if (backendProperties['probe'] != probe): + if backendProperties['probe'] != probe: # Change probe backendProperties['probe'] = probe try: diff --git a/plugins/modules/packet_device.py b/plugins/modules/packet_device.py index 39f3e71e83..da04f52f6f 100644 --- a/plugins/modules/packet_device.py +++ b/plugins/modules/packet_device.py @@ -420,12 +420,12 @@ def get_hostname_list(module): # at this point, hostnames is a list 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 " "with the %d formatter, not a list of hostnames.") raise Exception(_msg) - if (len(hostnames) == 1) and (count > 0): + if len(hostnames) == 1 and count > 0: hostname_spec = hostnames[0] count_range = range(count_offset, count_offset + count) if re.search(r"%\d{0,2}d", hostname_spec): diff --git a/plugins/modules/pagerduty.py b/plugins/modules/pagerduty.py index 0c14688dbd..5de20a5270 100644 --- a/plugins/modules/pagerduty.py +++ b/plugins/modules/pagerduty.py @@ -203,7 +203,7 @@ class PagerDutyRequest(object): return False, json_out, True def _create_services_payload(self, service): - if (isinstance(service, list)): + if isinstance(service, list): return [{'id': s, 'type': 'service_reference'} for s in service] else: return [{'id': service, 'type': 'service_reference'}] diff --git a/plugins/modules/pingdom.py b/plugins/modules/pingdom.py index 192dd244f2..031085e61e 100644 --- a/plugins/modules/pingdom.py +++ b/plugins/modules/pingdom.py @@ -132,10 +132,10 @@ def main(): passwd = module.params['passwd'] key = module.params['key'] - if (state == "paused" or state == "stopped"): + if state == "paused" or state == "stopped": (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) if rc != 0: diff --git a/plugins/modules/rhevm.py b/plugins/modules/rhevm.py index a23448cc7a..7536b7843a 100644 --- a/plugins/modules/rhevm.py +++ b/plugins/modules/rhevm.py @@ -812,7 +812,7 @@ class RHEVConn(object): setChanged() HOST = self.get_Host(host_name) state = HOST.status.state - while (state != 'non_operational' and state != 'up'): + while state != 'non_operational' and state != 'up': HOST = self.get_Host(host_name) state = HOST.status.state time.sleep(1) diff --git a/plugins/modules/rocketchat.py b/plugins/modules/rocketchat.py index b134916040..765b7a71e3 100644 --- a/plugins/modules/rocketchat.py +++ b/plugins/modules/rocketchat.py @@ -181,7 +181,7 @@ def build_payload_for_rocketchat(module, text, channel, username, icon_url, icon elif text is not None: payload = dict(attachments=[dict(text=text, color=color)]) if channel is not None: - if (channel[0] == '#') or (channel[0] == '@'): + if channel[0] == '#' or channel[0] == '@': payload['channel'] = channel else: payload['channel'] = '#' + channel diff --git a/plugins/modules/sensu_silence.py b/plugins/modules/sensu_silence.py index a6d699f4c1..b030dc4e69 100644 --- a/plugins/modules/sensu_silence.py +++ b/plugins/modules/sensu_silence.py @@ -202,7 +202,7 @@ def create( expire_on_resolve, reason, subscription): (rc, out, changed) = query(module, url, check, subscription) for i in out: - if (i['subscription'] == subscription): + if i['subscription'] == subscription: if ( (check is None or check == i['check']) and ( diff --git a/plugins/modules/sl_vm.py b/plugins/modules/sl_vm.py index 6c819e4343..8b199f5698 100644 --- a/plugins/modules/sl_vm.py +++ b/plugins/modules/sl_vm.py @@ -319,9 +319,9 @@ def create_virtual_instance(module): return False, None # 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'] = '' - 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['disks'] = [] # Blank out disks since it will use the template else: diff --git a/plugins/modules/urpmi.py b/plugins/modules/urpmi.py index 5760a4829f..454921eaf3 100644 --- a/plugins/modules/urpmi.py +++ b/plugins/modules/urpmi.py @@ -184,7 +184,7 @@ def install_packages(module, pkgspec, root, force=True, no_recommends=True): def root_option(root): - if (root): + if root: return "--root=%s" % (root) else: return "" diff --git a/plugins/modules/xattr.py b/plugins/modules/xattr.py index fe48ce2eef..cbd9dcc05c 100644 --- a/plugins/modules/xattr.py +++ b/plugins/modules/xattr.py @@ -209,7 +209,7 @@ def main(): not (namespace == 'user' and key.startswith('user.'))): 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) if current is None or key not in current or value != current[key]: if not module.check_mode: diff --git a/plugins/modules/xml.py b/plugins/modules/xml.py index ef79cdbfbc..31deb4145d 100644 --- a/plugins/modules/xml.py +++ b/plugins/modules/xml.py @@ -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)) elif eoa == "": for node in tree.xpath(inner_xpath, namespaces=namespaces): - if (node.text != eoa_value): + if node.text != eoa_value: node.text = eoa_value changed = True