puppet 2.6.0 → 2.6.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 +123 -0
- data/conf/redhat/puppet.spec +8 -2
- data/conf/solaris/smf/svc-puppetd +1 -1
- data/conf/solaris/smf/svc-puppetmasterd +1 -1
- data/conf/suse/client.init +4 -4
- data/conf/suse/fileserver.conf +12 -0
- data/conf/suse/logrotate +10 -0
- data/conf/suse/puppet.conf +25 -0
- data/conf/suse/puppet.spec +114 -49
- data/conf/suse/ruby-env.patch +17 -0
- data/conf/suse/server.init +4 -4
- data/ext/logcheck/puppet +23 -23
- data/ext/puppet-load.rb +357 -0
- data/ext/puppetstoredconfigclean.rb +3 -3
- data/ext/rack/files/config.ru +3 -5
- data/ext/vim/syntax/puppet.vim +6 -5
- data/install.rb +12 -11
- data/lib/puppet.rb +1 -1
- data/lib/puppet/agent.rb +3 -1
- data/lib/puppet/application.rb +2 -3
- data/lib/puppet/application/agent.rb +4 -0
- data/lib/puppet/application/apply.rb +14 -6
- data/lib/puppet/application/describe.rb +1 -1
- data/lib/puppet/application/doc.rb +2 -36
- data/lib/puppet/application/master.rb +0 -3
- data/lib/puppet/application/queue.rb +1 -0
- data/lib/puppet/configurer.rb +4 -0
- data/lib/puppet/daemon.rb +1 -1
- data/lib/puppet/defaults.rb +38 -44
- data/lib/puppet/file_serving/indirection_hooks.rb +2 -2
- data/lib/puppet/indirector/facts/memory.rb +1 -1
- data/lib/puppet/indirector/node/exec.rb +1 -1
- data/lib/puppet/indirector/node/ldap.rb +9 -53
- data/lib/puppet/indirector/node/memory.rb +1 -1
- data/lib/puppet/indirector/yaml.rb +6 -9
- data/lib/puppet/network/format_handler.rb +6 -0
- data/lib/puppet/network/formats.rb +4 -4
- data/lib/puppet/network/http/handler.rb +1 -1
- data/lib/puppet/network/http/rack.rb +3 -0
- data/lib/puppet/network/http/rack/rest.rb +1 -1
- data/lib/puppet/network/rest_authconfig.rb +6 -3
- data/lib/puppet/node/environment.rb +15 -5
- data/lib/puppet/parameter/value_collection.rb +3 -3
- data/lib/puppet/parser/ast/function.rb +0 -1
- data/lib/puppet/parser/ast/leaf.rb +1 -1
- data/lib/puppet/parser/ast/resource.rb +4 -3
- data/lib/puppet/parser/ast/resource_reference.rb +9 -2
- data/lib/puppet/parser/compiler.rb +12 -14
- data/lib/puppet/parser/files.rb +1 -1
- data/lib/puppet/parser/functions.rb +2 -2
- data/lib/puppet/parser/functions/defined.rb +1 -1
- data/lib/puppet/parser/functions/extlookup.rb +157 -0
- data/lib/puppet/parser/functions/file.rb +1 -1
- data/lib/puppet/parser/functions/inline_template.rb +6 -5
- data/lib/puppet/parser/functions/md5.rb +5 -0
- data/lib/puppet/parser/functions/realize.rb +1 -1
- data/lib/puppet/parser/functions/regsubst.rb +19 -19
- data/lib/puppet/parser/functions/require.rb +2 -3
- data/lib/puppet/parser/functions/split.rb +1 -1
- data/lib/puppet/parser/functions/sprintf.rb +1 -1
- data/lib/puppet/parser/functions/template.rb +4 -2
- data/lib/puppet/parser/functions/versioncmp.rb +12 -12
- data/lib/puppet/parser/lexer.rb +13 -14
- data/lib/puppet/parser/resource.rb +2 -7
- data/lib/puppet/parser/resource/param.rb +1 -1
- data/lib/puppet/parser/scope.rb +35 -0
- data/lib/puppet/parser/type_loader.rb +1 -1
- data/lib/puppet/property.rb +5 -5
- data/lib/puppet/provider.rb +3 -3
- data/lib/puppet/provider/group/groupadd.rb +1 -1
- data/lib/puppet/provider/group/ldap.rb +3 -3
- data/lib/puppet/provider/group/pw.rb +1 -1
- data/lib/puppet/provider/package/apple.rb +1 -1
- data/lib/puppet/provider/package/apt.rb +5 -1
- data/lib/puppet/provider/package/aptitude.rb +1 -1
- data/lib/puppet/provider/package/aptrpm.rb +1 -1
- data/lib/puppet/provider/package/blastwave.rb +1 -1
- data/lib/puppet/provider/package/dpkg.rb +2 -2
- data/lib/puppet/provider/package/fink.rb +1 -1
- data/lib/puppet/provider/package/gem.rb +1 -1
- data/lib/puppet/provider/package/openbsd.rb +1 -1
- data/lib/puppet/provider/package/rpm.rb +1 -1
- data/lib/puppet/provider/package/rug.rb +1 -1
- data/lib/puppet/provider/package/sunfreeware.rb +2 -2
- data/lib/puppet/provider/package/up2date.rb +1 -1
- data/lib/puppet/provider/package/urpmi.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/package/zypper.rb +1 -1
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/bsd.rb +2 -2
- data/lib/puppet/provider/service/debian.rb +2 -2
- data/lib/puppet/provider/service/gentoo.rb +2 -2
- data/lib/puppet/provider/service/init.rb +2 -2
- data/lib/puppet/provider/service/redhat.rb +2 -2
- data/lib/puppet/provider/user/ldap.rb +3 -3
- data/lib/puppet/provider/user/pw.rb +1 -1
- data/lib/puppet/provider/user/user_role_add.rb +1 -1
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/rails/host.rb +1 -0
- data/lib/puppet/reference/configuration.rb +37 -34
- data/lib/puppet/reference/indirection.rb +3 -4
- data/lib/puppet/reference/metaparameter.rb +0 -8
- data/lib/puppet/reference/network.rb +6 -4
- data/lib/puppet/reference/providers.rb +4 -4
- data/lib/puppet/reference/report.rb +5 -6
- data/lib/puppet/reference/type.rb +14 -14
- data/lib/puppet/reports/http.rb +1 -1
- data/lib/puppet/reports/rrdgraph.rb +8 -9
- data/lib/puppet/reports/store.rb +2 -2
- data/lib/puppet/reports/tagmail.rb +12 -13
- data/lib/puppet/resource.rb +15 -115
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/resource/type.rb +26 -3
- data/lib/puppet/resource/type_collection.rb +3 -6
- data/lib/puppet/simple_graph.rb +4 -5
- data/lib/puppet/transaction/resource_harness.rb +1 -1
- data/lib/puppet/type.rb +100 -92
- data/lib/puppet/type/augeas.rb +44 -45
- data/lib/puppet/type/computer.rb +2 -2
- data/lib/puppet/type/cron.rb +29 -29
- data/lib/puppet/type/exec.rb +66 -67
- data/lib/puppet/type/file.rb +25 -25
- data/lib/puppet/type/file/content.rb +7 -1
- data/lib/puppet/type/file/ensure.rb +13 -13
- data/lib/puppet/type/file/mode.rb +6 -6
- data/lib/puppet/type/file/selcontext.rb +5 -5
- data/lib/puppet/type/file/source.rb +36 -26
- data/lib/puppet/type/filebucket.rb +5 -6
- data/lib/puppet/type/group.rb +1 -2
- data/lib/puppet/type/host.rb +3 -6
- data/lib/puppet/type/k5login.rb +3 -3
- data/lib/puppet/type/macauthorization.rb +1 -2
- data/lib/puppet/type/mailalias.rb +0 -1
- data/lib/puppet/type/maillist.rb +0 -1
- data/lib/puppet/type/mcx.rb +9 -9
- data/lib/puppet/type/mount.rb +9 -10
- data/lib/puppet/type/notify.rb +0 -1
- data/lib/puppet/type/package.rb +34 -36
- data/lib/puppet/type/resources.rb +1 -5
- data/lib/puppet/type/schedule.rb +9 -12
- data/lib/puppet/type/selboolean.rb +2 -7
- data/lib/puppet/type/selmodule.rb +3 -4
- data/lib/puppet/type/service.rb +9 -9
- data/lib/puppet/type/ssh_authorized_key.rb +2 -3
- data/lib/puppet/type/sshkey.rb +4 -7
- data/lib/puppet/type/stage.rb +5 -4
- data/lib/puppet/type/tidy.rb +3 -3
- data/lib/puppet/type/user.rb +1 -2
- data/lib/puppet/type/whit.rb +7 -0
- data/lib/puppet/type/yumrepo.rb +16 -3
- data/lib/puppet/type/zfs.rb +1 -2
- data/lib/puppet/type/zone.rb +28 -28
- data/lib/puppet/type/zpool.rb +10 -5
- data/lib/puppet/util/autoload.rb +17 -5
- data/lib/puppet/util/cacher.rb +15 -10
- data/lib/puppet/util/command_line/puppetdoc +5 -5
- data/lib/puppet/util/command_line/puppetrun +0 -2
- data/lib/puppet/util/command_line/ralsh +13 -13
- data/lib/puppet/util/docs.rb +5 -12
- data/lib/puppet/util/monkey_patches.rb +5 -2
- data/lib/puppet/util/nagios_maker.rb +4 -5
- data/lib/puppet/util/provider_features.rb +2 -2
- data/lib/puppet/util/rdoc.rb +1 -1
- data/lib/puppet/util/rdoc/parser.rb +5 -3
- data/lib/puppet/util/reference.rb +3 -52
- data/man/man5/puppet.conf.5 +2072 -1526
- data/man/man8/filebucket.8 +104 -106
- data/man/man8/pi.8 +14 -47
- data/man/man8/puppet.8 +8 -9
- data/man/man8/puppetca.8 +168 -129
- data/man/man8/puppetd.8 +282 -226
- data/man/man8/puppetdoc.8 +103 -103
- data/man/man8/puppetmasterd.8 +51 -71
- data/man/man8/puppetqd.8 +18 -53
- data/man/man8/puppetrun.8 +163 -143
- data/man/man8/ralsh.8 +77 -114
- data/spec/integration/indirector/bucket_file/rest_spec.rb +1 -0
- data/spec/integration/indirector/certificate/rest_spec.rb +1 -0
- data/spec/integration/indirector/certificate_request/rest_spec.rb +1 -0
- data/spec/integration/indirector/certificate_revocation_list/rest_spec.rb +1 -0
- data/spec/integration/indirector/report/rest_spec.rb +1 -0
- data/spec/integration/indirector/rest_spec.rb +1 -0
- data/spec/integration/network/server/webrick_spec.rb +1 -0
- data/spec/integration/parser/compiler_spec.rb +43 -0
- data/spec/integration/provider/mailalias/aliases_spec.rb +5 -5
- data/spec/integration/ssl/certificate_authority_spec.rb +1 -0
- data/spec/integration/ssl/certificate_request_spec.rb +1 -0
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +1 -0
- data/spec/integration/ssl/host_spec.rb +1 -0
- data/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb +0 -1
- data/spec/monkey_patches/publicize_methods.rb +11 -0
- data/spec/shared_behaviours/file_serving.rb +12 -1
- data/spec/spec_helper.rb +6 -25
- data/spec/unit/application/apply_spec.rb +22 -4
- data/spec/unit/application/cert_spec.rb +1 -1
- data/spec/unit/application/doc_spec.rb +0 -19
- data/spec/unit/application/master_spec.rb +1 -1
- data/spec/unit/application_spec.rb +2 -12
- data/spec/unit/indirector/node/ldap_spec.rb +19 -21
- data/spec/unit/indirector/yaml_spec.rb +18 -6
- data/spec/unit/network/http/rack/rest_spec.rb +3 -3
- data/spec/unit/network/http/webrick/rest_spec.rb +1 -0
- data/spec/unit/node/environment_spec.rb +32 -3
- data/spec/unit/node/facts_spec.rb +13 -2
- data/spec/unit/parameter/value_collection_spec.rb +2 -2
- data/spec/unit/parser/ast/leaf_spec.rb +4 -0
- data/spec/unit/parser/ast/resource_reference_spec.rb +0 -5
- data/spec/unit/parser/ast/resource_spec.rb +7 -0
- data/spec/unit/parser/compiler_spec.rb +12 -1
- data/spec/unit/parser/files_spec.rb +3 -3
- data/spec/unit/parser/functions/extlookup_spec.rb +95 -0
- data/spec/unit/parser/functions/include_spec.rb +33 -0
- data/spec/unit/parser/functions/require_spec.rb +1 -1
- data/spec/unit/parser/functions/tag_spec.rb +1 -0
- data/spec/unit/parser/lexer_spec.rb +10 -1
- data/spec/unit/parser/resource_spec.rb +3 -9
- data/spec/unit/parser/type_loader_spec.rb +1 -1
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +4 -2
- data/spec/unit/rails/resource_spec.rb +1 -1
- data/spec/unit/reports/tagmail_spec.rb +2 -2
- data/spec/unit/resource/catalog_spec.rb +1 -1
- data/spec/unit/resource/type_collection_spec.rb +35 -0
- data/spec/unit/resource/type_spec.rb +19 -1
- data/spec/unit/resource_spec.rb +0 -36
- data/spec/unit/simple_graph_spec.rb +12 -2
- data/spec/unit/transaction/resource_harness_spec.rb +1 -1
- data/spec/unit/type/file/content_spec.rb +2 -1
- data/spec/unit/type/schedule_spec.rb +1 -1
- data/spec/unit/type/service_spec.rb +8 -0
- data/spec/unit/type/user_spec.rb +5 -0
- data/spec/unit/util/backups_spec.rb +0 -1
- data/spec/unit/util/rdoc/parser_spec.rb +3 -3
- data/spec/unit/util/rdoc_spec.rb +13 -0
- data/test/certmgr/support.rb +2 -1
- data/test/language/parser.rb +6 -6
- data/test/lib/puppettest.rb +3 -23
- data/test/lib/puppettest/fakes.rb +1 -1
- data/test/lib/puppettest/support/assertions.rb +0 -2
- data/test/lib/puppettest/support/utils.rb +25 -20
- data/test/ral/manager/attributes.rb +4 -1
- metadata +15 -9
- data/conf/suse/puppet.suse.patch +0 -16
- data/ext/extlookup.rb +0 -181
- data/ext/puppetlast +0 -16
- data/tasks/rake/tracdocs.rake +0 -8
- data/test/lib/mocha_standalone.rb +0 -2
data/lib/puppet/resource/type.rb
CHANGED
@@ -69,6 +69,7 @@ class Puppet::Resource::Type
|
|
69
69
|
end
|
70
70
|
|
71
71
|
scope = subscope(scope, resource) unless resource.title == :main
|
72
|
+
scope.compiler.add_class(name) unless definition?
|
72
73
|
|
73
74
|
set_resource_parameters(resource, scope)
|
74
75
|
|
@@ -174,12 +175,29 @@ class Puppet::Resource::Type
|
|
174
175
|
@name.is_a?(Regexp)
|
175
176
|
end
|
176
177
|
|
178
|
+
# MQR TODO:
|
179
|
+
#
|
180
|
+
# The change(s) introduced by the fix for #4270 are mostly silly & should be
|
181
|
+
# removed, though we didn't realize it at the time. If it can be established/
|
182
|
+
# ensured that nodes never call parent_type and that resource_types are always
|
183
|
+
# (as they should be) members of exactly one resource_type_collection the
|
184
|
+
# following method could / should be replaced with:
|
185
|
+
#
|
186
|
+
# def parent_type
|
187
|
+
# @parent_type ||= parent && (
|
188
|
+
# resource_type_collection.find_or_load([name],parent,type.to_sym) ||
|
189
|
+
# fail Puppet::ParseError, "Could not find parent resource type '#{parent}' of type #{type} in #{resource_type_collection.environment}"
|
190
|
+
# )
|
191
|
+
# end
|
192
|
+
#
|
193
|
+
# ...and then the rest of the changes around passing in scope reverted.
|
194
|
+
#
|
177
195
|
def parent_type(scope = nil)
|
178
196
|
return nil unless parent
|
179
197
|
|
180
198
|
unless @parent_type
|
181
199
|
raise "Must pass scope to parent_type when called first time" unless scope
|
182
|
-
unless @parent_type = scope.environment.known_resource_types.send("find_#{type}",
|
200
|
+
unless @parent_type = scope.environment.known_resource_types.send("find_#{type}", [name], parent)
|
183
201
|
fail Puppet::ParseError, "Could not find parent resource type '#{parent}' of type #{type} in #{scope.environment}"
|
184
202
|
end
|
185
203
|
end
|
@@ -215,8 +233,13 @@ class Puppet::Resource::Type
|
|
215
233
|
resource[param] = value
|
216
234
|
end
|
217
235
|
|
218
|
-
|
219
|
-
|
236
|
+
if @type == :hostclass
|
237
|
+
scope.setvar("title", resource.title.to_s.downcase) unless set.include? :title
|
238
|
+
scope.setvar("name", resource.name.to_s.downcase ) unless set.include? :name
|
239
|
+
else
|
240
|
+
scope.setvar("title", resource.title ) unless set.include? :title
|
241
|
+
scope.setvar("name", resource.name ) unless set.include? :name
|
242
|
+
end
|
220
243
|
scope.setvar("module_name", module_name) if module_name and ! set.include? :module_name
|
221
244
|
|
222
245
|
if caller_name = scope.parent_module_name and ! set.include?(:caller_module_name)
|
@@ -96,8 +96,8 @@ class Puppet::Resource::TypeCollection
|
|
96
96
|
#Array("") == [] for some reason
|
97
97
|
namespaces = [namespaces] unless namespaces.is_a?(Array)
|
98
98
|
|
99
|
-
if
|
100
|
-
return
|
99
|
+
if name =~ /^::/
|
100
|
+
return send(type, name.sub(/^::/, ''))
|
101
101
|
end
|
102
102
|
|
103
103
|
namespaces.each do |namespace|
|
@@ -153,6 +153,7 @@ class Puppet::Resource::TypeCollection
|
|
153
153
|
end
|
154
154
|
|
155
155
|
def perform_initial_import
|
156
|
+
return if Puppet.settings[:ignoreimport]
|
156
157
|
parser = Puppet::Parser::Parser.new(environment)
|
157
158
|
if code = Puppet.settings.uninterpolated_value(:code, environment.to_s) and code != ""
|
158
159
|
parser.string = code
|
@@ -197,10 +198,6 @@ class Puppet::Resource::TypeCollection
|
|
197
198
|
|
198
199
|
private
|
199
200
|
|
200
|
-
def find_fully_qualified(name, type)
|
201
|
-
send(type, name.sub(/^::/, ''))
|
202
|
-
end
|
203
|
-
|
204
201
|
def find_partially_qualified(namespace, name, type)
|
205
202
|
send(type, [namespace, name].join("::"))
|
206
203
|
end
|
data/lib/puppet/simple_graph.rb
CHANGED
@@ -318,16 +318,15 @@ class Puppet::SimpleGraph
|
|
318
318
|
# to container leaves, but that would result in many more
|
319
319
|
# relationships.
|
320
320
|
stage_class = Puppet::Type.type(:stage)
|
321
|
+
whit_class = Puppet::Type.type(:whit)
|
321
322
|
containers = other.topsort.find_all { |v| (v.is_a?(type) or v.is_a?(stage_class)) and vertex?(v) }
|
322
323
|
containers.each do |container|
|
323
324
|
# Get the list of children from the other graph.
|
324
325
|
children = other.adjacent(container, :direction => :out)
|
325
326
|
|
326
|
-
#
|
327
|
-
|
328
|
-
|
329
|
-
next
|
330
|
-
end
|
327
|
+
# MQR TODO: Luke suggests that it should be possible to refactor the system so that
|
328
|
+
# container nodes are retained, thus obviating the need for the whit.
|
329
|
+
children = [whit_class.new(:name => container.name, :catalog => other)] if children.empty?
|
331
330
|
|
332
331
|
# First create new edges for each of the :in edges
|
333
332
|
[:in, :out].each do |dir|
|
@@ -72,7 +72,7 @@ class Puppet::Transaction::ResourceHarness
|
|
72
72
|
resource[param] = value
|
73
73
|
audited << param
|
74
74
|
else
|
75
|
-
resource.
|
75
|
+
resource.debug "Storing newly-audited value #{current[param]} for #{param}"
|
76
76
|
cache(resource, param, current[param])
|
77
77
|
end
|
78
78
|
end
|
data/lib/puppet/type.rb
CHANGED
@@ -410,13 +410,15 @@ class Type
|
|
410
410
|
|
411
411
|
property = self.newattr(name)
|
412
412
|
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
413
|
+
if property
|
414
|
+
begin
|
415
|
+
# make sure the parameter doesn't have any errors
|
416
|
+
property.value = value
|
417
|
+
rescue => detail
|
418
|
+
error = Puppet::Error.new("Parameter #{name} failed: #{detail}")
|
419
|
+
error.set_backtrace(detail.backtrace)
|
420
|
+
raise error
|
421
|
+
end
|
420
422
|
end
|
421
423
|
|
422
424
|
nil
|
@@ -472,6 +474,12 @@ class Type
|
|
472
474
|
raise Puppet::Error, "Resource type #{self.class.name} does not support parameter #{name}"
|
473
475
|
end
|
474
476
|
|
477
|
+
if provider and ! provider.class.supports_parameter?(klass)
|
478
|
+
missing = klass.required_features.find_all { |f| ! provider.class.feature?(f) }
|
479
|
+
info "Provider %s does not support features %s; not managing attribute %s" % [provider.class.name, missing.join(", "), name]
|
480
|
+
return nil
|
481
|
+
end
|
482
|
+
|
475
483
|
return @parameters[name] if @parameters.include?(name)
|
476
484
|
|
477
485
|
@parameters[name] = klass.new(:resource => self)
|
@@ -933,16 +941,16 @@ class Type
|
|
933
941
|
newmetaparam(:schedule) do
|
934
942
|
desc "On what schedule the object should be managed. You must create a
|
935
943
|
schedule object, and then reference the name of that object to use
|
936
|
-
that for your schedule
|
944
|
+
that for your schedule:
|
937
945
|
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
946
|
+
schedule { daily:
|
947
|
+
period => daily,
|
948
|
+
range => \"2-4\"
|
949
|
+
}
|
942
950
|
|
943
|
-
|
944
|
-
|
945
|
-
|
951
|
+
exec { \"/usr/bin/apt-get update\":
|
952
|
+
schedule => daily
|
953
|
+
}
|
946
954
|
|
947
955
|
The creation of the schedule object does not need to appear in the
|
948
956
|
configuration before objects that use it."
|
@@ -1020,40 +1028,40 @@ class Type
|
|
1020
1028
|
|
1021
1029
|
newmetaparam(:alias) do
|
1022
1030
|
desc "Creates an alias for the object. Puppet uses this internally when you
|
1023
|
-
provide a symbolic name
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1031
|
+
provide a symbolic name:
|
1032
|
+
|
1033
|
+
file { sshdconfig:
|
1034
|
+
path => $operatingsystem ? {
|
1035
|
+
solaris => \"/usr/local/etc/ssh/sshd_config\",
|
1036
|
+
default => \"/etc/ssh/sshd_config\"
|
1037
|
+
},
|
1038
|
+
source => \"...\"
|
1039
|
+
}
|
1032
1040
|
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1041
|
+
service { sshd:
|
1042
|
+
subscribe => File[sshdconfig]
|
1043
|
+
}
|
1036
1044
|
|
1037
|
-
When you use this feature, the parser sets
|
1045
|
+
When you use this feature, the parser sets `sshdconfig` as the name,
|
1038
1046
|
and the library sets that as an alias for the file so the dependency
|
1039
|
-
lookup for
|
1047
|
+
lookup for `sshd` works. You can use this parameter yourself,
|
1040
1048
|
but note that only the library can use these aliases; for instance,
|
1041
|
-
the following code will not work
|
1049
|
+
the following code will not work:
|
1042
1050
|
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1051
|
+
file { \"/etc/ssh/sshd_config\":
|
1052
|
+
owner => root,
|
1053
|
+
group => root,
|
1054
|
+
alias => sshdconfig
|
1055
|
+
}
|
1048
1056
|
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1057
|
+
file { sshdconfig:
|
1058
|
+
mode => 644
|
1059
|
+
}
|
1052
1060
|
|
1053
1061
|
There's no way here for the Puppet parser to know that these two stanzas
|
1054
1062
|
should be affecting the same file.
|
1055
1063
|
|
1056
|
-
See the
|
1064
|
+
See the [Language Tutorial](http://docs.puppetlabs.com/guides/language_tutorial.html) for more information.
|
1057
1065
|
|
1058
1066
|
"
|
1059
1067
|
|
@@ -1083,9 +1091,9 @@ class Type
|
|
1083
1091
|
be useful to add your own tags to a given resource.
|
1084
1092
|
|
1085
1093
|
Tags are currently useful for things like applying a subset of a
|
1086
|
-
host's configuration
|
1094
|
+
host's configuration:
|
1087
1095
|
|
1088
|
-
|
1096
|
+
puppet agent --test --tags mytag
|
1089
1097
|
|
1090
1098
|
This way, when you're testing a configuration you can run just the
|
1091
1099
|
portion you're testing."
|
@@ -1189,23 +1197,23 @@ class Type
|
|
1189
1197
|
newmetaparam(:require, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :NONE}) do
|
1190
1198
|
desc "One or more objects that this object depends on.
|
1191
1199
|
This is used purely for guaranteeing that changes to required objects
|
1192
|
-
happen before the dependent object. For instance
|
1200
|
+
happen before the dependent object. For instance:
|
1193
1201
|
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1202
|
+
# Create the destination directory before you copy things down
|
1203
|
+
file { \"/usr/local/scripts\":
|
1204
|
+
ensure => directory
|
1205
|
+
}
|
1198
1206
|
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1207
|
+
file { \"/usr/local/scripts/myscript\":
|
1208
|
+
source => \"puppet://server/module/myscript\",
|
1209
|
+
mode => 755,
|
1210
|
+
require => File[\"/usr/local/scripts\"]
|
1211
|
+
}
|
1204
1212
|
|
1205
1213
|
Multiple dependencies can be specified by providing a comma-seperated list
|
1206
|
-
of resources, enclosed in square brackets
|
1214
|
+
of resources, enclosed in square brackets:
|
1207
1215
|
|
1208
|
-
|
1216
|
+
require => [ File[\"/usr/local\"], File[\"/usr/local/scripts\"] ]
|
1209
1217
|
|
1210
1218
|
Note that Puppet will autorequire everything that it can, and
|
1211
1219
|
there are hooks in place so that it's easy for resources to add new
|
@@ -1219,10 +1227,10 @@ class Type
|
|
1219
1227
|
|
1220
1228
|
Currently, exec resources will autorequire their CWD (if it is
|
1221
1229
|
specified) plus any fully qualified paths that appear in the
|
1222
|
-
command. For instance, if you had an
|
1223
|
-
the
|
1230
|
+
command. For instance, if you had an `exec` command that ran
|
1231
|
+
the `myscript` mentioned above, the above code that pulls the
|
1224
1232
|
file down would be automatically listed as a requirement to the
|
1225
|
-
|
1233
|
+
`exec` code, so that you would always be running againts the
|
1226
1234
|
most recent version.
|
1227
1235
|
"
|
1228
1236
|
end
|
@@ -1230,20 +1238,20 @@ class Type
|
|
1230
1238
|
newmetaparam(:subscribe, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :ALL_EVENTS, :callback => :refresh}) do
|
1231
1239
|
desc "One or more objects that this object depends on. Changes in the
|
1232
1240
|
subscribed to objects result in the dependent objects being
|
1233
|
-
refreshed (e.g., a service will get restarted). For instance
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1241
|
+
refreshed (e.g., a service will get restarted). For instance:
|
1242
|
+
|
1243
|
+
class nagios {
|
1244
|
+
file { \"/etc/nagios/nagios.conf\":
|
1245
|
+
source => \"puppet://server/module/nagios.conf\",
|
1246
|
+
alias => nagconf # just to make things easier for me
|
1247
|
+
}
|
1248
|
+
service { nagios:
|
1249
|
+
ensure => running,
|
1250
|
+
subscribe => File[nagconf]
|
1251
|
+
}
|
1243
1252
|
}
|
1244
|
-
}
|
1245
1253
|
|
1246
|
-
Currently the
|
1254
|
+
Currently the `exec`, `mount` and `service` type support
|
1247
1255
|
refreshing.
|
1248
1256
|
"
|
1249
1257
|
end
|
@@ -1251,18 +1259,18 @@ class Type
|
|
1251
1259
|
newmetaparam(:before, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :NONE}) do
|
1252
1260
|
desc %{This parameter is the opposite of **require** -- it guarantees
|
1253
1261
|
that the specified object is applied later than the specifying
|
1254
|
-
object
|
1262
|
+
object:
|
1255
1263
|
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1264
|
+
file { "/var/nagios/configuration":
|
1265
|
+
source => "...",
|
1266
|
+
recurse => true,
|
1267
|
+
before => Exec["nagios-rebuid"]
|
1268
|
+
}
|
1261
1269
|
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1270
|
+
exec { "nagios-rebuild":
|
1271
|
+
command => "/usr/bin/make",
|
1272
|
+
cwd => "/var/nagios/configuration"
|
1273
|
+
}
|
1266
1274
|
|
1267
1275
|
This will make sure all of the files are up to date before the
|
1268
1276
|
make command is run.}
|
@@ -1270,16 +1278,16 @@ class Type
|
|
1270
1278
|
|
1271
1279
|
newmetaparam(:notify, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :ALL_EVENTS, :callback => :refresh}) do
|
1272
1280
|
desc %{This parameter is the opposite of **subscribe** -- it sends events
|
1273
|
-
to the specified object
|
1281
|
+
to the specified object:
|
1274
1282
|
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1283
|
+
file { "/etc/sshd_config":
|
1284
|
+
source => "....",
|
1285
|
+
notify => Service[sshd]
|
1286
|
+
}
|
1279
1287
|
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1288
|
+
service { sshd:
|
1289
|
+
ensure => running
|
1290
|
+
}
|
1283
1291
|
|
1284
1292
|
This will restart the sshd service if the sshd config file changes.}
|
1285
1293
|
end
|
@@ -1293,24 +1301,24 @@ class Type
|
|
1293
1301
|
By default, all classes get directly added to the
|
1294
1302
|
'main' stage. You can create new stages as resources:
|
1295
1303
|
|
1296
|
-
|
1304
|
+
stage { [pre, post]: }
|
1297
1305
|
|
1298
1306
|
To order stages, use standard relationships:
|
1299
1307
|
|
1300
|
-
|
1308
|
+
stage { pre: before => Stage[main] }
|
1301
1309
|
|
1302
1310
|
Or use the new relationship syntax:
|
1303
1311
|
|
1304
|
-
|
1312
|
+
Stage[pre] -> Stage[main] -> Stage[post]
|
1305
1313
|
|
1306
1314
|
Then use the new class parameters to specify a stage:
|
1307
1315
|
|
1308
|
-
|
1316
|
+
class { foo: stage => pre }
|
1309
1317
|
|
1310
1318
|
Stages can only be set on classes, not individual resources. This will
|
1311
|
-
fail
|
1319
|
+
fail:
|
1312
1320
|
|
1313
|
-
|
1321
|
+
file { '/foo': stage => pre, ensure => file }
|
1314
1322
|
}
|
1315
1323
|
end
|
1316
1324
|
|
data/lib/puppet/type/augeas.rb
CHANGED
@@ -28,27 +28,28 @@ Puppet::Type.newtype(:augeas) do
|
|
28
28
|
via the augeas tool.
|
29
29
|
|
30
30
|
Requires:
|
31
|
-
- augeas to be installed (http://www.augeas.net)
|
32
|
-
- ruby-augeas bindings
|
33
31
|
|
34
|
-
|
32
|
+
- augeas to be installed (http://www.augeas.net)
|
33
|
+
- ruby-augeas bindings
|
35
34
|
|
36
|
-
|
37
|
-
context => \"/files/etc/sysconfig/firstboot\",
|
38
|
-
changes => \"set RUN_FIRSTBOOT YES\",
|
39
|
-
onlyif => \"match other_value size > 0\",
|
40
|
-
}
|
35
|
+
Sample usage with a string:
|
41
36
|
|
42
|
-
|
37
|
+
augeas{\"test1\" :
|
38
|
+
context => \"/files/etc/sysconfig/firstboot\",
|
39
|
+
changes => \"set RUN_FIRSTBOOT YES\",
|
40
|
+
onlyif => \"match other_value size > 0\",
|
41
|
+
}
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
\"
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
43
|
+
Sample usage with an array and custom lenses:
|
44
|
+
|
45
|
+
augeas{\"jboss_conf\":
|
46
|
+
context => \"/files\",
|
47
|
+
changes => [
|
48
|
+
\"set /etc/jbossas/jbossas.conf/JBOSS_IP $ipaddress\",
|
49
|
+
\"set /etc/jbossas/jbossas.conf/JAVA_HOME /usr\"
|
50
|
+
],
|
51
|
+
load_path => \"$/usr/share/jbossas/lenses\",
|
52
|
+
}
|
52
53
|
|
53
54
|
"
|
54
55
|
|
@@ -71,23 +72,23 @@ Puppet::Type.newtype(:augeas) do
|
|
71
72
|
|
72
73
|
newparam (:onlyif) do
|
73
74
|
desc "Optional augeas command and comparisons to control the execution of this type.
|
74
|
-
Supported onlyif syntax
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
where
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
75
|
+
Supported onlyif syntax:
|
76
|
+
|
77
|
+
get [AUGEAS_PATH] [COMPARATOR] [STRING]
|
78
|
+
match [MATCH_PATH] size [COMPARATOR] [INT]
|
79
|
+
match [MATCH_PATH] include [STRING]
|
80
|
+
match [MATCH_PATH] not_include [STRING]
|
81
|
+
match [MATCH_PATH] == [AN_ARRAY]
|
82
|
+
match [MATCH_PATH] != [AN_ARRAY]
|
83
|
+
|
84
|
+
where:
|
85
|
+
|
86
|
+
AUGEAS_PATH is a valid path scoped by the context
|
87
|
+
MATCH_PATH is a valid match synatx scoped by the context
|
88
|
+
COMPARATOR is in the set [> >= != == <= <]
|
89
|
+
STRING is a string
|
90
|
+
INT is a number
|
91
|
+
AN_ARRAY is in the form ['a string', 'another']"
|
91
92
|
defaultto ""
|
92
93
|
end
|
93
94
|
|
@@ -95,16 +96,14 @@ Puppet::Type.newtype(:augeas) do
|
|
95
96
|
newparam(:changes) do
|
96
97
|
desc "The changes which should be applied to the filesystem. This
|
97
98
|
can be either a string which contains a command or an array of commands.
|
98
|
-
Commands supported are
|
99
|
+
Commands supported are:
|
99
100
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
insert [LABEL] [WHERE] [PATH]
|
107
|
-
Synonym for ins
|
101
|
+
set [PATH] [VALUE] Sets the value VALUE at loction PATH
|
102
|
+
rm [PATH] Removes the node at location PATH
|
103
|
+
remove [PATH] Synonym for rm
|
104
|
+
clear [PATH] Keeps the node at PATH, but removes the value.
|
105
|
+
ins [LABEL] [WHERE] [PATH] Inserts an empty node LABEL either [WHERE={before|after}] PATH.
|
106
|
+
insert [LABEL] [WHERE] [PATH] Synonym for ins
|
108
107
|
|
109
108
|
If the parameter 'context' is set that value is prepended to PATH"
|
110
109
|
end
|
@@ -136,11 +135,11 @@ Puppet::Type.newtype(:augeas) do
|
|
136
135
|
end
|
137
136
|
|
138
137
|
newparam(:lens) do
|
139
|
-
desc "Use a specific lens, e.g.
|
138
|
+
desc "Use a specific lens, e.g. `Hosts.lns`. When this parameter is set, you must also set the incl parameter to indicate which file to load. Only that file will be loaded, which greatly speeds up execution of the type"
|
140
139
|
end
|
141
140
|
|
142
141
|
newparam(:incl) do
|
143
|
-
desc "Load only a specific file, e.g.
|
142
|
+
desc "Load only a specific file, e.g. `/etc/hosts`. When this parameter is set, you must also set the lens parameter to indicate which lens to use."
|
144
143
|
end
|
145
144
|
|
146
145
|
validate do
|