better handling for deleting node directories
This commit is contained in:
parent
4a2810e9b2
commit
164f02e5ac
1 changed files with 6 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
||||||
PyCoreNode and LxcNode classes that implement the network namespac virtual node.
|
PyCoreNode and LxcNode classes that implement the network namespac virtual node.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import errno
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -145,10 +146,11 @@ class SimpleLxcNode(PyCoreNode):
|
||||||
|
|
||||||
# remove node directory if present
|
# remove node directory if present
|
||||||
try:
|
try:
|
||||||
if os.path.exists(self.ctrlchnlname):
|
os.unlink(self.ctrlchnlname)
|
||||||
os.unlink(self.ctrlchnlname)
|
except OSError as e:
|
||||||
except OSError:
|
# no such file or directory
|
||||||
logger.exception("error removing node directory")
|
if e.errno != errno.ENOENT:
|
||||||
|
logger.exception("error removing node directory")
|
||||||
|
|
||||||
# clear interface data, close client, and mark self and not up
|
# clear interface data, close client, and mark self and not up
|
||||||
self._netif.clear()
|
self._netif.clear()
|
||||||
|
|
Loading…
Add table
Reference in a new issue