From e792b96444a41a6c4e696f7bf9ad6f3c34899ea8 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 23:40:18 +0000 Subject: Apply patch BZ_1859844-fix_converting_memory_only.patch patch_name: BZ_1859844-fix_converting_memory_only.patch present_in_specfile: true location_in_specfile: 6 --- diff --git a/libnmstate/nm/applier.py b/libnmstate/nm/applier.py index 4d40862..26a057f 100644 --- a/libnmstate/nm/applier.py +++ b/libnmstate/nm/applier.py @@ -125,6 +125,7 @@ def apply_changes(context, net_state, save_to_disk): and cur_con_profile and cur_con_profile.profile and not net_state.ifaces[ifname].is_changed + and cur_con_profile.is_memory_only != save_to_disk ): # Don't create new profile if original desire does not ask # anything besides state:up and not been marked as changed. diff --git a/libnmstate/nm/connection.py b/libnmstate/nm/connection.py index 5804f13..1f6c734 100644 --- a/libnmstate/nm/connection.py +++ b/libnmstate/nm/connection.py @@ -163,6 +163,16 @@ class ConnectionProfile: self._con_profile = con_profile @property + def is_memory_only(self): + if self._con_profile: + profile_flags = self._con_profile.get_flags() + return ( + NM.SettingsConnectionFlags.UNSAVED & profile_flags + or NM.SettingsConnectionFlags.VOLATILE & profile_flags + ) + return False + + @property def devname(self): if self._con_profile: return self._con_profile.get_interface_name()