mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Implementing status.version on FreeBSD
This commit is contained in:
parent
85e32d1811
commit
edd6ee7a90
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user