'except FileNotFoundError' instead of ENOENT check
This commit is contained in:
parent
5aa35a1208
commit
b3983f5ef8
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
import copy
|
import copy
|
||||||
import errno
|
|
||||||
import functools
|
import functools
|
||||||
import grp
|
import grp
|
||||||
import itertools
|
import itertools
|
||||||
@ -1008,8 +1007,8 @@ class Qubes(qubes.PropertyHolder):
|
|||||||
try:
|
try:
|
||||||
fd = os.open(self._store,
|
fd = os.open(self._store,
|
||||||
os.O_RDWR | (os.O_CREAT * int(for_save)))
|
os.O_RDWR | (os.O_CREAT * int(for_save)))
|
||||||
except OSError as e:
|
except FileNotFoundError:
|
||||||
if not for_save and e.errno == errno.ENOENT:
|
if not for_save:
|
||||||
raise qubes.exc.QubesException(
|
raise qubes.exc.QubesException(
|
||||||
'Qubes XML store {!r} is missing; '
|
'Qubes XML store {!r} is missing; '
|
||||||
'use qubes-create tool'.format(self._store))
|
'use qubes-create tool'.format(self._store))
|
||||||
|
@ -24,7 +24,6 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import base64
|
import base64
|
||||||
import errno
|
|
||||||
import grp
|
import grp
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
@ -1461,11 +1460,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
|||||||
try:
|
try:
|
||||||
# TODO: make it async?
|
# TODO: make it async?
|
||||||
shutil.rmtree(self.dir_path)
|
shutil.rmtree(self.dir_path)
|
||||||
except OSError as e:
|
except FileNotFoundError:
|
||||||
if e.errno == errno.ENOENT:
|
pass
|
||||||
pass
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
yield from self.storage.remove()
|
yield from self.storage.remove()
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
Loading…
Reference in New Issue
Block a user