2012-02-24 08:04:50 +01:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
# requires 'ohai' to be installed
|
|
|
|
|
2012-02-24 08:05:49 +01:00
|
|
|
try:
|
2012-02-25 23:16:23 +01:00
|
|
|
import json
|
2012-02-24 08:05:49 +01:00
|
|
|
except ImportError:
|
2012-02-25 23:16:23 +01:00
|
|
|
import simplejson as json
|
2012-02-24 08:05:49 +01:00
|
|
|
|
2012-02-24 08:04:50 +01:00
|
|
|
import subprocess
|
|
|
|
|
|
|
|
cmd = subprocess.Popen("/usr/bin/ohai", stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
|
out, err = cmd.communicate()
|
|
|
|
|
|
|
|
# try to cleanup the JSON, for some reason facter --json doesn't need this hack
|
|
|
|
print json.dumps(json.loads(out))
|