module

Krikri::PluginHelpers::DpkgDivertCommand

DpkgDivertCommand - builds the dpkg-divert command lines community.general.dpkg_divert runs, mirroring the MAINCOMMAND construction in the Ansible module's main(). Pure string plumbing so the exact argv shapes are unit-testable without a dpkg database (or a Debian host at all); the plugin itself executes them.

Class methods

listpackage_command(dpkg_divert : String, path : String) : String

The two diversion-state probes run through run_command(..., check_rc=True) in the real module, so a non-zero exit fails the module with run_command's own shape - whose cmd field is _clean_args' rendering: the resolved binary with each arg shlex.quote-joined (safe tokens stay bare, so a relative path like 80 reports unquoted). Shell.quote_arg mirrors that quoting; the same string is also shell-safe to execute.

Source
main_command(options : Options, dpkg_divert : String, path : String) : String

The one dpkg-divert invocation that adds/updates/removes the diversion. The Ansible module probes --version for --no-rename support (dpkg >= 1.19.1, 2019) - treated as always-supported here, same reasoning as lvol's --yes shortcut: --no-rename is always passed explicitly unless --rename was asked for.

dpkg_divert is the get_bin_path(required=True)-resolved binary: the real module builds MAINCOMMAND from the RESOLVED path, so the commands its success result records carry "/usr/bin/dpkg-divert ...", not a bare name.

Source
remove_command(dpkg_divert : String, path : String) : String
Source
truename_command(dpkg_divert : String, path : String) : String
Source
version_command(dpkg_divert : String) : String
Source
with_test(command : String) : String

Inserts --test where the Ansible module puts it (right after the binary, before the action flags) - used both for check mode and for its own "just try and see" probe when the diversion state already matches.

Source

Nested types