summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Ohai.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Server/Plugins/Ohai.py')
-rw-r--r--src/lib/Server/Plugins/Ohai.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/Server/Plugins/Ohai.py b/src/lib/Server/Plugins/Ohai.py
index 6bd3edc34..049aadd4f 100644
--- a/src/lib/Server/Plugins/Ohai.py
+++ b/src/lib/Server/Plugins/Ohai.py
@@ -19,8 +19,18 @@ except:
raise ImportError
-class OhaiCache(object):
+probecode = """#!/bin/sh
+
+if type ohai >& /dev/null; then
+ ohai
+else
+ echo group:ohai-not-installed
+ # an empty dict, so "'foo' in metadata.Ohai" tests succeed
+ echo '{}'
+fi
+"""
+class OhaiCache(object):
def __init__(self, dirname):
self.dirname = dirname
self.cache = dict()
@@ -62,7 +72,7 @@ class Ohai(Bcfg2.Server.Plugin.Plugin,
Bcfg2.Server.Plugin.Connector.__init__(self)
self.probe = lxml.etree.Element('probe', name='Ohai', source='Ohai',
interpreter='/bin/sh')
- self.probe.text = 'ohai'
+ self.probe.text = probecode
try:
os.stat(self.data)
except: