Skip to content

Commit

Permalink
Use underscore for unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
spetrosi committed Jan 8, 2024
1 parent 94b5421 commit 449c84d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions library/bootloader_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ def run_module():
# supports check mode
module = AnsibleModule(argument_spec=module_args, supports_check_mode=True)
for bootloader_setting in module.params["bootloader_settings"]:
_unused, kernels_info, stderr = module.run_command("grubby --info=ALL")
_, kernels_info, stderr = module.run_command("grubby --info=ALL")
if "Permission denied" in stderr:
module.fail_json(msg="You must run this as sudo", **result)

Check warning on line 366 in library/bootloader_settings.py

View check run for this annotation

Codecov / codecov/patch

library/bootloader_settings.py#L364-L366

Added lines #L364 - L366 were not covered by tests

_unused, default_kernel, _unused = module.run_command("grubby --default-index")
_, default_kernel, _ = module.run_command("grubby --default-index")
bootloader_facts = get_facts(kernels_info, default_kernel)

Check warning on line 369 in library/bootloader_settings.py

View check run for this annotation

Codecov / codecov/patch

library/bootloader_settings.py#L368-L369

Added lines #L368 - L369 were not covered by tests

err, kernel_action, kernel = validate_kernels(

Check warning on line 371 in library/bootloader_settings.py

View check run for this annotation

Codecov / codecov/patch

library/bootloader_settings.py#L371

Added line #L371 was not covered by tests
Expand All @@ -382,27 +382,25 @@ def run_module():
rc, kernel_info, stderr = module.run_command("grubby --info=" + kernel)
rm_boot_args_cmd = get_rm_boot_args_cmd(kernel_info, kernel)
if rm_boot_args_cmd:
_unused, stdout, _unused = module.run_command(rm_boot_args_cmd)
_, stdout, _ = module.run_command(rm_boot_args_cmd)
result["changed"] = True
result["actions"].append(rm_boot_args_cmd)

Check warning on line 387 in library/bootloader_settings.py

View check run for this annotation

Codecov / codecov/patch

library/bootloader_settings.py#L382-L387

Added lines #L382 - L387 were not covered by tests

# Create a kernel with provided options
if kernel_action == "create":
add_kernel_cmd = get_add_kernel_cmd(bootloader_setting["options"], kernel)
_unused, stdout, _unused = module.run_command(add_kernel_cmd)
_, stdout, _ = module.run_command(add_kernel_cmd)
result["changed"] = True
result["actions"].append(add_kernel_cmd)

Check warning on line 394 in library/bootloader_settings.py

View check run for this annotation

Codecov / codecov/patch

library/bootloader_settings.py#L390-L394

Added lines #L390 - L394 were not covered by tests

# Modify boot settings
if kernel_action == "modify":
_unused, kernel_info, _unused = module.run_command(
"grubby --info=" + kernel
)
_, kernel_info, _ = module.run_command("grubby --info=" + kernel)

Check warning on line 398 in library/bootloader_settings.py

View check run for this annotation

Codecov / codecov/patch

library/bootloader_settings.py#L397-L398

Added lines #L397 - L398 were not covered by tests
mod_boot_args_cmd = get_mod_boot_args_cmd(
bootloader_setting["options"], kernel, kernel_info
)
if mod_boot_args_cmd:
_unused, stdout, _unused = module.run_command(mod_boot_args_cmd)
_, stdout, _ = module.run_command(mod_boot_args_cmd)

Check warning on line 403 in library/bootloader_settings.py

View check run for this annotation

Codecov / codecov/patch

library/bootloader_settings.py#L403

Added line #L403 was not covered by tests
result["changed"] = True
result["actions"].append(mod_boot_args_cmd)
else:
Expand All @@ -411,7 +409,7 @@ def run_module():
# Remove a kernel
if kernel_action == "remove":
rm_kernel_cmd = get_rm_kernel_cmd(kernel)
_unused, stdout, _unused = module.run_command(rm_kernel_cmd)
_, stdout, _ = module.run_command(rm_kernel_cmd)
result["changed"] = True
result["actions"].append(rm_kernel_cmd)

Check warning on line 414 in library/bootloader_settings.py

View check run for this annotation

Codecov / codecov/patch

library/bootloader_settings.py#L410-L414

Added lines #L410 - L414 were not covered by tests

Expand Down

0 comments on commit 449c84d

Please sign in to comment.