Merge pull request #3488 from donaldsharp/bsd_topo_abstract1

Bsd topo abstract1
This commit is contained in:
Martin Winter 2018-12-15 23:29:43 +01:00 committed by GitHub
commit 4870191362
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 2 deletions

View File

@ -908,7 +908,7 @@ class TopoExaBGP(TopoHost):
# Disable linter branch warning. It is expected to have these here.
# pylint: disable=R0912
def diagnose_env():
def diagnose_env_linux():
"""
Run diagnostics in the running environment. Returns `True` when everything
is ok, otherwise `False`.
@ -1066,3 +1066,14 @@ def diagnose_env():
logger.removeHandler(fhandler)
return ret
def diagnose_env_freebsd():
return True
def diagnose_env():
if sys.platform.startswith("linux"):
return diagnose_env_linux()
elif sys.platform.startswith("freebsd"):
return diagnose_env_freebsd()
return False

View File

@ -336,7 +336,7 @@ def normalize_text(text):
return text
def module_present(module, load=True):
def module_present_linux(module, load):
"""
Returns whether `module` is present.
@ -352,6 +352,15 @@ def module_present(module, load=True):
else:
return True
def module_present_freebsd(module, load):
return True
def module_present(module, load=True):
if sys.platform.startswith("linux"):
module_present_linux(module, load)
elif sys.platform.startswith("freebsd"):
module_present_freebsd(module, load)
def version_cmp(v1, v2):
"""
Compare two version strings and returns: