mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
[PR #11115/58bb1e7c backport][stable-12] fix ruff case B007 (#11131)
fix ruff case B007 (#11115)
* fix ruff case B007
* rollback inventory/iocage
* re-do the fix in inventory/iocage
* add cases in tests/unit/plugins
* rollback plugins/module_utils/memset.py
* rollback extraneous changes in plugins/modules/xcc_redfish_command.py
* add changelog frag
(cherry picked from commit 58bb1e7c04)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
42997e2d28
commit
b72e38c909
32 changed files with 90 additions and 73 deletions
28
changelogs/fragments/11115-ruff-cases-1.yml
Normal file
28
changelogs/fragments/11115-ruff-cases-1.yml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
minor_changes:
|
||||
- elastic callback plugin - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- opentelemetry callback plugin - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- wsl connection plugin - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- cobbler inventory plugin - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- iocage inventory plugin - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- _stormssh module utils - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- keycloak module utils - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- redfish_utils module utils - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- ali_instance - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- apt_rpm - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- dnf_config_manager - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- haproxy - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- hpilo_info - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- hwc_ecs_instance - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- hwc_vpc_port - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- influxdb_user - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- keycloak_authentication - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- keycloak_client_rolemapping - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- keycloak_component - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- keycloak_realm_key - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- keycloak_realm_rolemapping - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- keycloak_user_rolemapping - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- keycloak_userprofile - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- nmcli - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- pear - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- xbps - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
- xcc_redfish_command - fix cases of unused variables in loops (https://github.com/ansible-collections/community.general/pull/11115).
|
||||
|
|
@ -201,7 +201,7 @@ class ElasticSource:
|
|||
|
||||
tasks = []
|
||||
parent_start_time = None
|
||||
for task_uuid, task in tasks_data.items():
|
||||
for task in tasks_data.values():
|
||||
if parent_start_time is None:
|
||||
parent_start_time = task.start
|
||||
tasks.append(task)
|
||||
|
|
@ -224,7 +224,7 @@ class ElasticSource:
|
|||
label(ansible_host_ip=self.ip_address)
|
||||
|
||||
for task_data in tasks:
|
||||
for host_uuid, host_data in task_data.host_data.items():
|
||||
for host_data in task_data.host_data.values():
|
||||
self.create_span_data(apm_cli, task_data, host_data)
|
||||
|
||||
apm_cli.end_transaction(name=__name__, result=status, duration=end_time - parent_start_time)
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ class OpenTelemetrySource:
|
|||
|
||||
tasks = []
|
||||
parent_start_time = None
|
||||
for task_uuid, task in tasks_data.items():
|
||||
for task in tasks_data.values():
|
||||
if parent_start_time is None:
|
||||
parent_start_time = task.start
|
||||
tasks.append(task)
|
||||
|
|
@ -309,7 +309,7 @@ class OpenTelemetrySource:
|
|||
parent.set_attribute("ansible.host.ip", self.ip_address)
|
||||
parent.set_attribute("ansible.host.user", self.user)
|
||||
for task in tasks:
|
||||
for host_uuid, host_data in task.host_data.items():
|
||||
for host_data in task.host_data.values():
|
||||
with tracer.start_as_current_span(task.name, start_time=task.start, end_on_exit=False) as span:
|
||||
self.update_span_data(task, host_data, span, disable_logs, disable_attributes_in_logs)
|
||||
|
||||
|
|
|
|||
|
|
@ -541,8 +541,8 @@ class Connection(ConnectionBase):
|
|||
return self
|
||||
|
||||
def _any_keys_added(self) -> bool:
|
||||
for hostname, keys in self.ssh._host_keys.items(): # type: ignore[attr-defined] # TODO: figure out what _host_keys is!
|
||||
for keytype, key in keys.items():
|
||||
for host_keys in self.ssh._host_keys.values(): # type: ignore[attr-defined] # TODO: figure out what _host_keys is!
|
||||
for key in host_keys.values():
|
||||
added_this_time = getattr(key, "_added_by_ansible_this_time", False)
|
||||
if added_this_time:
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
|
|||
ip_address_first = None
|
||||
ipv6_address = None
|
||||
ipv6_address_first = None
|
||||
for iname, ivalue in interfaces.items():
|
||||
for ivalue in interfaces.values():
|
||||
# Set to first interface or management interface if defined or hostname matches dns_name
|
||||
if ivalue["ip_address"] != "":
|
||||
if ip_address_first is None:
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||
self.get_jails(t_stdout, results)
|
||||
|
||||
if get_properties:
|
||||
for hostname, host_vars in results["_meta"]["hostvars"].items():
|
||||
for hostname in results["_meta"]["hostvars"]:
|
||||
cmd_get_properties = cmd.copy()
|
||||
cmd_get_properties.append(self.IOCAGE)
|
||||
cmd_get_properties.append("get")
|
||||
|
|
@ -335,7 +335,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||
except Exception as e:
|
||||
raise AnsibleError(f"Failed to get pool: {e}") from e
|
||||
|
||||
for hostname, host_vars in results["_meta"]["hostvars"].items():
|
||||
for hostname in results["_meta"]["hostvars"]:
|
||||
iocage_hooks = []
|
||||
for hook in hooks_results:
|
||||
path = f"/{iocage_pool}/iocage/jails/{hostname}/root{hook}"
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ class ConfigParser:
|
|||
continue
|
||||
|
||||
searchable_information = host_entry.get("host")
|
||||
for key, value in host_entry.get("options").items():
|
||||
for value in host_entry.get("options").values():
|
||||
if isinstance(value, list):
|
||||
value = " ".join(value)
|
||||
if isinstance(value, int):
|
||||
|
|
|
|||
|
|
@ -2350,7 +2350,7 @@ class KeycloakAPI:
|
|||
"""
|
||||
try:
|
||||
if diff > 0:
|
||||
for i in range(diff):
|
||||
for _i in range(diff):
|
||||
self._request(
|
||||
URL_AUTHENTICATION_EXECUTION_RAISE_PRIORITY.format(
|
||||
url=self.baseurl, realm=realm, id=executionId
|
||||
|
|
@ -2358,7 +2358,7 @@ class KeycloakAPI:
|
|||
method="POST",
|
||||
)
|
||||
elif diff < 0:
|
||||
for i in range(-diff):
|
||||
for _i in range(-diff):
|
||||
self._request(
|
||||
URL_AUTHENTICATION_EXECUTION_LOWER_PRIORITY.format(
|
||||
url=self.baseurl, realm=realm, id=executionId
|
||||
|
|
|
|||
|
|
@ -2913,7 +2913,7 @@ class RedfishUtils:
|
|||
|
||||
@staticmethod
|
||||
def _virt_media_image_inserted(resources, image_url):
|
||||
for uri, data in resources.items():
|
||||
for data in resources.values():
|
||||
if data.get("Image"):
|
||||
if urlparse(image_url) == urlparse(data.get("Image")):
|
||||
if data.get("Inserted", False) and data.get("ImageName"):
|
||||
|
|
|
|||
|
|
@ -890,7 +890,7 @@ def main():
|
|||
if state == "present":
|
||||
if not instance_ids:
|
||||
if len(instances) > count:
|
||||
for i in range(0, len(instances) - count):
|
||||
for _i in range(0, len(instances) - count):
|
||||
inst = instances[len(instances) - 1]
|
||||
if inst.status != "stopped" and not force:
|
||||
module.fail_json(
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ def update_package_db(module):
|
|||
|
||||
def dir_size(module, path):
|
||||
total_size = 0
|
||||
for cur_path, dirs, files in os.walk(path):
|
||||
for cur_path, _dirs, files in os.walk(path):
|
||||
for f in files:
|
||||
total_size += os.path.getsize(os.path.join(cur_path, f))
|
||||
return total_size
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ def get_repo_states(module):
|
|||
|
||||
repos = dict()
|
||||
last_repo = ""
|
||||
for i, line in enumerate(out.split("\n")):
|
||||
for line in out.split("\n"):
|
||||
m = REPO_ID_RE.match(line)
|
||||
if m:
|
||||
if len(last_repo) > 0:
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ class HAProxy:
|
|||
the expected status in that time, the module will fail. If the service was
|
||||
not found, the module will fail.
|
||||
"""
|
||||
for i in range(1, self.wait_retries):
|
||||
for _i in range(1, self.wait_retries):
|
||||
state = self.get_state_for(pxname, svname)
|
||||
|
||||
# We can assume there will only be 1 element in state because both svname and pxname are always set when we get here
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ def main():
|
|||
if memory_details_summary:
|
||||
info["hw_memory_details_summary"] = memory_details_summary
|
||||
info["hw_memory_total"] = 0
|
||||
for cpu, details in memory_details_summary.items():
|
||||
for details in memory_details_summary.values():
|
||||
cpu_total_memory_size = details.get("total_memory_size")
|
||||
if cpu_total_memory_size:
|
||||
ram = re.search(r"(\d+)\s+(\w+)", cpu_total_memory_size)
|
||||
|
|
|
|||
|
|
@ -1174,16 +1174,14 @@ def expand_delete_servers(d, array_index):
|
|||
|
||||
req = []
|
||||
|
||||
n = 1
|
||||
for i in range(n):
|
||||
transformed = dict()
|
||||
transformed = dict()
|
||||
|
||||
v = expand_delete_servers_id(d, new_ai)
|
||||
if not is_empty_value(v):
|
||||
transformed["id"] = v
|
||||
v = expand_delete_servers_id(d, new_ai)
|
||||
if not is_empty_value(v):
|
||||
transformed["id"] = v
|
||||
|
||||
if transformed:
|
||||
req.append(transformed)
|
||||
if transformed:
|
||||
req.append(transformed)
|
||||
|
||||
return req
|
||||
|
||||
|
|
|
|||
|
|
@ -509,16 +509,14 @@ def expand_create_fixed_ips(d, array_index):
|
|||
|
||||
req = []
|
||||
|
||||
n = 1
|
||||
for i in range(n):
|
||||
transformed = dict()
|
||||
transformed = dict()
|
||||
|
||||
v = navigate_value(d, ["ip_address"], new_array_index)
|
||||
if not is_empty_value(v):
|
||||
transformed["ip_address"] = v
|
||||
v = navigate_value(d, ["ip_address"], new_array_index)
|
||||
if not is_empty_value(v):
|
||||
transformed["ip_address"] = v
|
||||
|
||||
if transformed:
|
||||
req.append(transformed)
|
||||
if transformed:
|
||||
req.append(transformed)
|
||||
|
||||
return req
|
||||
|
||||
|
|
@ -1011,17 +1009,15 @@ def expand_list_fixed_ips(d, array_index):
|
|||
|
||||
req = []
|
||||
|
||||
n = 1
|
||||
for i in range(n):
|
||||
transformed = dict()
|
||||
transformed = dict()
|
||||
|
||||
v = navigate_value(d, ["ip_address"], new_array_index)
|
||||
transformed["ip_address"] = v
|
||||
v = navigate_value(d, ["ip_address"], new_array_index)
|
||||
transformed["ip_address"] = v
|
||||
|
||||
for v in transformed.values():
|
||||
if v is not None:
|
||||
req.append(transformed)
|
||||
break
|
||||
for v in transformed.values():
|
||||
if v is not None:
|
||||
req.append(transformed)
|
||||
break
|
||||
|
||||
return req if req else None
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ def set_user_grants(module, client, user_name, grants):
|
|||
try:
|
||||
parsed_grants = []
|
||||
# Fix privileges wording
|
||||
for i, v in enumerate(current_grants):
|
||||
for v in current_grants:
|
||||
if v["privilege"] != "NO PRIVILEGES":
|
||||
if v["privilege"] == "ALL PRIVILEGES":
|
||||
v["privilege"] = "ALL"
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ def create_or_update_executions(kc, config, realm="master"):
|
|||
if exec_index != -1:
|
||||
# Remove key that doesn't need to be compared with existing_exec
|
||||
exclude_key = ["flowAlias", "subFlowType"]
|
||||
for index_key, key in enumerate(new_exec, start=0):
|
||||
for key in new_exec:
|
||||
if new_exec[key] is None:
|
||||
exclude_key.append(key)
|
||||
# Compare the executions to see if it need changes
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ def main():
|
|||
if roles is None:
|
||||
module.exit_json(msg="Nothing to do (no roles specified).")
|
||||
else:
|
||||
for role_index, role in enumerate(roles, start=0):
|
||||
for role in roles:
|
||||
if role["name"] is None and role["id"] is None:
|
||||
module.fail_json(msg="Either the `name` or `id` has to be specified on each role.")
|
||||
# Fetch missing role_id
|
||||
|
|
@ -350,7 +350,7 @@ def main():
|
|||
result["proposed"] = list(assigned_roles_before) if assigned_roles_before else []
|
||||
|
||||
update_roles = []
|
||||
for role_index, role in enumerate(roles, start=0):
|
||||
for role in roles:
|
||||
# Fetch roles to assign if state present
|
||||
if state == "present":
|
||||
for available_role in available_roles_before:
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ def main():
|
|||
changeset_copy["id"] = component_id
|
||||
|
||||
# Compare top-level parameters
|
||||
for param, value in changeset.items():
|
||||
for param in changeset:
|
||||
before_component[param] = component[param]
|
||||
|
||||
if changeset_copy[param] != component[param] and param != "config":
|
||||
|
|
@ -266,8 +266,8 @@ def main():
|
|||
before_component["config"][p] = component["config"][p] or []
|
||||
except KeyError:
|
||||
before_component["config"][p] = []
|
||||
if changeset_copy["config"][p] != component["config"][p]:
|
||||
changes += f"config.{p}: {component['config'][p]} -> {changeset_copy['config'][p]}, "
|
||||
if v != component["config"][p]:
|
||||
changes += f"config.{p}: {component['config'][p]} -> {v}, "
|
||||
result["changed"] = True
|
||||
|
||||
# Check all the possible states of the resource and do what is needed to
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ def main():
|
|||
changeset_copy["id"] = key_id
|
||||
|
||||
# Compare top-level parameters
|
||||
for param, value in changeset.items():
|
||||
for param in changeset:
|
||||
before_realm_key[param] = key[param]
|
||||
|
||||
if changeset_copy[param] != key[param] and param != "config":
|
||||
|
|
@ -402,8 +402,8 @@ def main():
|
|||
# Compare parameters under the "config" key
|
||||
for p, v in changeset_copy["config"].items():
|
||||
before_realm_key["config"][p] = key["config"][p]
|
||||
if changeset_copy["config"][p] != key["config"][p]:
|
||||
changes += f"config.{p}: {key['config'][p]} -> {changeset_copy['config'][p]}, "
|
||||
if v != key["config"][p]:
|
||||
changes += f"config.{p}: {key['config'][p]} -> {v}, "
|
||||
result["changed"] = True
|
||||
|
||||
# Sanitize linefeeds for the privateKey. Without this the JSON payload
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ def main():
|
|||
if roles is None:
|
||||
module.exit_json(msg="Nothing to do (no roles specified).")
|
||||
else:
|
||||
for role_index, role in enumerate(roles, start=0):
|
||||
for role in roles:
|
||||
if role["name"] is None and role["id"] is None:
|
||||
module.fail_json(msg="Either the `name` or `id` has to be specified on each role.")
|
||||
# Fetch missing role_id
|
||||
|
|
@ -330,7 +330,7 @@ def main():
|
|||
result["proposed"] = list(assigned_roles_before) if assigned_roles_before else []
|
||||
|
||||
update_roles = []
|
||||
for role_index, role in enumerate(roles, start=0):
|
||||
for role in roles:
|
||||
# Fetch roles to assign if state present
|
||||
if state == "present":
|
||||
if any(assigned == role["name"] for assigned in assigned_roles_before):
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ def main():
|
|||
if roles is None:
|
||||
module.exit_json(msg="Nothing to do (no roles specified).")
|
||||
else:
|
||||
for role_index, role in enumerate(roles, start=0):
|
||||
for role in roles:
|
||||
if role.get("name") is None and role.get("id") is None:
|
||||
module.fail_json(msg="Either the `name` or `id` has to be specified on each role.")
|
||||
# Fetch missing role_id
|
||||
|
|
@ -373,7 +373,7 @@ def main():
|
|||
result["proposed"] = roles
|
||||
|
||||
update_roles = []
|
||||
for role_index, role in enumerate(roles, start=0):
|
||||
for role in roles:
|
||||
# Fetch roles to assign if state present
|
||||
if state == "present":
|
||||
for available_role in available_roles_before:
|
||||
|
|
|
|||
|
|
@ -664,7 +664,7 @@ def main():
|
|||
)
|
||||
|
||||
# Compare top-level parameters
|
||||
for param, value in changeset.items():
|
||||
for param in changeset:
|
||||
before_realm_userprofile[param] = userprofile[param]
|
||||
|
||||
if changeset_copy[param] != userprofile[param] and param != "config":
|
||||
|
|
@ -674,8 +674,8 @@ def main():
|
|||
# Compare parameters under the "config" userprofile
|
||||
for p, v in changeset_copy["config"].items():
|
||||
before_realm_userprofile["config"][p] = userprofile["config"][p]
|
||||
if changeset_copy["config"][p] != userprofile["config"][p]:
|
||||
changes += f"config.{p}: {userprofile['config'][p]} -> {changeset_copy['config'][p]}, "
|
||||
if v != userprofile["config"][p]:
|
||||
changes += f"config.{p}: {userprofile['config'][p]} -> {v}, "
|
||||
result["changed"] = True
|
||||
|
||||
# Check all the possible states of the resource and do what is needed to
|
||||
|
|
|
|||
|
|
@ -2553,7 +2553,7 @@ class Nmcli:
|
|||
supported_properties = self.get_supported_properties(setting)
|
||||
unsupported_properties = []
|
||||
|
||||
for property, value in getattr(self, setting_key).items():
|
||||
for property in getattr(self, setting_key):
|
||||
if property not in supported_properties:
|
||||
unsupported_properties.append(property)
|
||||
|
||||
|
|
|
|||
|
|
@ -311,10 +311,6 @@ def main():
|
|||
if p["name"]:
|
||||
pkgs = p["name"].split(",")
|
||||
|
||||
pkg_files = []
|
||||
for i, pkg in enumerate(pkgs):
|
||||
pkg_files.append(None)
|
||||
|
||||
if module.check_mode:
|
||||
check_packages(module, pkgs, p["state"])
|
||||
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ def remove_packages(module, xbps_path, packages):
|
|||
def install_packages(module, xbps_path, state, packages):
|
||||
"""Returns true if package install succeeds."""
|
||||
toInstall = []
|
||||
for i, package in enumerate(packages):
|
||||
for package in packages:
|
||||
"""If the package is installed and state == present or state == latest
|
||||
and is up-to-date then skip"""
|
||||
installed, updated = query_package(module, xbps_path, package)
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ class XCCRedfishUtils(RedfishUtils):
|
|||
|
||||
# eject all inserted media one by one
|
||||
ejected_media_list = []
|
||||
for uri, data in resources.items():
|
||||
for data in resources.values():
|
||||
if data.get("Image") and data.get("Inserted", True):
|
||||
returndict = self.virtual_media_eject_one(data.get("Image"))
|
||||
if not returndict["ret"]:
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ ignore = [
|
|||
"UP030", # Use implicit references for positional format fields
|
||||
"UP031", # Use format specifiers instead of percent format
|
||||
"UP041", # Replace aliased errors with `TimeoutError`
|
||||
"B007", # unused-loop-control-variable
|
||||
"B015", # useless-comparison
|
||||
"B026", # star-arg-unpacking-after-keyword-arg
|
||||
"SIM102", # collapsible-if
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ def test_get_jails(inventory):
|
|||
def test_get_properties(inventory):
|
||||
results = {"_meta": {"hostvars": {}}}
|
||||
inventory.get_jails(inventory.jails, results)
|
||||
for hostname, host_vars in results["_meta"]["hostvars"].items():
|
||||
for hostname in results["_meta"]["hostvars"]:
|
||||
inventory.get_properties(inventory.prpts[hostname], results, hostname)
|
||||
assert results == inventory.ps_ok
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ def test_get_properties(inventory):
|
|||
def test_populate(inventory, mocker):
|
||||
results = {"_meta": {"hostvars": {}}}
|
||||
inventory.get_jails(inventory.jails, results)
|
||||
for hostname, host_vars in results["_meta"]["hostvars"].items():
|
||||
for hostname in results["_meta"]["hostvars"]:
|
||||
inventory.get_properties(inventory.prpts[hostname], results, hostname)
|
||||
inventory.get_option = mocker.MagicMock(side_effect=get_option)
|
||||
inventory.populate(results)
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ def test_invalid_csv(data, dialect, dialect_params, fieldnames):
|
|||
result = False
|
||||
|
||||
try:
|
||||
for row in reader:
|
||||
for _row in reader:
|
||||
continue
|
||||
except csv.CSVError:
|
||||
result = True
|
||||
|
|
|
|||
|
|
@ -96,9 +96,9 @@ class TestPritunlOrg(ModuleTestCase):
|
|||
# except for changed which should be false the second time
|
||||
for k, v in idempotent_exc.items():
|
||||
if k == "changed":
|
||||
self.assertFalse(idempotent_exc[k])
|
||||
self.assertFalse(v)
|
||||
else:
|
||||
self.assertEqual(create_exc[k], idempotent_exc[k])
|
||||
self.assertEqual(create_exc[k], v)
|
||||
|
||||
def test_absent(self):
|
||||
"""Test organization removal from Pritunl."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue