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
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.
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.