1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-21 11:19:00 +00:00

lvm_pv - use CmdRunner (#11811)

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* lvm_pv - add changelog fragment for #11811

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

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

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Alexei Znamensky 2026-04-16 06:03:16 +12:00 committed by GitHub
parent d1448b76c1
commit ff5c34c4a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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(),
),