mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-02 18:36:19 +00:00
[PR #11215/862fe79a backport][stable-12] fix ruff case SIM110 (#11217)
fix ruff case SIM110 (#11215)
* fix ruff case SIM110
* Update plugins/module_utils/xenserver.py
* add changelog frag
---------
(cherry picked from commit 862fe79a22)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
e741e22ec4
commit
8930d03c7c
16 changed files with 34 additions and 72 deletions
|
|
@ -205,11 +205,7 @@ def _check_nfs_device(module, nfs_host, device):
|
|||
module.fail_json(msg=f"Failed to run showmount. Error message: {err}")
|
||||
else:
|
||||
showmount_data = showmount_out.splitlines()
|
||||
for line in showmount_data:
|
||||
if line.split(":")[1] == device:
|
||||
return True
|
||||
|
||||
return False
|
||||
return any(line.split(":")[1] == device for line in showmount_data)
|
||||
|
||||
|
||||
def _validate_vg(module, vg):
|
||||
|
|
|
|||
|
|
@ -150,11 +150,10 @@ def parse_out(string):
|
|||
|
||||
|
||||
def has_changed(string):
|
||||
for no_change in ["Nothing to install or update", "Nothing to install, update or remove"]:
|
||||
if no_change in string:
|
||||
return False
|
||||
|
||||
return True
|
||||
return all(
|
||||
no_change not in string
|
||||
for no_change in ["Nothing to install or update", "Nothing to install, update or remove"]
|
||||
)
|
||||
|
||||
|
||||
def get_available_options(module, command="install"):
|
||||
|
|
|
|||
|
|
@ -313,10 +313,7 @@ def _is_flatpak_id(part):
|
|||
domain = sections[0]
|
||||
if not domain.islower():
|
||||
return False
|
||||
for section in sections[1:]:
|
||||
if not section.isalnum():
|
||||
return False
|
||||
return True
|
||||
return all(section.isalnum() for section in sections[1:])
|
||||
|
||||
|
||||
def _parse_flatpak_name(name):
|
||||
|
|
|
|||
|
|
@ -202,10 +202,7 @@ class GitLabGroup:
|
|||
|
||||
# check if the user is a member of the group
|
||||
def is_user_a_member(self, members, gitlab_user_id):
|
||||
for member in members:
|
||||
if member.id == gitlab_user_id:
|
||||
return True
|
||||
return False
|
||||
return any(member.id == gitlab_user_id for member in members)
|
||||
|
||||
# add user to a group
|
||||
def add_member_to_group(self, gitlab_user_id, gitlab_group_id, access_level):
|
||||
|
|
|
|||
|
|
@ -205,10 +205,7 @@ class GitLabProjectMembers:
|
|||
|
||||
# check if the user is a member of the project
|
||||
def is_user_a_member(self, members, gitlab_user_id):
|
||||
for member in members:
|
||||
if member.id == gitlab_user_id:
|
||||
return True
|
||||
return False
|
||||
return any(member.id == gitlab_user_id for member in members)
|
||||
|
||||
# add user to a project
|
||||
def add_member_to_project(self, gitlab_user_id, gitlab_project_id, access_level):
|
||||
|
|
|
|||
|
|
@ -682,10 +682,9 @@ class LXDContainerManagement:
|
|||
return self.config[key] != old_configs
|
||||
|
||||
def _needs_to_apply_instance_configs(self):
|
||||
for param in set(CONFIG_PARAMS) - set(CONFIG_CREATION_PARAMS):
|
||||
if self._needs_to_change_instance_config(param):
|
||||
return True
|
||||
return False
|
||||
return any(
|
||||
self._needs_to_change_instance_config(param) for param in set(CONFIG_PARAMS) - set(CONFIG_CREATION_PARAMS)
|
||||
)
|
||||
|
||||
def _apply_instance_configs(self):
|
||||
old_metadata = copy.deepcopy(self.old_instance_json).get("metadata", None) or {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue