From 27b031c59ff659701eabe6e32cd51765e6b994dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 26 Sep 2013 22:24:58 +0200 Subject: [PATCH] Check for None before calling method (VM rename fix) --- core-modules/000QubesVm.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index dcecc392..8cbfc0e5 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -554,10 +554,12 @@ class QubesVm(object): raise QubesException("Cannot rename VM installed by RPM -- first clone VM and then use yum to remove package.") self.pre_rename(name) - self.libvirt_domain.undefine() + if self.libvirt_domain: + self.libvirt_domain.undefine() self._libvirt_domain = None - self._qdb_connection.close() - self._qdb_connection = None + if self._qdb_connection: + self._qdb_connection.close() + self._qdb_connection = None new_conf = os.path.join(self.dir_path, name + '.conf') if os.path.exists(self.conf_file):