Skip to content

Commit

Permalink
Merge pull request #699 from lago-project/fix_brctl_fc27
Browse files Browse the repository at this point in the history
brctl: Use "ip" to check if a bridge exists
  • Loading branch information
ovirt-infra authored Mar 21, 2018
2 parents 802e6d1 + cd89b87 commit abf7e9f
Showing 1 changed file with 11 additions and 2 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

0 comments on commit abf7e9f

Please sign in to comment.