puppet 0.25.4 → 0.25.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +679 -23
- data/LICENSE +2 -2
- data/README +2 -2
- data/README.queueing +1 -1
- data/README.rst +2 -2
- data/Rakefile +4 -2
- data/bin/filebucket +2 -2
- data/bin/pi +1 -1
- data/bin/puppet +2 -2
- data/bin/puppetca +2 -2
- data/bin/puppetd +5 -4
- data/bin/puppetdoc +4 -4
- data/bin/puppetmasterd +2 -2
- data/bin/puppetqd +2 -2
- data/bin/puppetrun +2 -2
- data/bin/ralsh +2 -2
- data/conf/epm.list +2 -2
- data/conf/gentoo/puppet/puppet.conf +0 -4
- data/conf/osx/PackageInfo.plist +1 -1
- data/conf/redhat/logrotate +1 -0
- data/conf/redhat/puppet.conf +0 -4
- data/conf/redhat/puppet.spec +16 -10
- data/conf/solaris/pkginfo +2 -2
- data/conf/solaris/smf/puppetd.xml +3 -3
- data/conf/solaris/smf/puppetmasterd.xml +3 -3
- data/conf/solaris/smf/svc-puppetd +1 -1
- data/conf/solaris/smf/svc-puppetmasterd +1 -1
- data/conf/suse/puppet.spec +16 -14
- data/conf/suse/puppet.suse.patch +16 -0
- data/examples/etc/puppet/fileserver.conf +5 -5
- data/examples/modules/sample-module/README.txt +3 -3
- data/examples/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb +1 -1
- data/ext/extlookup.rb +1 -1
- data/ext/nagios/check_puppet.rb +1 -1
- data/ext/nagios/naggen +2 -2
- data/ext/puppet-test +2 -2
- data/ext/puppetlast +1 -1
- data/ext/puppetstoredconfigclean.rb +1 -1
- data/ext/regexp_nodes/regexp_nodes.rb +4 -4
- data/ext/vim/syntax/puppet.vim +5 -3
- data/install.rb +11 -9
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/puppetd.rb +5 -4
- data/lib/puppet/configurer.rb +38 -31
- data/lib/puppet/defaults.rb +18 -13
- data/lib/puppet/file_serving/fileset.rb +2 -2
- data/lib/puppet/file_serving/terminus_helper.rb +1 -0
- data/lib/puppet/indirector/indirection.rb +20 -13
- data/lib/puppet/network/authstore.rb +3 -3
- data/lib/puppet/network/format_handler.rb +1 -1
- data/lib/puppet/network/handler/fileserver.rb +2 -2
- data/lib/puppet/network/handler/master.rb +1 -1
- data/lib/puppet/network/http_pool.rb +0 -2
- data/lib/puppet/network/http_server/webrick.rb +1 -1
- data/lib/puppet/parser/ast/casestatement.rb +4 -4
- data/lib/puppet/parser/ast/ifstatement.rb +2 -1
- data/lib/puppet/parser/ast/leaf.rb +1 -0
- data/lib/puppet/parser/ast/selector.rb +2 -3
- data/lib/puppet/parser/functions/generate.rb +3 -5
- data/lib/puppet/parser/functions/require.rb +8 -1
- data/lib/puppet/parser/functions/template.rb +1 -1
- data/lib/puppet/parser/lexer.rb +1 -7
- data/lib/puppet/parser/resource.rb +10 -4
- data/lib/puppet/parser/scope.rb +61 -9
- data/lib/puppet/provider/augeas/augeas.rb +23 -7
- data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
- data/lib/puppet/provider/maillist/mailman.rb +2 -2
- data/lib/puppet/provider/package/portage.rb +2 -2
- data/lib/puppet/provider/service/debian.rb +2 -2
- data/lib/puppet/provider/service/redhat.rb +1 -1
- data/lib/puppet/provider/service/smf.rb +4 -1
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +9 -29
- data/lib/puppet/provider/user/user_role_add.rb +1 -1
- data/lib/puppet/reference/configuration.rb +1 -1
- data/lib/puppet/reference/providers.rb +1 -1
- data/lib/puppet/reports/tagmail.rb +1 -0
- data/lib/puppet/resource/catalog.rb +1 -8
- data/lib/puppet/simple_graph.rb +37 -12
- data/lib/puppet/ssl/certificate.rb +2 -3
- data/lib/puppet/ssl/certificate_authority.rb +1 -1
- data/lib/puppet/ssl/host.rb +19 -12
- data/lib/puppet/sslcertificates/ca.rb +5 -6
- data/lib/puppet/transaction.rb +11 -15
- data/lib/puppet/type/augeas.rb +2 -1
- data/lib/puppet/type/exec.rb +1 -1
- data/lib/puppet/type/file.rb +9 -2
- data/lib/puppet/type/file/checksum.rb +2 -1
- data/lib/puppet/type/file/source.rb +4 -4
- data/lib/puppet/type/maillist.rb +10 -0
- data/lib/puppet/type/mount.rb +5 -3
- data/lib/puppet/type/tidy.rb +36 -30
- data/lib/puppet/util/autoload.rb +2 -2
- data/lib/puppet/util/checksums.rb +5 -0
- data/lib/puppet/util/monkey_patches.rb +38 -0
- data/lib/puppet/util/nagios_maker.rb +1 -1
- data/lib/puppet/util/settings.rb +14 -4
- data/lib/puppet/util/suidmanager.rb +26 -2
- data/lib/puppet/util/zaml.rb +318 -0
- data/man/{man8/puppet.conf.8 → man5/puppet.conf.5} +594 -899
- data/man/man8/filebucket.8 +31 -45
- data/man/man8/pi.8 +16 -22
- data/man/man8/puppet.8 +26 -36
- data/man/man8/puppetca.8 +38 -51
- data/man/man8/puppetd.8 +48 -64
- data/man/man8/puppetdoc.8 +37 -48
- data/man/man8/puppetmasterd.8 +24 -32
- data/man/man8/puppetqd.8 +22 -27
- data/man/man8/puppetrun.8 +46 -58
- data/man/man8/ralsh.8 +43 -48
- data/spec/integration/bin/puppetmasterd.rb +20 -9
- data/spec/integration/defaults.rb +4 -0
- data/spec/integration/indirector/certificate/rest.rb +0 -1
- data/spec/integration/indirector/certificate_request/rest.rb +0 -1
- data/spec/integration/indirector/certificate_revocation_list/rest.rb +0 -1
- data/spec/integration/indirector/report/rest.rb +0 -1
- data/spec/integration/indirector/rest.rb +0 -1
- data/spec/integration/parser/functions/require.rb +18 -1
- data/spec/unit/application/filebucket.rb +2 -2
- data/spec/unit/application/puppetd.rb +4 -5
- data/spec/unit/configurer.rb +46 -8
- data/spec/unit/file_serving/fileset.rb +6 -0
- data/spec/unit/file_serving/terminus_helper.rb +10 -0
- data/spec/unit/indirector/indirection.rb +17 -28
- data/spec/unit/network/format_handler.rb +3 -2
- data/spec/unit/network/http_pool.rb +9 -17
- data/spec/unit/parser/ast/casestatement.rb +4 -12
- data/spec/unit/parser/ast/ifstatement.rb +2 -1
- data/spec/unit/parser/ast/leaf.rb +15 -2
- data/spec/unit/parser/ast/selector.rb +4 -12
- data/spec/unit/parser/functions/generate.rb +41 -0
- data/spec/unit/parser/functions/require.rb +23 -2
- data/spec/unit/parser/resource.rb +18 -0
- data/spec/unit/parser/scope.rb +94 -3
- data/spec/unit/provider/augeas/augeas.rb +27 -3
- data/spec/unit/provider/ssh_authorized_key/parsed.rb +30 -19
- data/spec/unit/resource/catalog.rb +16 -39
- data/spec/unit/simple_graph.rb +14 -0
- data/spec/unit/ssl/host.rb +55 -17
- data/spec/unit/type/file.rb +43 -11
- data/spec/unit/type/file/checksum.rb +28 -0
- data/spec/unit/type/tidy.rb +30 -1
- data/spec/unit/util/autoload.rb +2 -1
- data/spec/unit/util/checksums.rb +7 -1
- data/spec/unit/util/settings.rb +39 -2
- data/spec/unit/util/zaml.rb +38 -0
- data/tasks/rake/changelog.rake +1 -1
- data/tasks/rake/gem.rake +3 -3
- data/tasks/rake/git_workflow.rake +1 -1
- data/tasks/rake/sign.rake +1 -1
- data/tasks/rake/yard.rake +11 -0
- data/test/certmgr/certmgr.rb +1 -1
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +1 -1
- data/test/lib/puppettest/support/utils.rb +2 -1
- data/test/network/handler/ca.rb +4 -4
- data/test/network/handler/fileserver.rb +15 -9
- data/test/other/transactions.rb +1 -6
- data/test/puppet/tc_suidmanager.rb +7 -2
- data/test/ral/providers/host/parsed.rb +6 -6
- data/test/ral/providers/package.rb +4 -0
- data/test/ral/providers/sshkey/parsed.rb +5 -5
- data/test/ral/type/file.rb +0 -21
- data/test/ral/type/host.rb +4 -4
- data/test/ral/type/resources.rb +0 -78
- data/test/ral/type/sshkey.rb +2 -2
- data/test/test +1 -1
- data/test/util/settings.rb +6 -6
- metadata +1065 -1050
- data/test/executables/puppetmodule.rb +0 -55
- data/test/ral/providers/service/debian.rb +0 -58
@@ -39,6 +39,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do
|
|
39
39
|
"match" => [ :path, :glob ],
|
40
40
|
"size" => [:comparator, :int],
|
41
41
|
"include" => [:string],
|
42
|
+
"not_include" => [:string],
|
42
43
|
"==" => [:glob],
|
43
44
|
"!=" => [:glob]
|
44
45
|
}
|
@@ -81,18 +82,24 @@ Puppet::Type.type(:augeas).provide(:augeas) do
|
|
81
82
|
if f == :path
|
82
83
|
start = sc.pos
|
83
84
|
nbracket = 0
|
85
|
+
inSingleTick = false
|
86
|
+
inDoubleTick = false
|
84
87
|
begin
|
85
|
-
sc.skip(/([^\]\[\s\\]|\\.)+/)
|
88
|
+
sc.skip(/([^\]\[\s\\'"]|\\.)+/)
|
86
89
|
ch = sc.getch
|
87
90
|
nbracket += 1 if ch == "["
|
88
91
|
nbracket -= 1 if ch == "]"
|
92
|
+
inSingleTick = !inSingleTick if ch == "'"
|
93
|
+
inDoubleTick = !inDoubleTick if ch == "\""
|
89
94
|
fail("unmatched [") if nbracket < 0
|
90
|
-
end until nbracket == 0 &&
|
95
|
+
end until ((nbracket == 0 && !inSingleTick && !inDoubleTick && (ch =~ /\s/)) || sc.eos?)
|
91
96
|
len = sc.pos - start
|
92
97
|
len -= 1 unless sc.eos?
|
93
98
|
unless p = sc.string[start, len]
|
94
99
|
fail("missing path argument #{narg} for #{cmd}")
|
95
100
|
end
|
101
|
+
# Rip off any ticks if they are there.
|
102
|
+
p = p[1, (p.size - 2)] if p[0,1] == "'" || p[0,1] == "\""
|
96
103
|
p.chomp!("/")
|
97
104
|
if p[0,1] != "$" && p[0,1] != "/"
|
98
105
|
argline << context + p
|
@@ -196,6 +203,8 @@ Puppet::Type.type(:augeas).provide(:augeas) do
|
|
196
203
|
|
197
204
|
#Get the values from augeas
|
198
205
|
result = @aug.match(path) || []
|
206
|
+
fail("Error trying to match path '#{path}'") if (result == -1)
|
207
|
+
|
199
208
|
# Now do the work
|
200
209
|
case verb
|
201
210
|
when "size"
|
@@ -206,6 +215,9 @@ Puppet::Type.type(:augeas).provide(:augeas) do
|
|
206
215
|
when "include"
|
207
216
|
arg = clause_array.shift
|
208
217
|
return_value = result.include?(arg)
|
218
|
+
when "not_include"
|
219
|
+
arg = clause_array.shift
|
220
|
+
return_value = !result.include?(arg)
|
209
221
|
when "=="
|
210
222
|
begin
|
211
223
|
arg = clause_array.shift
|
@@ -272,7 +284,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do
|
|
272
284
|
save_result = @aug.save
|
273
285
|
saved_files = @aug.match("/augeas/events/saved")
|
274
286
|
if save_result and not files_changed?
|
275
|
-
debug("Skipping
|
287
|
+
debug("Skipping because no files were changed")
|
276
288
|
return_value = false
|
277
289
|
else
|
278
290
|
debug("Files changed, should execute")
|
@@ -317,13 +329,16 @@ Puppet::Type.type(:augeas).provide(:augeas) do
|
|
317
329
|
case command
|
318
330
|
when "set"
|
319
331
|
debug("sending command '#{command}' with params #{cmd_array.inspect}")
|
320
|
-
aug.set(cmd_array[0], cmd_array[1])
|
332
|
+
rv = aug.set(cmd_array[0], cmd_array[1])
|
333
|
+
fail("Error sending command '#{command}' with params #{cmd_array.inspect}") if (!rv)
|
321
334
|
when "rm", "remove"
|
322
335
|
debug("sending command '#{command}' with params #{cmd_array.inspect}")
|
323
|
-
aug.rm(cmd_array[0])
|
336
|
+
rv = aug.rm(cmd_array[0])
|
337
|
+
fail("Error sending command '#{command}' with params #{cmd_array.inspect}") if (rv == -1)
|
324
338
|
when "clear"
|
325
339
|
debug("sending command '#{command}' with params #{cmd_array.inspect}")
|
326
|
-
|
340
|
+
rv = aug.clear(cmd_array[0])
|
341
|
+
fail("Error sending command '#{command}' with params #{cmd_array.inspect}") if (!rv)
|
327
342
|
when "insert", "ins"
|
328
343
|
label = cmd_array[0]
|
329
344
|
where = cmd_array[1]
|
@@ -334,7 +349,8 @@ Puppet::Type.type(:augeas).provide(:augeas) do
|
|
334
349
|
else fail("Invalid value '#{where}' for where param")
|
335
350
|
end
|
336
351
|
debug("sending command '#{command}' with params #{[label, where, path].inspect}")
|
337
|
-
aug.insert(path, label, before)
|
352
|
+
rv = aug.insert(path, label, before)
|
353
|
+
fail("Error sending command '#{command}' with params #{cmd_array.inspect}") if (rv == -1)
|
338
354
|
else fail("Command '#{command}' is not supported")
|
339
355
|
end
|
340
356
|
rescue SystemExit,NoMemoryError
|
@@ -15,7 +15,7 @@ Puppet::Type.type(:macauthorization).provide :macauthorization, :parent => Puppe
|
|
15
15
|
confine :operatingsystem => :darwin
|
16
16
|
|
17
17
|
# This should be confined based on macosx_productversion once
|
18
|
-
# http://projects.
|
18
|
+
# http://projects.puppetlabs.com/issues/show/1796
|
19
19
|
# is resolved.
|
20
20
|
if FileTest.exists?("/usr/bin/sw_vers")
|
21
21
|
product_version = sw_vers "-productVersion"
|
@@ -67,7 +67,7 @@ Puppet::Type.type(:maillist).provide(:mailman) do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
# Delete the list.
|
70
|
-
def
|
70
|
+
def destroy(purge = false)
|
71
71
|
args = []
|
72
72
|
if purge
|
73
73
|
args << "--archives"
|
@@ -99,7 +99,7 @@ Puppet::Type.type(:maillist).provide(:mailman) do
|
|
99
99
|
|
100
100
|
# Remove the list and its archives.
|
101
101
|
def purge
|
102
|
-
|
102
|
+
destroy(true)
|
103
103
|
end
|
104
104
|
|
105
105
|
# Pull the current state of the list from the full list. We're
|
@@ -12,7 +12,7 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
12
12
|
defaultfor :operatingsystem => :gentoo
|
13
13
|
|
14
14
|
def self.instances
|
15
|
-
result_format =
|
15
|
+
result_format = /^(\S+)\s+(\S+)\s+\[(\S+)\]\s+\[(\S+)\]\s+(\S+)\s+(.*)$/
|
16
16
|
result_fields = [:category, :name, :ensure, :version_available, :vendor, :description]
|
17
17
|
|
18
18
|
version_format = "{last}<version>{}"
|
@@ -72,7 +72,7 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def query
|
75
|
-
result_format =
|
75
|
+
result_format = /^(\S+)\s+(\S+)\s+\[(\S*)\]\s+\[(\S+)\]\s+(\S+)\s+(.*)$/
|
76
76
|
result_fields = [:category, :name, :ensure, :version_available, :vendor, :description]
|
77
77
|
|
78
78
|
version_format = "{last}<version>{}"
|
@@ -10,7 +10,7 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
|
|
10
10
|
|
11
11
|
commands :update_rc => "/usr/sbin/update-rc.d"
|
12
12
|
# note this isn't being used as a command until
|
13
|
-
# http://projects.
|
13
|
+
# http://projects.puppetlabs.com/issues/2538
|
14
14
|
# is resolved.
|
15
15
|
commands :invoke_rc => "/usr/sbin/invoke-rc.d"
|
16
16
|
|
@@ -28,7 +28,7 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
|
|
28
28
|
|
29
29
|
def enabled?
|
30
30
|
# TODO: Replace system() call when Puppet::Util.execute gives us a way
|
31
|
-
# to determine exit status. http://projects.
|
31
|
+
# to determine exit status. http://projects.puppetlabs.com/issues/2538
|
32
32
|
system("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start")
|
33
33
|
|
34
34
|
# 104 is the exit status when you query start an enabled service.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Manage Red Hat services. Start/stop uses /sbin/service and enable/disable uses chkconfig
|
2
2
|
|
3
|
-
Puppet::Type.type(:service).provide :redhat, :parent => :init do
|
3
|
+
Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init do
|
4
4
|
desc "Red Hat's (and probably many others) form of ``init``-style service management:
|
5
5
|
|
6
6
|
Uses ``chkconfig`` for service enabling and disabling.
|
@@ -70,7 +70,10 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
begin
|
73
|
-
state
|
73
|
+
# get the current state and the next state, and if the next
|
74
|
+
# state is set (i.e. not "-") use it for state comparison
|
75
|
+
states = svcs("-H", "-o", "state,nstate", @resource[:name]).chomp.split
|
76
|
+
state = states[1] == "-" ? states[0] : states[1]
|
74
77
|
rescue Puppet::ExecutionFailure
|
75
78
|
info "Could not get status on service %s" % self.name
|
76
79
|
return :stopped
|
@@ -62,36 +62,16 @@ Puppet::Type.type(:ssh_authorized_key).provide(:parsed,
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def flush
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
if not File.exist? dir
|
72
|
-
Puppet.debug("Creating directory %s which did not exist" % dir)
|
73
|
-
Dir.mkdir(dir, dir_perm)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# Generate the file
|
78
|
-
super
|
79
|
-
|
80
|
-
# Ensure correct permissions
|
81
|
-
if target and user
|
82
|
-
uid = Puppet::Util.uid(user)
|
83
|
-
|
84
|
-
if uid
|
85
|
-
File.chown(uid, nil, dir)
|
86
|
-
File.chown(uid, nil, target)
|
87
|
-
else
|
88
|
-
raise Puppet::Error, "Specified user does not exist"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
if target
|
93
|
-
File.chmod(file_perm, target)
|
65
|
+
raise Puppet::Error, "Cannot write SSH authorized keys without user" unless user
|
66
|
+
raise Puppet::Error, "User '#{user}' does not exist" unless uid = Puppet::Util.uid(user)
|
67
|
+
unless File.exist?(dir = File.dirname(target))
|
68
|
+
Puppet.debug "Creating #{dir}"
|
69
|
+
Dir.mkdir(dir, dir_perm)
|
70
|
+
File.chown(uid, nil, dir)
|
94
71
|
end
|
72
|
+
Puppet::Util::SUIDManager.asuser(user) { super }
|
73
|
+
File.chown(uid, nil, target)
|
74
|
+
File.chmod(file_perm, target)
|
95
75
|
end
|
96
76
|
|
97
77
|
# parse sshv2 option strings, wich is a comma separated list of
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'puppet/util/user_attr'
|
2
2
|
|
3
|
-
Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd do
|
3
|
+
Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source => :useradd do
|
4
4
|
|
5
5
|
desc "User management inherits ``useradd`` and adds logic to manage roles on Solaris using roleadd."
|
6
6
|
|
@@ -96,7 +96,7 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
|
|
96
96
|
|
97
97
|
ret += h(type.name.to_s + "_", 2)
|
98
98
|
|
99
|
-
ret += ".. _%s: %s\n\n" % [type.name, "http://
|
99
|
+
ret += ".. _%s: %s\n\n" % [type.name, "http://puppetlabs.com/trac/puppet/wiki/TypeReference#%s" % type.name]
|
100
100
|
ret += option("Default provider", default)
|
101
101
|
ret += doctable(headers, table_data)
|
102
102
|
|
@@ -16,7 +16,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
16
16
|
class DuplicateResourceError < Puppet::Error; end
|
17
17
|
|
18
18
|
extend Puppet::Indirector
|
19
|
-
indirects :catalog, :
|
19
|
+
indirects :catalog, :terminus_setting => :catalog_terminus
|
20
20
|
|
21
21
|
include Puppet::Util::Tagging
|
22
22
|
extend Puppet::Util::Pson
|
@@ -160,7 +160,6 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
160
160
|
ensure
|
161
161
|
@applying = false
|
162
162
|
cleanup()
|
163
|
-
transaction.cleanup if defined? transaction and transaction
|
164
163
|
end
|
165
164
|
|
166
165
|
# Are we in the middle of applying the catalog?
|
@@ -508,12 +507,6 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
508
507
|
private
|
509
508
|
|
510
509
|
def cleanup
|
511
|
-
unless @transient_resources.empty?
|
512
|
-
remove_resource(*@transient_resources)
|
513
|
-
@transient_resources.clear
|
514
|
-
@relationship_graph = nil
|
515
|
-
end
|
516
|
-
|
517
510
|
# Expire any cached data the resources are keeping.
|
518
511
|
expire()
|
519
512
|
end
|
data/lib/puppet/simple_graph.rb
CHANGED
@@ -64,6 +64,14 @@ class Puppet::SimpleGraph
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
+
def each_out_edges
|
68
|
+
@adjacencies[:out].values.each do |edges|
|
69
|
+
edges.each do |edge|
|
70
|
+
yield edge
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
67
75
|
# The other vertex in the edge.
|
68
76
|
def other_vertex(direction, edge)
|
69
77
|
case direction
|
@@ -146,20 +154,37 @@ class Puppet::SimpleGraph
|
|
146
154
|
# Collect all of the edges that the passed events match. Returns
|
147
155
|
# an array of edges.
|
148
156
|
def matching_edges(events, base = nil)
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
157
|
+
# collect edges out from sources
|
158
|
+
if base
|
159
|
+
# consider only edges which are not pointing to any event sources
|
160
|
+
# which is what a recursive file resources produces
|
161
|
+
event_sources = events.inject({}) { |hash, event| hash[event.source] = event.source ; hash}
|
162
|
+
edges = (adjacent(base, :direction => :out, :type => :edges) - event_sources.keys)
|
163
|
+
else
|
164
|
+
edges = events.inject([]) do |edges,event|
|
165
|
+
if wrapper = @vertices[event.source]
|
166
|
+
wrapper.each_out_edges do |edge|
|
167
|
+
edges << edge
|
168
|
+
end
|
169
|
+
else
|
170
|
+
Puppet.warning "Got an event from invalid #{event.source.ref}"
|
171
|
+
end
|
172
|
+
edges
|
155
173
|
end
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
174
|
+
end
|
175
|
+
|
176
|
+
# find all the different event names, we assume there won't be that many
|
177
|
+
# which should greatly shorten the next loop and reduce the cross-join
|
178
|
+
# between events x out-edges
|
179
|
+
event_names = events.inject({}) { |hash, event| hash[event.name] = event.name ; hash }
|
180
|
+
|
181
|
+
# match all our events to the edges
|
182
|
+
event_names.keys.inject([]) do |matching, event_name|
|
183
|
+
edges.each do |edge|
|
184
|
+
matching << edge if edge.match?(event_name)
|
161
185
|
end
|
162
|
-
|
186
|
+
matching
|
187
|
+
end
|
163
188
|
end
|
164
189
|
|
165
190
|
# Return a reversed version of this graph.
|
@@ -28,8 +28,7 @@ class Puppet::SSL::Certificate < Puppet::SSL::Base
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def expiration
|
31
|
-
|
32
|
-
|
33
|
-
[(content and content.not_after), cache_expiration].compact.sort.first
|
31
|
+
return nil unless content
|
32
|
+
return content.not_after
|
34
33
|
end
|
35
34
|
end
|
@@ -284,7 +284,7 @@ class Puppet::SSL::CertificateAuthority
|
|
284
284
|
store.add_file Puppet[:cacert]
|
285
285
|
store.add_crl crl.content if self.crl
|
286
286
|
store.purpose = OpenSSL::X509::PURPOSE_SSL_CLIENT
|
287
|
-
store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK
|
287
|
+
store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK if Puppet.settings[:certificate_revocation]
|
288
288
|
|
289
289
|
unless store.verify(cert.content)
|
290
290
|
raise CertificateVerificationError.new(store.error), store.error_string
|
data/lib/puppet/ssl/host.rb
CHANGED
@@ -154,19 +154,26 @@ class Puppet::SSL::Host
|
|
154
154
|
end
|
155
155
|
|
156
156
|
def certificate
|
157
|
-
@certificate
|
157
|
+
unless @certificate
|
158
|
+
generate_key unless key
|
159
|
+
|
158
160
|
# get the CA cert first, since it's required for the normal cert
|
159
161
|
# to be of any use.
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
Puppet
|
165
|
-
nil
|
166
|
-
else
|
167
|
-
cert
|
162
|
+
return nil unless Certificate.find("ca") unless ca?
|
163
|
+
return nil unless @certificate = Certificate.find(name)
|
164
|
+
|
165
|
+
unless certificate_matches_key?
|
166
|
+
raise Puppet::Error, "Retrieved certificate does not match private key; please remove certificate from server and regenerate it with the current key"
|
168
167
|
end
|
169
|
-
|
168
|
+
end
|
169
|
+
@certificate
|
170
|
+
end
|
171
|
+
|
172
|
+
def certificate_matches_key?
|
173
|
+
return false unless key
|
174
|
+
return false unless certificate
|
175
|
+
|
176
|
+
return certificate.content.check_private_key(key.content)
|
170
177
|
end
|
171
178
|
|
172
179
|
# Generate all necessary parts of our ssl host.
|
@@ -206,7 +213,7 @@ class Puppet::SSL::Host
|
|
206
213
|
|
207
214
|
# If there's a CRL, add it to our store.
|
208
215
|
if crl = Puppet::SSL::CertificateRevocationList.find("ca")
|
209
|
-
@ssl_store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK
|
216
|
+
@ssl_store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK if Puppet.settings[:certificate_revocation]
|
210
217
|
@ssl_store.add_crl(crl.content)
|
211
218
|
end
|
212
219
|
return @ssl_store
|
@@ -225,7 +232,7 @@ class Puppet::SSL::Host
|
|
225
232
|
rescue Exception => detail
|
226
233
|
Puppet.err "Could not request certificate: %s" % detail.to_s
|
227
234
|
if time < 1
|
228
|
-
puts "Exiting; failed to retrieve certificate and
|
235
|
+
puts "Exiting; failed to retrieve certificate and waitforcert is disabled"
|
229
236
|
exit(1)
|
230
237
|
else
|
231
238
|
sleep(time)
|
@@ -278,13 +278,12 @@ class Puppet::SSLCertificates::CA
|
|
278
278
|
host = thing2name(csr)
|
279
279
|
|
280
280
|
csrfile = host2csrfile(host)
|
281
|
-
|
282
|
-
|
281
|
+
if File.exists?(csrfile)
|
282
|
+
raise Puppet::Error, "Certificate request for %s already exists" % host
|
283
|
+
end
|
283
284
|
|
284
|
-
|
285
|
-
|
286
|
-
Puppet.notice "Removing previously signed certificate #{certfile} for #{host}"
|
287
|
-
Puppet::SSLCertificates::Inventory::rebuild
|
285
|
+
Puppet.settings.writesub(:csrdir, csrfile) do |f|
|
286
|
+
f.print csr.to_pem
|
288
287
|
end
|
289
288
|
end
|
290
289
|
|