[PR #11811/ff5c34c4 backport][stable-12] lvm_pv - use CmdRunner (#11833)

lvm_pv - use CmdRunner (#11811)

* lvm_pv - migrate to CmdRunner using shared runners from module_utils/_lvm



* lvm_pv - add changelog fragment for #11811



* Update changelogs/fragments/11811-lvm_pv-use-cmdrunner.yml



---------



(cherry picked from commit ff5c34c4a7)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot]
2026-04-15 22:01:11 +02:00
committed by GitHub
parent 705ffc564d
commit 1b4e58bbbf
3 changed files with 36 additions and 34 deletions

View File

@@ -54,7 +54,7 @@ def pvcreate_runner(module: AnsibleModule, **kwargs) -> CmdRunner:
Runner for C(pvcreate). Used by: community.general.lvg, community.general.lvm_pv,
community.general.filesystem.
Suggested arg_formats keys: force yes devices
Suggested arg_formats keys: force yes device
"""
return CmdRunner(
module,
@@ -62,7 +62,7 @@ def pvcreate_runner(module: AnsibleModule, **kwargs) -> CmdRunner:
arg_formats=dict(
force=cmd_runner_fmt.as_bool("-f"),
yes=cmd_runner_fmt.as_bool("--yes"),
devices=cmd_runner_fmt.as_list(),
device=cmd_runner_fmt.as_list(),
),
**kwargs,
)
@@ -108,15 +108,15 @@ def pvremove_runner(module: AnsibleModule, **kwargs) -> CmdRunner:
"""
Runner for C(pvremove). Used by: community.general.lvm_pv.
Suggested arg_formats keys: yes force device
Suggested arg_formats keys: force device
Note: C(force=True) passes C(-ff), which removes PVs even when part of a VG.
Note: C(-y) is always passed (non-interactive). C(force=True) passes C(-ff),
which removes PVs even when part of a VG.
"""
return CmdRunner(
module,
command="pvremove",
command=["pvremove", "-y"],
arg_formats=dict(
yes=cmd_runner_fmt.as_bool("-y"),
force=cmd_runner_fmt.as_bool("-ff"),
device=cmd_runner_fmt.as_list(),
),