Skip to content

Commit a0a5b2b

Browse files
author
Yaniv Kaul
authored
Merge branch 'master' into download_using_requests
2 parents b831a10 + 8291249 commit a0a5b2b

4 files changed

Lines changed: 23 additions & 3 deletions

File tree

lago/brctl.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,14 @@ def destroy(name):
5656

5757

5858
def exists(name):
59-
ret, out, err = _brctl('show', name)
60-
return err == ''
59+
ret, out, _ = utils.run_command(
60+
['ip', '-o', 'link', 'show', 'type', 'bridge']
61+
)
62+
if ret:
63+
raise RuntimeError('Failed to check if bridge {} exists'.format(name))
64+
65+
for entry in out.splitlines():
66+
if name == entry.split(':')[1].strip():
67+
return True
68+
69+
return False

lago/cmd.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ def do_init(
148148
with log_utils.LogTask('Initialize and populate prefix', LOGGER):
149149
LOGGER.debug('Using workdir %s', workdir)
150150
workdir = lago_workdir.Workdir(workdir)
151-
if not os.path.exists(workdir.path):
151+
if not (
152+
os.path.exists(workdir.path)
153+
and lago.workdir.Workdir.is_workdir(workdir.path)
154+
):
152155
LOGGER.debug(
153156
'Initializing workdir %s with prefix %s',
154157
workdir.path,

lago/paths.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ def __init__(self, prefix_path):
3434
Args:
3535
prefix_path (str): Path to the directory of the prefix
3636
"""
37+
# self._prefix should be dropped in lago ver 0.44
38+
self.prefix = prefix_path
3739
self._prefix_path = prefix_path
3840

3941
def prefixed(self, *args):

lago/prefix.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ def __init__(self, prefix):
106106
Args:
107107
prefix (str): Path of the prefix
108108
"""
109+
# self._prefix should be dropped in lago ver 0.44
110+
self._prefix = prefix
109111
self._paths = paths.Paths(prefix)
110112
self._virt_env = None
111113
self._metadata = None
@@ -1403,6 +1405,10 @@ def virt_env(self):
14031405
def paths(self):
14041406
return self._paths
14051407

1408+
@paths.setter
1409+
def paths(self, val):
1410+
self._paths = val
1411+
14061412
def destroy(self):
14071413
"""
14081414
Destroy this prefix, running any cleanups and removing any files

0 commit comments

Comments
 (0)