Merge pull request #9447 from Icinga/9431b

ITL: apt: render vars.apt_[dist_]upgrade=true as --[dist-]upgrade, not --[dist-]upgrade=true
This commit is contained in:
Julian Brost 2022-07-25 12:47:21 +02:00 committed by GitHub
commit 5e759c7a6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1923,20 +1923,43 @@ object CheckCommand "apt" {
command = [ PluginDir + "/check_apt" ]
arguments = {
"--extra-opts" = {
value = "$apt_extra_opts$"
description = "Read options from an ini file."
}
// apt-get takes only options starting with "-" (like "-sqq") before
// the upgrade command, so passing e.g. "foobar" as "--upgrade=foobar"
// makes no sense. This allows to easily decide between "-x=-y"
// (strings starting with "-") and "-x" (everything else).
"--upgrade" = {
value = "$apt_upgrade$"
separator = "="
set_if = {{
var v = macro("$apt_upgrade$")
return match("-*", string(v).trim()) ? false : v
}}
description = "[Default] Perform an upgrade. If an optional OPTS argument is provided, apt-get will be run with these command line options instead of the default."
}
"--dist-upgrade" = {
value = "$apt_dist_upgrade$"
separator = "="
set_if = {{
var v = macro("$apt_dist_upgrade$")
return match("-*", string(v).trim()) ? false : v
}}
description = "Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS can be provided to override the default options."
}
"--upgrade=OPTS" = {
set_if = {{ match("-*", string(macro("$apt_upgrade$")).trim()) }}
key = "--upgrade"
separator = "="
value = "$apt_upgrade$"
description = "[Default] Perform an upgrade. If an optional OPTS argument is provided, apt-get will be run with these command line options instead of the default."
}
"--dist-upgrade=OPTS" = {
set_if = {{ match("-*", string(macro("$apt_dist_upgrade$")).trim()) }}
key = "--dist-upgrade"
separator = "="
value = "$apt_dist_upgrade$"
description = "Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS can be provided to override the default options."
}
"--extra-opts" = {
value = "$apt_extra_opts$"
description = "Read options from an ini file."
}
"--include" = {
value = "$apt_include$"
description = "Include only packages matching REGEXP. Can be specified multiple times the values will be combined together."