diff options
author | Mike (stew) O'Connor <stew@vireo.org> | 2011-02-20 14:03:56 -0500 |
---|---|---|
committer | Mike (stew) O'Connor <stew@vireo.org> | 2011-02-20 14:03:56 -0500 |
commit | fd7e629e6a34cee030d1602be2a76c290d18e52b (patch) | |
tree | 65aa371dfd393ce0c21a27fa41adef0776cf1d2c /lib | |
parent | 7358997fd51ffb852476ea9f5b68d91cef84ba9a (diff) | |
download | puppet-monkeysphere-fd7e629e6a34cee030d1602be2a76c290d18e52b.tar.gz puppet-monkeysphere-fd7e629e6a34cee030d1602be2a76c290d18e52b.tar.bz2 |
add identity_certifier type
Signed-off-by: Mike (stew) O'Connor <stew@vireo.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/provider/identify_certifier/monkeysphere.rb | 57 | ||||
-rw-r--r-- | lib/puppet/type/identity_certifier.rb | 10 |
2 files changed, 67 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 diff --git a/lib/puppet/type/identity_certifier.rb b/lib/puppet/type/identity_certifier.rb new file mode 100644 index 0000000..cc8295f --- /dev/null +++ b/lib/puppet/type/identity_certifier.rb @@ -0,0 +1,10 @@ +Puppet::Type.newtype(:identity_certifier) do + @doc = "Manage monkeysphere identity-certifiers" + + ensurable + newparam(:pgpid) do + desc "The pgp id of the certifier" + isnamevar + end + +end |