From 29a44aceb1a73347ac07dd241b4a64a4a38cef6e Mon Sep 17 00:00:00 2001 From: Jeroen Schutrup Date: Sun, 12 Aug 2018 19:43:22 +0200 Subject: [PATCH] Try/except undefineFlags() as this operation is not supported on bhyve --- salt/modules/virt.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/salt/modules/virt.py b/salt/modules/virt.py index 295919f306b9..20d2735a5000 100644 --- a/salt/modules/virt.py +++ b/salt/modules/virt.py @@ -3292,7 +3292,10 @@ def purge(vm_, dirs=False, removables=None, **kwargs): shutil.rmtree(dir_) if getattr(libvirt, 'VIR_DOMAIN_UNDEFINE_NVRAM', False): # This one is only in 1.2.8+ - dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM) + try: + dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM) + except Exception: + dom.undefine() else: dom.undefine() conn.close()