daemon: Improve handling node-specific directory names.

This commit is contained in:
Tom Goff 2015-11-23 09:44:34 -05:00
parent a83cf2fcb4
commit ce0bfc88eb
3 changed files with 6 additions and 3 deletions

View file

@ -361,7 +361,8 @@ class JailNode(SimpleJailNode):
def privatedir(self, path):
if path[0] != "/":
raise ValueError, "path not fully qualified: " + path
hostpath = os.path.join(self.nodedir, path[1:].replace("/", "."))
hostpath = os.path.join(self.nodedir,
os.path.normpath(path).strip('/').replace('/', '.'))
try:
os.mkdir(hostpath)
except OSError:

View file

@ -366,7 +366,8 @@ class LxcNode(SimpleLxcNode):
def privatedir(self, path):
if path[0] != "/":
raise ValueError, "path not fully qualified: " + path
hostpath = os.path.join(self.nodedir, path[1:].replace("/", "."))
hostpath = os.path.join(self.nodedir,
os.path.normpath(path).strip('/').replace('/', '.'))
try:
os.mkdir(hostpath)
except OSError:

View file

@ -216,7 +216,8 @@ class PhysicalNode(PyCoreNode):
def privatedir(self, path):
if path[0] != "/":
raise ValueError, "path not fully qualified: " + path
hostpath = os.path.join(self.nodedir, path[1:].replace("/", "."))
hostpath = os.path.join(self.nodedir,
os.path.normpath(path).strip('/').replace('/', '.'))
try:
os.mkdir(hostpath)
except OSError: