Add sanity check for conntrack

Recent mailing-list issue showed we never sanity check
for the conntrack command being installed.

Trivialfix

Change-Id: If7fd8541cdefa3123cc2031683c8139b16576cab
This commit is contained in:
Brian Haley 2017-04-10 16:49:16 -04:00 committed by Brian Haley
parent 991ea0b923
commit 58cbcc13f7
2 changed files with 21 additions and 0 deletions

View File

@ -415,6 +415,17 @@ def ip6tables_supported():
return False
def conntrack_supported():
try:
cmd = ['conntrack', '--version']
agent_utils.execute(cmd)
return True
except (OSError, RuntimeError, IndexError, ValueError) as e:
LOG.debug("Exception while checking for installed conntrack. "
"Exception: %s", e)
return False
def get_minimal_dibbler_version_supported():
return MINIMUM_DIBBLER_VERSION

View File

@ -236,6 +236,14 @@ def check_ip6tables():
return result
def check_conntrack():
result = checks.conntrack_supported()
if not result:
LOG.error(_LE('Cannot run conntrack. Please ensure that it '
'is installed.'))
return result
def check_dhcp_release6():
result = checks.dhcp_release6_supported()
if not result:
@ -312,6 +320,8 @@ OPTS = [
help=_('Check ipset installation')),
BoolOptCallback('ip6tables_installed', check_ip6tables,
help=_('Check ip6tables installation')),
BoolOptCallback('conntrack_installed', check_conntrack,
help=_('Check conntrack installation')),
BoolOptCallback('dhcp_release6', check_dhcp_release6,
help=_('Check dhcp_release6 installation')),
BoolOptCallback('bridge_firewalling', check_bridge_firewalling_enabled,