More correct fix for status problem (#41045)

Status is not being determined right when monitors are enabled but
the state is up or down. This patch fixes it.

(cherry picked from commit 033adf8cd5)
This commit is contained in:
Tim Rupp 2018-06-02 19:09:13 -07:00 committed by Matt Clay
parent 205b66ee7c
commit fb3f0a53d9

View file

@ -465,6 +465,8 @@ class ApiParameters(Parameters):
def state(self):
if self._values['state'] in ['user-up', 'unchecked', 'fqdn-up-no-addr'] and self._values['session'] in ['user-enabled']:
return 'present'
elif self._values['state'] in ['down', 'up'] and self._values['session'] == 'monitor-enabled':
return 'present'
elif self._values['state'] in ['user-down'] and self._values['session'] in ['user-disabled']:
return 'forced_offline'
else:
@ -520,6 +522,8 @@ class ReportableChanges(Changes):
def state(self):
if self._values['state'] in ['user-up', 'unchecked', 'fqdn-up-no-addr'] and self._values['session'] in ['user-enabled']:
return 'present'
elif self._values['state'] in ['down', 'up'] and self._values['session'] == 'monitor-enabled':
return 'present'
elif self._values['state'] in ['user-down'] and self._values['session'] in ['user-disabled']:
return 'forced_offline'
else: