aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike (stew) O'Connor <stew@vireo.org>2011-02-17 21:37:27 -0500
committerMike (stew) O'Connor <stew@vireo.org>2011-02-17 21:37:27 -0500
commit3a1ab8b24140e56e96f7176b6fb1d82590fddbcc (patch)
tree938b07fece1a9150c84e3547a531b8e3bc8c4931 /lib
downloadpuppet-monkeysphere-3a1ab8b24140e56e96f7176b6fb1d82590fddbcc.tar.gz
puppet-monkeysphere-3a1ab8b24140e56e96f7176b6fb1d82590fddbcc.tar.bz2
initial commit
Signed-off-by: Mike (stew) O'Connor <stew@vireo.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/facter/monkeysphere.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/facter/monkeysphere.rb b/lib/facter/monkeysphere.rb
new file mode 100644
index 0000000..e3a0a73
--- /dev/null
+++ b/lib/facter/monkeysphere.rb
@@ -0,0 +1,42 @@
+has_hostkey = false
+pgp_fingerprint = ''
+pgp_id = ''
+ssh_fingerprint = ''
+
+if File.exist?('/usr/sbin/monkeysphere-host')
+
+ sk = %x{/usr/sbin/monkeysphere-host show-keys}
+ if $? == 0
+ has_hostkey = true
+ sk.lines.each do |line|
+ m = line.match('^OpenPGP fingerprint:(.*)$')
+ if m
+ pgp_fingerprint = m[1].strip
+ end
+ m = line.match('^uid (.*)$')
+ if m
+ pgp_id = m[1].strip
+ end
+ m = line.match('^ssh fingerprint:(.*)$')
+ if m
+ ssh_fingerprint = m[1].strip
+ end
+ end
+ end
+end
+
+Facter.add("monkeysphere_has_hostkey") do
+ setcode{ has_hostkey }
+end
+
+Facter.add("monkeysphere_pgp_fp") do
+ setcode{ pgp_fingerprint }
+end
+
+Facter.add("monkeysphere_pgp_id") do
+ setcode{ pgp_id }
+end
+
+Facter.add("monkeysphere_ssh_fp") do
+ setcode{ ssh_fingerprint }
+end