Skip to content

Commit

Permalink
Merge branch 'master' into download_using_requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaniv Kaul authored Apr 3, 2018
2 parents b831a10 + 8291249 commit a0a5b2b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
13 changes: 11 additions & 2 deletions lago/brctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,14 @@ def destroy(name):


def exists(name):
ret, out, err = _brctl('show', name)
return err == ''
ret, out, _ = utils.run_command(
['ip', '-o', 'link', 'show', 'type', 'bridge']
)
if ret:
raise RuntimeError('Failed to check if bridge {} exists'.format(name))

for entry in out.splitlines():
if name == entry.split(':')[1].strip():
return True

return False
5 changes: 4 additions & 1 deletion lago/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ def do_init(
with log_utils.LogTask('Initialize and populate prefix', LOGGER):
LOGGER.debug('Using workdir %s', workdir)
workdir = lago_workdir.Workdir(workdir)
if not os.path.exists(workdir.path):
if not (
os.path.exists(workdir.path)
and lago.workdir.Workdir.is_workdir(workdir.path)
):
LOGGER.debug(
'Initializing workdir %s with prefix %s',
workdir.path,
Expand Down
2 changes: 2 additions & 0 deletions lago/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def __init__(self, prefix_path):
Args:
prefix_path (str): Path to the directory of the prefix
"""
# self._prefix should be dropped in lago ver 0.44
self.prefix = prefix_path
self._prefix_path = prefix_path

def prefixed(self, *args):
Expand Down
6 changes: 6 additions & 0 deletions lago/prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def __init__(self, prefix):
Args:
prefix (str): Path of the prefix
"""
# self._prefix should be dropped in lago ver 0.44
self._prefix = prefix
self._paths = paths.Paths(prefix)
self._virt_env = None
self._metadata = None
Expand Down Expand Up @@ -1403,6 +1405,10 @@ def virt_env(self):
def paths(self):
return self._paths

@paths.setter
def paths(self, val):
self._paths = val

def destroy(self):
"""
Destroy this prefix, running any cleanups and removing any files
Expand Down

0 comments on commit a0a5b2b

Please sign in to comment.