From ff10c9cb22236eea53480ea828d8833df554e180 Mon Sep 17 00:00:00 2001 From: Michael Calmer Date: Wed, 27 Nov 2024 14:03:39 +0100 Subject: [PATCH] Fix rebootifneeded state which miss definition of a variable (bsc#1233426) --- .../susemanager-sls/salt/rebootifneeded.sls | 2 +- susemanager-utils/susemanager-sls/salt/uptodate.sls | 12 ++++++++++++ ...almer.Manager-5.0-fix-undef-var-in-rebootifneeded | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 susemanager-utils/susemanager-sls/susemanager-sls.changes.mcalmer.Manager-5.0-fix-undef-var-in-rebootifneeded diff --git a/susemanager-utils/susemanager-sls/salt/rebootifneeded.sls b/susemanager-utils/susemanager-sls/salt/rebootifneeded.sls index dca67c7b399d..a135769cc7c2 100644 --- a/susemanager-utils/susemanager-sls/salt/rebootifneeded.sls +++ b/susemanager-utils/susemanager-sls/salt/rebootifneeded.sls @@ -13,6 +13,6 @@ mgr_reboot_if_needed: - onlyif: - test -e /boot/do_purge_kernels {%- else %} - - onlyif: 'zypper ps -s; [ $? -eq 102 ] || [ {{ patch_need_reboot }} -eq 0 ]' + - onlyif: 'zypper ps -s; [ $? -eq 102 ]' {%- endif %} {%- endif %} diff --git a/susemanager-utils/susemanager-sls/salt/uptodate.sls b/susemanager-utils/susemanager-sls/salt/uptodate.sls index e4a4b19dbe3f..809b5256fde2 100644 --- a/susemanager-utils/susemanager-sls/salt/uptodate.sls +++ b/susemanager-utils/susemanager-sls/salt/uptodate.sls @@ -45,3 +45,15 @@ mgr_keep_system_up2date_pkgs: - require: - sls: channels - mgr_keep_system_up2date_updatestack + +{%- if grains['os_family'] == 'Suse' and grains['osmajorrelease'] >= 15 %} + +# zypper up does not evaluate reboot_suggested flags in patches. We need to do it manual +mgr_flag_reboot_needed: + file.touch: + - name: /run/reboot-needed + - onlyif: '[ {{ patch_need_reboot|default(1) }} -eq 0 ]' + - require: + - pkg: mgr_keep_system_up2date_pkgs + +{% endif %} diff --git a/susemanager-utils/susemanager-sls/susemanager-sls.changes.mcalmer.Manager-5.0-fix-undef-var-in-rebootifneeded b/susemanager-utils/susemanager-sls/susemanager-sls.changes.mcalmer.Manager-5.0-fix-undef-var-in-rebootifneeded new file mode 100644 index 000000000000..bea71a915eb8 --- /dev/null +++ b/susemanager-utils/susemanager-sls/susemanager-sls.changes.mcalmer.Manager-5.0-fix-undef-var-in-rebootifneeded @@ -0,0 +1,2 @@ +- Fix rebootifneeded state which miss definition of a variable + (bsc#1233426)