Adding __salt__ to utils/icinga so cmd.run_all is available.

This commit is contained in:
Gareth J. Greenaway 2019-02-28 08:23:13 -08:00
parent 1fa2072521
commit 233dbaf3c9
No known key found for this signature in database
GPG key ID: 10B62F8A7CAD7A41

View file

@ -14,12 +14,17 @@ import re
# Import Salt libs
import salt.utils.path
import salt.modules.cmdmod
__salt__ = {
'cmd.run_all': salt.modules.cmdmod.run_all
}
log = logging.getLogger(__name__)
def get_certs_path():
icinga2_output = __salt__['cmd.run_all']([salt.utils.path.which('icinga2'), "--version"], python_shell=False)
icinga2_output = __salt__['cmd.run_all']([salt.utils.path.which('icinga2'),
"--version"], python_shell=False)
version = re.search(r'r\d+\.\d+', icinga2_output['stdout']).group(0)
# Return new certs path for icinga2 >= 2.8
if int(version.split('.')[1]) >= 8: