From 457737b6cc16336768797e6f34c70d2b882563f6 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Fri, 7 Jun 2013 05:31:31 +0200 Subject: [PATCH] QubesVm: ignore errors during debug VM config file creation Currently /.conf file is used only for debugging purposes - the real one is passed directly to libvirt, without storing on disk for it. In some cases (e.g. qvm-clone) QubesVM.create_config_file() can be called before VM directory exists and in this case it would fail. Because it isn't critical fail in any means (the config file will be recreated on next occasion) just ignore this error. Final version most likely will have this part of code removed completely. --- core-modules/000QubesVm.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index 7176afce..ef94d778 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -1114,10 +1114,15 @@ class QubesVm(object): # FIXME: This is only for debugging purposes old_umask = os.umask(002) - conf_appvm = open(file_path, "w") - conf_appvm.write(domain_config) - conf_appvm.close() - os.umask(old_umask) + try: + conf_appvm = open(file_path, "w") + conf_appvm.write(domain_config) + conf_appvm.close() + except: + # Ignore errors + pass + finally: + os.umask(old_umask) return domain_config