File ensure-virt.update-stop_on_reboot-is-updated-with-it.patch of Package salt

From 1cea7d065d8da7c713af8136162c21187d5186f5 Mon Sep 17 00:00:00 2001
From: Cedric Bosdonnat <cbosdonnat@suse.com>
Date: Wed, 14 Oct 2020 12:39:16 +0200
Subject: [PATCH] Ensure virt.update stop_on_reboot is updated with its
 default value (#280)

While all virt.update properties default values should not be used when
updating the XML definition, the stop_on_reboot default value (False)
needs to be passed still or the user will never be able to update with
this value.
---
 salt/modules/virt.py            | 1 +
 tests/unit/modules/test_virt.py | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/salt/modules/virt.py b/salt/modules/virt.py
index 8e2180608a..e3960a5a90 100644
--- a/salt/modules/virt.py
+++ b/salt/modules/virt.py
@@ -2738,6 +2738,7 @@ def update(
     ]
 
     data = {k: v for k, v in locals().items() if bool(v)}
+    data["stop_on_reboot"] = stop_on_reboot
     if boot_dev:
         data["boot_dev"] = {i + 1: dev for i, dev in enumerate(boot_dev.split())}
     need_update = (
diff --git a/tests/unit/modules/test_virt.py b/tests/unit/modules/test_virt.py
index fba821ea53..83152eda6e 100644
--- a/tests/unit/modules/test_virt.py
+++ b/tests/unit/modules/test_virt.py
@@ -1777,6 +1777,7 @@ class VirtTestCase(TestCase, LoaderModuleMockMixin):
               <memory unit='KiB'>1048576</memory>
               <currentMemory unit='KiB'>1048576</currentMemory>
               <vcpu placement='auto'>1</vcpu>
+              <on_reboot>restart</on_reboot>
               <os>
                 <type arch='x86_64' machine='pc-i440fx-2.6'>hvm</type>
                 <boot dev="hd"/>
@@ -2349,6 +2350,7 @@ class VirtTestCase(TestCase, LoaderModuleMockMixin):
               <memory unit='KiB'>1048576</memory>
               <currentMemory unit='KiB'>1048576</currentMemory>
               <vcpu placement='auto'>1</vcpu>
+              <on_reboot>restart</on_reboot>
               <os>
                 <type arch='x86_64' machine='pc-i440fx-2.6'>hvm</type>
               </os>
-- 
2.29.2
openSUSE Build Service is sponsored by