nm: iterate the main context when refresh required
In CI, we noticed nmstate might not able to retried applied config for DHCP interface even with retry. This might caused by outdated cache in `NM.Client` and cache is not refreshed after simple sleep between verification. The fix is iterate the main context till all event processed when refreshing is issued. Signed-off-by: Gris Ge <fge@redhat.com>
This commit is contained in:
parent
ebc8082532
commit
3a9825ffe8
@ -69,6 +69,10 @@ class NmContext:
|
||||
def cancellable(self):
|
||||
return self._cancellable
|
||||
|
||||
def refresh(self):
|
||||
while self.context.iteration(False):
|
||||
pass
|
||||
|
||||
@property
|
||||
def client(self):
|
||||
if self._quitting:
|
||||
|
@ -191,6 +191,8 @@ class NetworkManagerPlugin(NmstatePlugin):
|
||||
|
||||
def refresh_content(self):
|
||||
self.__applied_configs = None
|
||||
if self._ctx:
|
||||
self._ctx.refresh()
|
||||
|
||||
def apply_changes(self, net_state, save_to_disk):
|
||||
NmProfiles(self.context).apply_config(net_state, save_to_disk)
|
||||
|
Loading…
x
Reference in New Issue
Block a user