blob: 49ea6e678e5895eeca328069e4c19c990d982aa4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
|