puppet 0.25.0 → 0.25.1
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 +4772 -19114
- data/README +1 -1
- data/Rakefile +7 -25
- data/{sbin → bin}/puppetca +0 -0
- data/{sbin → bin}/puppetd +0 -0
- data/{sbin → bin}/puppetmasterd +0 -0
- data/{sbin → bin}/puppetqd +0 -0
- data/{sbin → bin}/puppetrun +0 -0
- data/conf/osx/createpackage.sh +1 -1
- data/conf/redhat/client.init +6 -3
- data/conf/redhat/puppet.spec +26 -14
- data/conf/redhat/server.init +3 -2
- data/ext/vim/syntax/puppet.vim +4 -1
- data/install.rb +25 -7
- data/lib/puppet.rb +1 -1
- data/lib/puppet/agent.rb +2 -2
- data/lib/puppet/application/puppet.rb +3 -3
- data/lib/puppet/application/puppetd.rb +0 -7
- data/lib/puppet/application/puppetdoc.rb +1 -0
- data/lib/puppet/application/puppetmasterd.rb +2 -2
- data/lib/puppet/configurer.rb +6 -1
- data/lib/puppet/configurer/fact_handler.rb +2 -2
- data/lib/puppet/defaults.rb +2 -2
- data/lib/puppet/external/nagios/base.rb +4 -3
- data/lib/puppet/external/pson/common.rb +367 -0
- data/lib/puppet/external/pson/pure.rb +77 -0
- data/lib/puppet/external/pson/pure/generator.rb +429 -0
- data/lib/puppet/external/pson/pure/parser.rb +269 -0
- data/lib/puppet/external/pson/version.rb +8 -0
- data/lib/puppet/feature/pson.rb +6 -0
- data/lib/puppet/feature/rails.rb +1 -5
- data/lib/puppet/file_serving/configuration.rb +2 -2
- data/lib/puppet/indirector/certificate/rest.rb +6 -0
- data/lib/puppet/indirector/facts/facter.rb +1 -1
- data/lib/puppet/indirector/ldap.rb +1 -1
- data/lib/puppet/indirector/queue.rb +3 -3
- data/lib/puppet/indirector/rest.rb +1 -1
- data/lib/puppet/network/authstore.rb +34 -53
- data/lib/puppet/network/formats.rb +59 -9
- data/lib/puppet/network/http/mongrel/rest.rb +10 -9
- data/lib/puppet/network/http/webrick.rb +8 -1
- data/lib/puppet/network/http/webrick/rest.rb +2 -5
- data/lib/puppet/network/http_server/webrick.rb +1 -4
- data/lib/puppet/parser/ast/leaf.rb +1 -3
- data/lib/puppet/parser/collector.rb +14 -8
- data/lib/puppet/parser/compiler.rb +7 -0
- data/lib/puppet/parser/functions/fqdn_rand.rb +4 -10
- data/lib/puppet/parser/functions/regsubst.rb +44 -30
- data/lib/puppet/parser/functions/require.rb +18 -3
- data/lib/puppet/parser/functions/versioncmp.rb +1 -1
- data/lib/puppet/parser/interpreter.rb +1 -1
- data/lib/puppet/parser/lexer.rb +29 -31
- data/lib/puppet/parser/loaded_code.rb +4 -0
- data/lib/puppet/parser/parser_support.rb +5 -2
- data/lib/puppet/parser/resource.rb +31 -6
- data/lib/puppet/property.rb +3 -2
- data/lib/puppet/provider/macauthorization/macauthorization.rb +14 -14
- data/lib/puppet/provider/package/dpkg.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +15 -5
- data/lib/puppet/provider/package/rug.rb +1 -1
- data/lib/puppet/provider/package/up2date.rb +1 -1
- data/lib/puppet/provider/package/urpmi.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +7 -10
- data/lib/puppet/provider/service/runit.rb +7 -17
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +7 -47
- data/lib/puppet/provider/zone/solaris.rb +12 -3
- data/lib/puppet/relationship.rb +12 -12
- data/lib/puppet/reports/rrdgraph.rb +1 -1
- data/lib/puppet/reports/store.rb +2 -2
- data/lib/puppet/reports/tagmail.rb +5 -16
- data/lib/puppet/resource.rb +15 -20
- data/lib/puppet/resource/catalog.rb +40 -29
- data/lib/puppet/ssl/certificate_revocation_list.rb +0 -2
- data/lib/puppet/ssl/host.rb +2 -3
- data/lib/puppet/sslcertificates/ca.rb +0 -5
- data/lib/puppet/type/cron.rb +1 -1
- data/lib/puppet/type/file/owner.rb +7 -4
- data/lib/puppet/type/resources.rb +17 -17
- data/lib/puppet/type/yumrepo.rb +10 -3
- data/lib/puppet/util.rb +6 -11
- data/lib/puppet/util/inifile.rb +8 -0
- data/lib/puppet/util/log.rb +2 -2
- data/lib/puppet/util/monkey_patches.rb +0 -43
- data/lib/puppet/util/{json.rb → pson.rb} +6 -6
- data/lib/puppet/util/rdoc.rb +5 -3
- data/lib/puppet/util/selinux.rb +12 -6
- data/lib/puppet/util/settings.rb +25 -16
- data/lib/puppet/util/settings/file_setting.rb +4 -2
- data/spec/integration/application/puppet.rb +4 -4
- data/spec/integration/defaults.rb +2 -2
- data/spec/integration/indirector/catalog/queue.rb +5 -5
- data/spec/integration/indirector/certificate/rest.rb +3 -1
- data/spec/integration/network/formats.rb +36 -36
- data/spec/integration/parser/functions/require.rb +5 -3
- data/spec/integration/provider/mailalias/aliases.rb +4 -4
- data/spec/integration/resource/catalog.rb +4 -4
- data/spec/unit/application/puppet.rb +16 -15
- data/spec/unit/application/puppetd.rb +1 -1
- data/spec/unit/application/puppetdoc.rb +6 -0
- data/spec/unit/application/puppetmasterd.rb +6 -6
- data/spec/unit/configurer/fact_handler.rb +3 -3
- data/spec/unit/file_serving/configuration.rb +16 -2
- data/spec/unit/indirector/certificate/rest.rb +34 -0
- data/spec/unit/indirector/queue.rb +15 -15
- data/spec/unit/indirector/rest.rb +31 -9
- data/spec/unit/network/authstore.rb +105 -26
- data/spec/unit/network/formats.rb +124 -39
- data/spec/unit/parser/ast/leaf.rb +15 -0
- data/spec/unit/parser/collector.rb +20 -9
- data/spec/unit/parser/compiler.rb +19 -0
- data/spec/unit/parser/functions/fqdn_rand.rb +62 -0
- data/spec/unit/parser/functions/regsubst.rb +80 -0
- data/spec/unit/parser/functions/require.rb +19 -7
- data/spec/unit/parser/interpreter.rb +2 -2
- data/spec/unit/parser/lexer.rb +32 -7
- data/spec/unit/parser/loaded_code.rb +18 -1
- data/spec/unit/parser/parser.rb +10 -2
- data/spec/unit/parser/resource.rb +53 -2
- data/spec/unit/parser/scope.rb +1 -1
- data/spec/unit/property.rb +14 -4
- data/spec/unit/provider/package/dpkg.rb +7 -0
- data/spec/unit/provider/service/daemontools.rb +19 -2
- data/spec/unit/provider/service/redhat.rb +2 -0
- data/spec/unit/provider/service/runit.rb +15 -4
- data/spec/unit/provider/ssh_authorized_key/parsed.rb +32 -55
- data/spec/unit/relationship.rb +21 -46
- data/spec/unit/resource.rb +30 -39
- data/spec/unit/resource/catalog.rb +66 -51
- data/spec/unit/ssl/certificate_revocation_list.rb +0 -12
- data/spec/unit/type/cron.rb +33 -0
- data/spec/unit/type/file/owner.rb +10 -4
- data/spec/unit/util/json.rb +9 -9
- data/spec/unit/util/log.rb +36 -0
- data/spec/unit/util/settings.rb +6 -0
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys2 +1 -0
- data/test/lib/puppettest/support/utils.rb +8 -16
- metadata +36 -13
- data/lib/puppet/feature/json.rb +0 -2
@@ -156,11 +156,16 @@ Puppet::Type.type(:zone).provide(:solaris) do
|
|
156
156
|
def start
|
157
157
|
# Check the sysidcfg stuff
|
158
158
|
if cfg = @resource[:sysidcfg]
|
159
|
-
|
159
|
+
zoneetc = File.join(@resource[:path], "root", "etc")
|
160
|
+
sysidcfg = File.join(zoneetc, "sysidcfg")
|
160
161
|
|
161
|
-
|
162
|
+
# if the zone root isn't present "ready" the zone
|
163
|
+
# which makes zoneadmd mount the zone root
|
164
|
+
zoneadm :ready unless File.directory?(zoneetc)
|
165
|
+
|
166
|
+
unless File.exists?(sysidcfg)
|
162
167
|
begin
|
163
|
-
File.open(
|
168
|
+
File.open(sysidcfg, "w", 0600) do |f|
|
164
169
|
f.puts cfg
|
165
170
|
end
|
166
171
|
rescue => detail
|
@@ -193,6 +198,10 @@ Puppet::Type.type(:zone).provide(:solaris) do
|
|
193
198
|
main
|
194
199
|
end
|
195
200
|
|
201
|
+
def ready
|
202
|
+
zoneadm :ready
|
203
|
+
end
|
204
|
+
|
196
205
|
def stop
|
197
206
|
zoneadm :halt
|
198
207
|
end
|
data/lib/puppet/relationship.rb
CHANGED
@@ -6,26 +6,26 @@
|
|
6
6
|
# subscriptions are permanent associations determining how different
|
7
7
|
# objects react to an event
|
8
8
|
|
9
|
-
require 'puppet/util/
|
9
|
+
require 'puppet/util/pson'
|
10
10
|
|
11
11
|
# This is Puppet's class for modeling edges in its configuration graph.
|
12
12
|
# It used to be a subclass of GRATR::Edge, but that class has weird hash
|
13
13
|
# overrides that dramatically slow down the graphing.
|
14
14
|
class Puppet::Relationship
|
15
|
-
extend Puppet::Util::
|
15
|
+
extend Puppet::Util::Pson
|
16
16
|
attr_accessor :source, :target, :callback
|
17
17
|
|
18
18
|
attr_reader :event
|
19
19
|
|
20
|
-
def self.
|
21
|
-
source =
|
22
|
-
target =
|
20
|
+
def self.from_pson(pson)
|
21
|
+
source = pson["source"]
|
22
|
+
target = pson["target"]
|
23
23
|
|
24
24
|
args = {}
|
25
|
-
if event =
|
25
|
+
if event = pson["event"]
|
26
26
|
args[:event] = event
|
27
27
|
end
|
28
|
-
if callback =
|
28
|
+
if callback = pson["callback"]
|
29
29
|
args[:callback] = callback
|
30
30
|
end
|
31
31
|
|
@@ -73,7 +73,7 @@ class Puppet::Relationship
|
|
73
73
|
"%s => %s" % [source, target]
|
74
74
|
end
|
75
75
|
|
76
|
-
def
|
76
|
+
def to_pson_data_hash
|
77
77
|
data = {
|
78
78
|
'source' => source.to_s,
|
79
79
|
'target' => target.to_s
|
@@ -83,11 +83,11 @@ class Puppet::Relationship
|
|
83
83
|
next unless value = send(attr)
|
84
84
|
data[attr] = value
|
85
85
|
end
|
86
|
+
data
|
87
|
+
end
|
86
88
|
|
87
|
-
|
88
|
-
|
89
|
-
'data' => data
|
90
|
-
}.to_json(*args)
|
89
|
+
def to_pson(*args)
|
90
|
+
to_pson_data_hash.to_pson(*args)
|
91
91
|
end
|
92
92
|
|
93
93
|
def to_s
|
@@ -104,7 +104,7 @@ Puppet::Reports.register_report(:rrdgraph) do
|
|
104
104
|
unless File.directory?(hostdir) and FileTest.writable?(hostdir)
|
105
105
|
# Some hackishness to create the dir with all of the right modes and ownership
|
106
106
|
config = Puppet::Util::Settings.new
|
107
|
-
config.setdefaults(:reports, :hostdir => {:default => hostdir, :owner =>
|
107
|
+
config.setdefaults(:reports, :hostdir => {:default => hostdir, :owner => 'service', :mode => 0755, :group => 'service', :desc => "eh"})
|
108
108
|
|
109
109
|
# This creates the dir.
|
110
110
|
config.use(:reports)
|
data/lib/puppet/reports/store.rb
CHANGED
@@ -16,8 +16,8 @@ Puppet::Reports.register_report(:store) do
|
|
16
16
|
"client-#{client}-dir" => { :default => dir,
|
17
17
|
:mode => 0750,
|
18
18
|
:desc => "Client dir for %s" % client,
|
19
|
-
:owner =>
|
20
|
-
:group =>
|
19
|
+
:owner => 'service',
|
20
|
+
:group => 'service'
|
21
21
|
}
|
22
22
|
)
|
23
23
|
|
@@ -128,7 +128,6 @@ Puppet::Reports.register_report(:tagmail) do
|
|
128
128
|
begin
|
129
129
|
Net::SMTP.start(Puppet[:smtpserver]) do |smtp|
|
130
130
|
reports.each do |emails, messages|
|
131
|
-
Puppet.info "Sending report to %s" % emails.join(", ")
|
132
131
|
smtp.open_message_stream(Puppet[:reportfrom], *emails) do |p|
|
133
132
|
p.puts "From: #{Puppet[:reportfrom]}"
|
134
133
|
p.puts "Subject: Puppet Report for %s" % self.host
|
@@ -149,16 +148,13 @@ Puppet::Reports.register_report(:tagmail) do
|
|
149
148
|
elsif Puppet[:sendmail] != ""
|
150
149
|
begin
|
151
150
|
reports.each do |emails, messages|
|
152
|
-
Puppet.info "Sending report to %s" % emails.join(", ")
|
153
151
|
# We need to open a separate process for every set of email addresses
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
p.puts "To: " + emails.join(", ")
|
152
|
+
IO.popen(Puppet[:sendmail] + " " + emails.join(" "), "w") do |p|
|
153
|
+
p.puts "From: #{Puppet[:reportfrom]}"
|
154
|
+
p.puts "Subject: Puppet Report for %s" % self.host
|
155
|
+
p.puts "To: " + emails.join(", ")
|
159
156
|
|
160
|
-
|
161
|
-
end
|
157
|
+
p.puts messages
|
162
158
|
end
|
163
159
|
end
|
164
160
|
rescue => detail
|
@@ -176,12 +172,5 @@ Puppet::Reports.register_report(:tagmail) do
|
|
176
172
|
# Don't bother waiting for the pid to return.
|
177
173
|
Process.detach(pid)
|
178
174
|
end
|
179
|
-
|
180
|
-
def sync
|
181
|
-
unless defined?(@sync)
|
182
|
-
@sync = Sync.new
|
183
|
-
end
|
184
|
-
@sync
|
185
|
-
end
|
186
175
|
end
|
187
176
|
|
data/lib/puppet/resource.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
require 'puppet'
|
2
2
|
require 'puppet/util/tagging'
|
3
3
|
require 'puppet/resource/reference'
|
4
|
-
require 'puppet/util/
|
4
|
+
require 'puppet/util/pson'
|
5
5
|
|
6
6
|
# The simplest resource class. Eventually it will function as the
|
7
7
|
# base class for all resource-like behaviour.
|
8
8
|
class Puppet::Resource
|
9
9
|
include Puppet::Util::Tagging
|
10
|
-
extend Puppet::Util::
|
10
|
+
extend Puppet::Util::Pson
|
11
11
|
include Enumerable
|
12
12
|
attr_accessor :file, :line, :catalog, :exported, :virtual
|
13
13
|
attr_writer :type, :title
|
14
14
|
|
15
15
|
ATTRIBUTES = [:file, :line, :exported]
|
16
16
|
|
17
|
-
def self.
|
18
|
-
raise ArgumentError, "No resource type provided in
|
19
|
-
raise ArgumentError, "No resource title provided in
|
17
|
+
def self.from_pson(pson)
|
18
|
+
raise ArgumentError, "No resource type provided in pson data" unless type = pson['type']
|
19
|
+
raise ArgumentError, "No resource title provided in pson data" unless title = pson['title']
|
20
20
|
|
21
21
|
resource = new(type, title)
|
22
22
|
|
23
|
-
if params =
|
23
|
+
if params = pson['parameters']
|
24
24
|
params.each { |param, value| resource[param] = value }
|
25
25
|
end
|
26
26
|
|
27
|
-
if tags =
|
27
|
+
if tags = pson['tags']
|
28
28
|
tags.each { |tag| resource.tag(tag) }
|
29
29
|
end
|
30
30
|
|
31
31
|
ATTRIBUTES.each do |a|
|
32
|
-
if value =
|
32
|
+
if value = pson[a.to_s]
|
33
33
|
resource.send(a.to_s + "=", value)
|
34
34
|
end
|
35
35
|
end
|
@@ -39,9 +39,7 @@ class Puppet::Resource
|
|
39
39
|
resource
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
raise "Cannot convert to JSON unless the 'json' library is installed" unless Puppet.features.json?
|
44
|
-
|
42
|
+
def to_pson_data_hash
|
45
43
|
data = ([:type, :title, :tags] + ATTRIBUTES).inject({}) do |hash, param|
|
46
44
|
next hash unless value = self.send(param)
|
47
45
|
hash[param.to_s] = value
|
@@ -55,20 +53,17 @@ class Puppet::Resource
|
|
55
53
|
|
56
54
|
# Don't duplicate the title as the namevar
|
57
55
|
next hash if param == namevar and value == title
|
58
|
-
value = [value] unless value.is_a?(Array)
|
59
56
|
hash[param] = value
|
60
57
|
hash
|
61
58
|
end
|
62
59
|
|
63
|
-
unless params.empty?
|
64
|
-
|
65
|
-
|
60
|
+
data["parameters"] = params unless params.empty?
|
61
|
+
|
62
|
+
data
|
63
|
+
end
|
66
64
|
|
67
|
-
|
68
|
-
|
69
|
-
'data' => data
|
70
|
-
}
|
71
|
-
res.to_json(*args)
|
65
|
+
def to_pson(*args)
|
66
|
+
to_pson_data_hash.to_pson(*args)
|
72
67
|
end
|
73
68
|
|
74
69
|
# Proxy these methods to the parameters hash. It's likely they'll
|
@@ -4,7 +4,7 @@ require 'puppet/simple_graph'
|
|
4
4
|
require 'puppet/transaction'
|
5
5
|
|
6
6
|
require 'puppet/util/cacher'
|
7
|
-
require 'puppet/util/
|
7
|
+
require 'puppet/util/pson'
|
8
8
|
|
9
9
|
require 'puppet/util/tagging'
|
10
10
|
|
@@ -19,7 +19,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
19
19
|
indirects :catalog, :terminus_class => :compiler
|
20
20
|
|
21
21
|
include Puppet::Util::Tagging
|
22
|
-
extend Puppet::Util::
|
22
|
+
extend Puppet::Util::Pson
|
23
23
|
include Puppet::Util::Cacher::Expirer
|
24
24
|
|
25
25
|
# The host name this is a catalog for.
|
@@ -46,6 +46,9 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
46
46
|
# whether it is written back out again.
|
47
47
|
attr_accessor :from_cache
|
48
48
|
|
49
|
+
# Some metadata to help us compile and generally respond to the current state.
|
50
|
+
attr_accessor :client_version, :server_version
|
51
|
+
|
49
52
|
# Add classes to our class list.
|
50
53
|
def add_class(*classes)
|
51
54
|
classes.each do |klass|
|
@@ -390,7 +393,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
390
393
|
@resource_table.keys
|
391
394
|
end
|
392
395
|
|
393
|
-
def self.
|
396
|
+
def self.from_pson(data)
|
394
397
|
result = new(data['name'])
|
395
398
|
|
396
399
|
if tags = data['tags']
|
@@ -402,60 +405,68 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
402
405
|
end
|
403
406
|
|
404
407
|
if resources = data['resources']
|
405
|
-
resources =
|
408
|
+
resources = PSON.parse(resources) if resources.is_a?(String)
|
406
409
|
resources.each do |res|
|
407
|
-
|
410
|
+
resource_from_pson(result, res)
|
408
411
|
end
|
409
412
|
end
|
410
413
|
|
411
414
|
if edges = data['edges']
|
412
|
-
edges =
|
415
|
+
edges = PSON.parse(edges) if edges.is_a?(String)
|
413
416
|
edges.each do |edge|
|
414
|
-
|
417
|
+
edge_from_pson(result, edge)
|
415
418
|
end
|
416
419
|
end
|
417
420
|
|
421
|
+
if classes = data['classes']
|
422
|
+
result.add_class(*classes)
|
423
|
+
end
|
424
|
+
|
418
425
|
result
|
419
426
|
end
|
420
427
|
|
421
|
-
def self.
|
422
|
-
# If no
|
428
|
+
def self.edge_from_pson(result, edge)
|
429
|
+
# If no type information was presented, we manually find
|
423
430
|
# the class.
|
424
|
-
edge = Puppet::Relationship.
|
431
|
+
edge = Puppet::Relationship.from_pson(edge) if edge.is_a?(Hash)
|
425
432
|
unless source = result.resource(edge.source)
|
426
|
-
raise ArgumentError, "Could not convert from
|
433
|
+
raise ArgumentError, "Could not convert from pson: Could not find relationship source '%s'" % source
|
427
434
|
end
|
428
435
|
edge.source = source
|
429
436
|
|
430
437
|
unless target = result.resource(edge.target)
|
431
|
-
raise ArgumentError, "Could not convert from
|
438
|
+
raise ArgumentError, "Could not convert from pson: Could not find relationship target '%s'" % target
|
432
439
|
end
|
433
440
|
edge.target = target
|
434
441
|
|
435
442
|
result.add_edge(edge)
|
436
443
|
end
|
437
444
|
|
438
|
-
def self.
|
439
|
-
|
440
|
-
# the class.
|
441
|
-
if res.is_a?(Hash)
|
442
|
-
res = res['data'] if res['json_class']
|
443
|
-
res = Puppet::Resource.from_json(res)
|
444
|
-
end
|
445
|
+
def self.resource_from_pson(result, res)
|
446
|
+
res = Puppet::Resource.from_pson(res) if res.is_a? Hash
|
445
447
|
result.add_resource(res)
|
446
448
|
end
|
447
449
|
|
448
|
-
|
450
|
+
PSON.register_document_type('Catalog',self)
|
451
|
+
def to_pson_data_hash
|
449
452
|
{
|
450
|
-
'
|
451
|
-
'data'
|
452
|
-
'tags'
|
453
|
-
'name'
|
454
|
-
'version'
|
455
|
-
'resources' => vertices.
|
456
|
-
'edges'
|
457
|
-
|
458
|
-
|
453
|
+
'document_type' => 'Catalog',
|
454
|
+
'data' => {
|
455
|
+
'tags' => tags,
|
456
|
+
'name' => name,
|
457
|
+
'version' => version,
|
458
|
+
'resources' => vertices.collect { |v| v.to_pson_data_hash },
|
459
|
+
'edges' => edges. collect { |e| e.to_pson_data_hash },
|
460
|
+
'classes' => classes
|
461
|
+
},
|
462
|
+
'metadata' => {
|
463
|
+
'api_version' => 1
|
464
|
+
}
|
465
|
+
}
|
466
|
+
end
|
467
|
+
|
468
|
+
def to_pson(*args)
|
469
|
+
to_pson_data_hash.to_pson(*args)
|
459
470
|
end
|
460
471
|
|
461
472
|
# Convert our catalog into a RAL catalog.
|
@@ -46,8 +46,6 @@ class Puppet::SSL::CertificateRevocationList < Puppet::SSL::Base
|
|
46
46
|
# The name doesn't actually matter; there's only one CRL.
|
47
47
|
# We just need the name so our Indirector stuff all works more easily.
|
48
48
|
def initialize(fakename)
|
49
|
-
raise Puppet::Error, "Cannot manage the CRL when :cacrl is set to false" if [false, "false"].include?(Puppet[:cacrl])
|
50
|
-
|
51
49
|
@name = "crl"
|
52
50
|
end
|
53
51
|
|
data/lib/puppet/ssl/host.rb
CHANGED
@@ -235,12 +235,11 @@ class Puppet::SSL::Host
|
|
235
235
|
|
236
236
|
# Attempt to retrieve a cert, if we don't already have one.
|
237
237
|
def wait_for_cert(time)
|
238
|
-
return if certificate
|
239
238
|
begin
|
239
|
+
return if certificate
|
240
240
|
generate
|
241
|
-
|
242
241
|
return if certificate
|
243
|
-
rescue
|
242
|
+
rescue Exception => detail
|
244
243
|
Puppet.err "Could not request certificate: %s" % detail.to_s
|
245
244
|
if time < 1
|
246
245
|
puts "Exiting; failed to retrieve certificate and watiforcert is disabled"
|
@@ -194,9 +194,6 @@ class Puppet::SSLCertificates::CA
|
|
194
194
|
# Revoke the certificate with serial number SERIAL issued by this
|
195
195
|
# CA. The REASON must be one of the OpenSSL::OCSP::REVOKED_* reasons
|
196
196
|
def revoke(serial, reason = OpenSSL::OCSP::REVOKED_STATUS_KEYCOMPROMISE)
|
197
|
-
if @config[:cacrl] == 'false'
|
198
|
-
raise Puppet::Error, "Revocation requires a CRL, but ca_crl is set to 'false'"
|
199
|
-
end
|
200
197
|
time = Time.now
|
201
198
|
revoked = OpenSSL::X509::Revoked.new
|
202
199
|
revoked.serial = serial
|
@@ -344,8 +341,6 @@ class Puppet::SSLCertificates::CA
|
|
344
341
|
@crl = OpenSSL::X509::CRL.new(
|
345
342
|
File.read(@config[:cacrl])
|
346
343
|
)
|
347
|
-
elsif @config[:cacrl] == 'false'
|
348
|
-
@crl = nil
|
349
344
|
else
|
350
345
|
# Create new CRL
|
351
346
|
@crl = OpenSSL::X509::CRL.new
|
data/lib/puppet/type/cron.rb
CHANGED
@@ -312,7 +312,7 @@ Puppet::Type.newtype(:cron) do
|
|
312
312
|
the crontab, e.g., ``PATH=/bin:/usr/bin:/usr/sbin``."
|
313
313
|
|
314
314
|
validate do |value|
|
315
|
-
unless value =~ /^\s*(\w+)\s*=\s*(
|
315
|
+
unless value =~ /^\s*(\w+)\s*=\s*(.*)\s*$/ or value == :absent or value == "absent"
|
316
316
|
raise ArgumentError, "Invalid environment setting %s" %
|
317
317
|
value.inspect
|
318
318
|
end
|
@@ -28,10 +28,7 @@ module Puppet
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def insync?(current)
|
31
|
-
|
32
|
-
warning "Cannot manage ownership unless running as root"
|
33
|
-
return true
|
34
|
-
end
|
31
|
+
return true unless should
|
35
32
|
|
36
33
|
@should.each do |value|
|
37
34
|
if value =~ /^\d+$/
|
@@ -44,6 +41,12 @@ module Puppet
|
|
44
41
|
|
45
42
|
return true if uid == current
|
46
43
|
end
|
44
|
+
|
45
|
+
unless Puppet::Util::SUIDManager.uid == 0
|
46
|
+
warnonce "Cannot manage ownership unless running as root"
|
47
|
+
return true
|
48
|
+
end
|
49
|
+
|
47
50
|
return false
|
48
51
|
end
|
49
52
|
|
@@ -85,33 +85,33 @@ Puppet::Type.newtype(:resources) do
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
def able_to_ensure_absent?(resource)
|
89
|
+
begin
|
90
|
+
resource[:ensure] = :absent
|
91
|
+
rescue ArgumentError, Puppet::Error => detail
|
92
|
+
err "The 'ensure' attribute on #{self[:name]} resources does not accept 'absent' as a value"
|
93
|
+
false
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
88
97
|
# Generate any new resources we need to manage. This is pretty hackish
|
89
98
|
# right now, because it only supports purging.
|
90
99
|
def generate
|
91
100
|
return [] unless self.purge?
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end.each do |resource|
|
99
|
-
begin
|
100
|
-
resource[:ensure] = :absent
|
101
|
-
rescue ArgumentError, Puppet::Error => detail
|
102
|
-
err "The 'ensure' attribute on %s resources does not accept 'absent' as a value" %
|
103
|
-
[self[:name]]
|
104
|
-
return []
|
105
|
-
end
|
101
|
+
resource_type.instances.
|
102
|
+
reject { |r| managed? }.
|
103
|
+
reject { |r| catalog.resources.include? r.ref }.
|
104
|
+
select { |r| check(r) }.
|
105
|
+
select { |r| able_to_ensure_absent?(r) }.
|
106
|
+
each { |resource|
|
106
107
|
@parameters.each do |name, param|
|
107
|
-
|
108
|
-
resource[name] = param.value
|
108
|
+
resource[name] = param.value if param.metaparam?
|
109
109
|
end
|
110
110
|
|
111
111
|
# Mark that we're purging, so transactions can handle relationships
|
112
112
|
# correctly
|
113
113
|
resource.purging
|
114
|
-
|
114
|
+
}
|
115
115
|
end
|
116
116
|
|
117
117
|
def resource_type
|