Implementing status.version on FreeBSD

This commit is contained in:
Ahmed Kamal 2015-01-26 21:23:00 +02:00
parent 85e32d1811
commit edd6ee7a90

View File

@ -544,12 +544,19 @@ def version():
salt '*' status.version
'''
procf = '/proc/version'
if not os.path.isfile(procf):
return {}
ret = salt.utils.fopen(procf, 'r').read().strip()
def linux_version():
procf = '/proc/version'
if not os.path.isfile(procf):
return {}
return salt.utils.fopen(procf, 'r').read().strip()
return ret
# dict that return a function that does the right thing per platform
get_version = {
'Linux': linux_version,
'FreeBSD': lambda : __salt__['cmd.run']('sysctl -n kern.version'),
}
return get_version[__grains__['kernel']]()
def master(master_ip=None, connected=True):