aboutsummaryrefslogtreecommitdiff
path: root/lib/puppet/provider/identify_certifier
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2013-01-02 20:55:28 +0100
committermh <mh@immerda.ch>2013-01-02 20:56:27 +0100
commit23398fc3f0178f73fa3dee5149426b1b28ce3a8a (patch)
tree2ab3f84da5aa561fa54bdf71a6ca2bd26655e0bc /lib/puppet/provider/identify_certifier
parent6321144806ec67ff2d5a12df95b00f1250b8fcca (diff)
parentc4913fb3e46624494a0935ec133b25db735afc30 (diff)
downloadpuppet-monkeysphere-23398fc3f0178f73fa3dee5149426b1b28ce3a8a.tar.gz
puppet-monkeysphere-23398fc3f0178f73fa3dee5149426b1b28ce3a8a.tar.bz2
Merge remote-tracking branch 'vireo/master' into merge
Conflicts: .gitignore manifests/init.pp
Diffstat (limited to 'lib/puppet/provider/identify_certifier')
-rw-r--r--lib/puppet/provider/identify_certifier/monkeysphere.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/puppet/provider/identify_certifier/monkeysphere.rb b/lib/puppet/provider/identify_certifier/monkeysphere.rb
new file mode 100644
index 0000000..49ea6e6
--- /dev/null
+++ b/lib/puppet/provider/identify_certifier/monkeysphere.rb
@@ -0,0 +1,57 @@
+##
+
+
+require 'puppet/provider/package'
+require "open3"
+
+Puppet::Type.type(:identity_certifier).provide(:monkeysphere,
+ :parent => Puppet::Provider::Package) do
+
+ commands :monkeysphereauth => "/usr/sbin/monkeysphere-authentication"
+
+ desc "asdf"
+
+ # retrieve the current set of mysql users
+ def self.instances
+ ids = []
+
+ cmd = "#{command(:monkeysphereauth)} list-id-certifiers"
+ execpipe(cmd) do |process|
+ process.each do |line|
+ m = line.match( "^[0-9A-Z]{32}([0-9A-Z]{8}):" )
+ if m
+ ids << new( { :ensure => :present, :pgpid => m.group(1) } )
+ end
+ end
+ end
+ return ids
+ end
+
+ def create
+ Open3.popen3("monkeysphere-authentication add-id-certifier #{resource[:pgpid]}") do |i, o, e|
+ i.puts( "Y" )
+ o.readlines()
+ end
+ end
+
+ def destroy
+ Open3.popen3("monkeysphere-authentication remove-id-certifier #{resource[:pgpid]}") do |i, o, e|
+ i.puts( "Y" )
+ o.readlines()
+ end
+ end
+
+ def exists?
+
+ cil = %x{/usr/sbin/monkeysphere-authentication list-id-certifiers}
+ if $? == 0
+ cil.lines.each do |line|
+ m = line.match( '^[0-9A-Z]*' + resource[:pgpid] + ':' )
+ if m
+ return true
+ end
+ end
+ end
+ return false
+ end
+end