Revision 595149d5
b/lib/vcluster.py | ||
---|---|---|
142 | 142 |
return _VIRT_HOSTNAME |
143 | 143 |
|
144 | 144 |
|
145 |
def _MakeNodeRoot(base, node_name):
|
|
145 |
def MakeNodeRoot(base, node_name): |
|
146 | 146 |
"""Appends a node name to the base directory. |
147 | 147 |
|
148 | 148 |
""" |
... | ... | |
162 | 162 |
""" |
163 | 163 |
if _basedir: |
164 | 164 |
pure = _RemoveNodePrefix(filename, _noderoot=_noderoot) |
165 |
result = "%s/%s" % (_MakeNodeRoot(_basedir, node_name), pure)
|
|
165 |
result = "%s/%s" % (MakeNodeRoot(_basedir, node_name), pure) |
|
166 | 166 |
else: |
167 | 167 |
result = filename |
168 | 168 |
|
... | ... | |
175 | 175 |
""" |
176 | 176 |
if _basedir: |
177 | 177 |
return { |
178 |
_ROOTDIR_ENVNAME: _MakeNodeRoot(_basedir, hostname),
|
|
178 |
_ROOTDIR_ENVNAME: MakeNodeRoot(_basedir, hostname), |
|
179 | 179 |
_HOSTNAME_ENVNAME: hostname, |
180 | 180 |
} |
181 | 181 |
else: |
b/test/py/ganeti.vcluster_unittest.py | ||
---|---|---|
108 | 108 |
|
109 | 109 |
class TestMakeNodeRoot(unittest.TestCase): |
110 | 110 |
def test(self): |
111 |
self.assertRaises(RuntimeError, vcluster._MakeNodeRoot, "/tmp", "/")
|
|
111 |
self.assertRaises(RuntimeError, vcluster.MakeNodeRoot, "/tmp", "/") |
|
112 | 112 |
|
113 | 113 |
for i in ["/tmp", "/tmp/", "/tmp///"]: |
114 |
self.assertEqual(vcluster._MakeNodeRoot(i, "other.example.com"),
|
|
114 |
self.assertEqual(vcluster.MakeNodeRoot(i, "other.example.com"), |
|
115 | 115 |
"/tmp/other.example.com") |
116 | 116 |
|
117 | 117 |
|
Also available in: Unified diff