From f59cfc8533e21d45a42a429cf11fcc2cea2cc482 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Sun, 29 Aug 2010 10:19:34 +1000 Subject: Fixed terminus example documentation --- lib/puppet/indirector/node/exec.rb | 2 +- lib/puppet/indirector/node/ldap.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/indirector/node/exec.rb b/lib/puppet/indirector/node/exec.rb index c3e690943..6e065c6f3 100644 --- a/lib/puppet/indirector/node/exec.rb +++ b/lib/puppet/indirector/node/exec.rb @@ -3,7 +3,7 @@ require 'puppet/indirector/exec' class Puppet::Node::Exec < Puppet::Indirector::Exec desc "Call an external program to get node information. See - the `ExternalNodes`:trac: page for more information." + the [External Nodes](http://docs.puppetlabs.com/guides/external_nodes.html) page for more information." include Puppet::Util def command diff --git a/lib/puppet/indirector/node/ldap.rb b/lib/puppet/indirector/node/ldap.rb index ecebc8279..5fd738511 100644 --- a/lib/puppet/indirector/node/ldap.rb +++ b/lib/puppet/indirector/node/ldap.rb @@ -3,9 +3,9 @@ require 'puppet/indirector/ldap' class Puppet::Node::Ldap < Puppet::Indirector::Ldap desc "Search in LDAP for node configuration information. See - the `LdapNodes`:trac: page for more information. This will first + the [LDAP Nodes](http://projects.puppetlabs.com/projects/puppet/wiki/Ldap_Nodes) page for more information. This will first search for whatever the certificate name is, then (if that name - contains a '.') for the short name, then 'default'." + contains a `.`) for the short name, then `default`." # The attributes that Puppet class information is stored in. def class_attributes @@ -34,7 +34,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap node = nil names.each do |name| next unless info = name2hash(name) - + break if node = info2node(request.key, info) end -- cgit From e783a16fbc2c856c212094b4a787a08c16536a0d Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Fri, 13 Aug 2010 13:32:33 -0700 Subject: Fix for #4506 -- too much data being serialized The serialization of much of the memory image was being triggered by a copy of an unchanging method return value in an instance variable. I had introduced this as a performance hack. The results were correct, but when the object was serialized it took a huge amount of data with it (known_resource_types, and from there...) As the underlying costly operation is no longer being called (thanks to Paul and Jesse) the caching is no longer a significant performance boost, and can thus simply be removed. --- lib/puppet/resource.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet') diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index c4e52af18..39803b077 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -193,7 +193,7 @@ class Puppet::Resource end def resource_type - @resource_type ||= case type + case type when "Class"; known_resource_types.hostclass(title == :main ? "" : title) when "Node"; known_resource_types.node(title) else -- cgit From 0056d4174959a4f07d669eae7b6a768d18891594 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Thu, 26 Aug 2010 15:13:52 +1000 Subject: Fixed extlookup documentation and spacing --- lib/puppet/parser/functions/extlookup.rb | 275 +++++++++++++++---------------- lib/puppet/parser/functions/require.rb | 2 +- 2 files changed, 134 insertions(+), 143 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/parser/functions/extlookup.rb b/lib/puppet/parser/functions/extlookup.rb index a4786f5da..63d49e563 100644 --- a/lib/puppet/parser/functions/extlookup.rb +++ b/lib/puppet/parser/functions/extlookup.rb @@ -1,166 +1,157 @@ -# Puppet External Data Sources -# -# This is a parser function to read data from external files, this version -# uses CSV files but the concept can easily be adjust for databases, yaml -# or any other queryable data source. -# -# The object of this is to make it obvious when it's being used, rather than -# magically loading data in when an module is loaded I prefer to look at the code -# and see statements like: -# -# $snmp_contact = extlookup("snmp_contact") -# -# The above snippet will load the snmp_contact value from CSV files, this in its -# own is useful but a common construct in puppet manifests is something like this: -# -# case $domain { -# "myclient.com": { $snmp_contact = "John Doe " } -# default: { $snmp_contact = "My Support " } -# } -# -# Over time there will be a lot of this kind of thing spread all over your manifests -# and adding an additional client involves grepping through manifests to find all the -# places where you have constructs like this. -# -# This is a data problem and shouldn't be handled in code, a using this function you -# can do just that. -# -# First you configure it in site.pp: -# $extlookup_datadir = "/etc/puppet/manifests/extdata" -# $extlookup_precedence = ["%{fqdn}", "domain_%{domain}", "common"] -# -# The array tells the code how to resolve values, first it will try to find it in -# web1.myclient.com.csv then in domain_myclient.com.csv and finally in common.csv -# -# Now create the following data files in /etc/puppet/manifests/extdata -# -# domain_myclient.com.csv: -# snmp_contact,John Doe -# root_contact,support@%{domain} -# client_trusted_ips,192.168.1.130,192.168.10.0/24 -# -# common.csv: -# snmp_contact,My Support -# root_contact,support@my.com -# -# Now you can replace the case statement with the simple single line to achieve -# the exact same outcome: -# -# $snmp_contact = extlookup("snmp_contact") -# -# The obove code shows some other features, you can use any fact or variable that -# is in scope by simply using %{varname} in your data files, you can return arrays -# by just having multiple values in the csv after the initial variable name. -# -# In the event that a variable is nowhere to be found a critical error will be raised -# that will prevent your manifest from compiling, this is to avoid accidentally putting -# in empty values etc. You can however specify a default value: -# -# $ntp_servers = extlookup("ntp_servers", "1.${country}.pool.ntp.org") -# -# In this case it will default to "1.${country}.pool.ntp.org" if nothing is defined in -# any data file. -# -# You can also specify an additional data file to search first before any others at use -# time, for example: -# -# $version = extlookup("rsyslog_version", "present", "packages") -# -# package{"rsyslog": ensure => $version } -# -# This will look for a version configured in packages.csv and then in the rest as configured -# by $extlookup_precedence if it's not found anywhere it will default to "present", this kind -# of use case makes puppet a lot nicer for managing large amounts of packages since you do not -# need to edit a load of manifests to do simple things like adjust a desired version number. -# -# For more information on installing and writing your own custom functions see: -# http://docs.puppetlabs.com/guides/custom_functions.html -# -# For further help contact Volcane on #puppet require 'csv' module Puppet::Parser::Functions - newfunction(:extlookup, :type => :rvalue) do |args| - key = args[0] - - default = args[1] - datafile = args[2] - - raise Puppet::ParseError, ("extlookup(): wrong number of arguments (#{args.length}; must be <= 3)") if args.length > 3 - - extlookup_datadir = lookupvar('extlookup_datadir') - extlookup_precedence = Array.new - - # precedence values can have variables embedded in them - # in the form %{fqdn}, you could for example do - # - # $extlookup_precedence = ["hosts/%{fqdn}", "common"] - # - # this will result in /path/to/extdata/hosts/your.box.com.csv - # being searched. - # - # This is for back compatibility to interpolate variables with %. - # % interpolation is a workaround for a problem that has been fixed: Puppet variable - # interpolation at top scope used to only happen on each run - extlookup_precedence = lookupvar('extlookup_precedence').collect do |var| - var.gsub(/%\{(.+?)\}/) do |capture| - lookupvar($1) - end - end + newfunction(:extlookup, + :type => :rvalue, + :doc => "This is a parser function to read data from external files, this version +uses CSV files but the concept can easily be adjust for databases, yaml +or any other queryable data source. - datafiles = Array.new +The object of this is to make it obvious when it's being used, rather than +magically loading data in when an module is loaded I prefer to look at the code +and see statements like: - # if we got a custom data file, put it first in the array of search files - if datafile != "" - datafiles << extlookup_datadir + "/#{datafile}.csv" if File.exists?(extlookup_datadir + "/#{datafile}.csv") - end + $snmp_contact = extlookup(\"snmp_contact\") + +The above snippet will load the snmp_contact value from CSV files, this in its +own is useful but a common construct in puppet manifests is something like this: + + case $domain { + \"myclient.com\": { $snmp_contact = \"John Doe \" } + default: { $snmp_contact = \"My Support \" } + } + +Over time there will be a lot of this kind of thing spread all over your manifests +and adding an additional client involves grepping through manifests to find all the +places where you have constructs like this. + +This is a data problem and shouldn't be handled in code, a using this function you +can do just that. + +First you configure it in site.pp: + + $extlookup_datadir = \"/etc/puppet/manifests/extdata\" + $extlookup_precedence = [\"%{fqdn}\", \"domain_%{domain}\", \"common\"] + +The array tells the code how to resolve values, first it will try to find it in +web1.myclient.com.csv then in domain_myclient.com.csv and finally in common.csv + +Now create the following data files in /etc/puppet/manifests/extdata: + + domain_myclient.com.csv: + snmp_contact,John Doe + root_contact,support@%{domain} + client_trusted_ips,192.168.1.130,192.168.10.0/24 + + common.csv: + snmp_contact,My Support + root_contact,support@my.com + +Now you can replace the case statement with the simple single line to achieve +the exact same outcome: + + $snmp_contact = extlookup(\"snmp_contact\") + +The obove code shows some other features, you can use any fact or variable that +is in scope by simply using %{varname} in your data files, you can return arrays +by just having multiple values in the csv after the initial variable name. + +In the event that a variable is nowhere to be found a critical error will be raised +that will prevent your manifest from compiling, this is to avoid accidentally putting +in empty values etc. You can however specify a default value: + + $ntp_servers = extlookup(\"ntp_servers\", \"1.${country}.pool.ntp.org\") + +In this case it will default to \"1.${country}.pool.ntp.org\" if nothing is defined in +any data file. + +You can also specify an additional data file to search first before any others at use +time, for example: + + $version = extlookup(\"rsyslog_version\", \"present\", \"packages\") + package{\"rsyslog\": ensure => $version } - extlookup_precedence.each do |d| - datafiles << extlookup_datadir + "/#{d}.csv" +This will look for a version configured in packages.csv and then in the rest as configured +by $extlookup_precedence if it's not found anywhere it will default to `present`, this kind +of use case makes puppet a lot nicer for managing large amounts of packages since you do not +need to edit a load of manifests to do simple things like adjust a desired version number. + +Precedence values can have variables embedded in them in the form %{fqdn}, you could for example do: + + $extlookup_precedence = [\"hosts/%{fqdn}\", \"common\"] + +This will result in /path/to/extdata/hosts/your.box.com.csv being searched. + +This is for back compatibility to interpolate variables with %. % interpolation is a workaround for a problem that has been fixed: Puppet variable interpolation at top scope used to only happen on each run.") do |args| + + key = args[0] + + default = args[1] + datafile = args[2] + + raise Puppet::ParseError, ("extlookup(): wrong number of arguments (#{args.length}; must be <= 3)") if args.length > 3 + + extlookup_datadir = lookupvar('extlookup_datadir') + extlookup_precedence = Array.new + + extlookup_precedence = lookupvar('extlookup_precedence').collect do |var| + var.gsub(/%\{(.+?)\}/) do |capture| + lookupvar($1) end + end - desired = nil + datafiles = Array.new - datafiles.each do |file| - if desired.nil? - if File.exists?(file) - result = CSV.read(file).find_all do |r| - r[0] == key - end + # if we got a custom data file, put it first in the array of search files + if datafile != "" + datafiles << extlookup_datadir + "/#{datafile}.csv" if File.exists?(extlookup_datadir + "/#{datafile}.csv") + end + extlookup_precedence.each do |d| + datafiles << extlookup_datadir + "/#{d}.csv" + end - # return just the single result if theres just one, - # else take all the fields in the csv and build an array - if result.length > 0 - if result[0].length == 2 - val = result[0][1].to_s + desired = nil - # parse %{}'s in the CSV into local variables using lookupvar() - while val =~ /%\{(.+?)\}/ - val.gsub!(/%\{#{$1}\}/, lookupvar($1)) - end + datafiles.each do |file| + if desired.nil? + if File.exists?(file) + result = CSV.read(file).find_all do |r| + r[0] == key + end - desired = val - elsif result[0].length > 1 - length = result[0].length - cells = result[0][1,length] + # return just the single result if theres just one, + # else take all the fields in the csv and build an array + if result.length > 0 + if result[0].length == 2 + val = result[0][1].to_s - # Individual cells in a CSV result are a weird data type and throws - # puppets yaml parsing, so just map it all to plain old strings - desired = cells.map do |c| - # parse %{}'s in the CSV into local variables using lookupvar() - while c =~ /%\{(.+?)\}/ - c.gsub!(/%\{#{$1}\}/, lookupvar($1)) - end + # parse %{}'s in the CSV into local variables using lookupvar() + while val =~ /%\{(.+?)\}/ + val.gsub!(/%\{#{$1}\}/, lookupvar($1)) + end + + desired = val + elsif result[0].length > 1 + length = result[0].length + cells = result[0][1,length] - c.to_s + # Individual cells in a CSV result are a weird data type and throws + # puppets yaml parsing, so just map it all to plain old strings + desired = cells.map do |c| + # parse %{}'s in the CSV into local variables using lookupvar() + while c =~ /%\{(.+?)\}/ + c.gsub!(/%\{#{$1}\}/, lookupvar($1)) end + + c.to_s end end end end end + end - desired || default or raise Puppet::ParseError, "No match found for '#{key}' in any data file during extlookup()" + desired || default or raise Puppet::ParseError, "No match found for '#{key}' in any data file during extlookup()" end end diff --git a/lib/puppet/parser/functions/require.rb b/lib/puppet/parser/functions/require.rb index f15046b91..64285307e 100644 --- a/lib/puppet/parser/functions/require.rb +++ b/lib/puppet/parser/functions/require.rb @@ -12,7 +12,7 @@ relationships between classes. This function is a superset of the class depends on the required class. Warning: using require in place of include can lead to unwanted dependency cycles. - + For instance the following manifest, with 'require' instead of 'include' would produce a nasty dependence cycle, because notify imposes a before between File[/foo] and Service[foo]: class myservice { -- cgit From 8cd266e6d421c70db574751dc6d837bd0bbf386b Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Fri, 16 Jul 2010 14:49:26 +1000 Subject: Added cost parameter to the yumrepo type --- lib/puppet/type/yumrepo.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/puppet') diff --git a/lib/puppet/type/yumrepo.rb b/lib/puppet/type/yumrepo.rb index 698c077f4..a3b35b34b 100644 --- a/lib/puppet/type/yumrepo.rb +++ b/lib/puppet/type/yumrepo.rb @@ -325,6 +325,12 @@ module Puppet newvalue(%r{[1-9][0-9]?}) { } end + newproperty(:cost, :parent => Puppet::IniProperty) do + desc "Cost of this repository.\n#{ABSENT_DOC}" + newvalue(:absent) { self.should = :absent } + newvalue(%r{\d+}) { } + end + newproperty(:proxy, :parent => Puppet::IniProperty) do desc "URL to the proxy server for this repository.\n#{ABSENT_DOC}" newvalue(:absent) { self.should = :absent } -- cgit From 8d248616c6dd05509a1a7d3f8f098c295c9eae43 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Sun, 25 Jul 2010 09:43:57 +1000 Subject: Fixed #4100 - Added http_caching to yumrepo type --- lib/puppet/type/yumrepo.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/puppet') diff --git a/lib/puppet/type/yumrepo.rb b/lib/puppet/type/yumrepo.rb index a3b35b34b..160b2164d 100644 --- a/lib/puppet/type/yumrepo.rb +++ b/lib/puppet/type/yumrepo.rb @@ -295,6 +295,12 @@ module Puppet newvalue(%r{(0|1)}) { } end + newproperty(:http_caching, :parent => Puppet::IniProperty) do + desc "Either 'packages' or 'all' or 'none'.\n#{ABSENT_DOC}" + newvalue(:absent) { self.should = :absent } + newvalue(%r(packages|all|none)) { } + end + newproperty(:timeout, :parent => Puppet::IniProperty) do desc "Number of seconds to wait for a connection before timing out.\n#{ABSENT_DOC}" -- cgit From f6c0265f4e7e113980c1026441e4ad05ca2e8f3d Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Fri, 3 Sep 2010 02:55:10 +1000 Subject: Fixed queue require for #4555 --- lib/puppet/application/queue.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet') diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb index 6c90ca0a1..239f6b2ad 100644 --- a/lib/puppet/application/queue.rb +++ b/lib/puppet/application/queue.rb @@ -38,7 +38,7 @@ class Puppet::Application::Queue < Puppet::Application option("--verbose","-v") def main - require 'lib/puppet/indirector/catalog/queue' # provides Puppet::Indirector::Queue.subscribe + require 'puppet/indirector/catalog/queue' # provides Puppet::Indirector::Queue.subscribe Puppet.notice "Starting puppetqd #{Puppet.version}" Puppet::Resource::Catalog::Queue.subscribe do |catalog| # Once you have a Puppet::Resource::Catalog instance, calling save on it should suffice -- cgit From b06363549a8cd9371ee798ac2613bdcdc5837f12 Mon Sep 17 00:00:00 2001 From: Dean Wilson Date: Fri, 13 Aug 2010 13:50:52 +0100 Subject: Skip apt-listbugs and apt-listchanges when installing from puppet --- lib/puppet/provider/package/apt.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/puppet') diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb index b6ded39fd..2fc787419 100755 --- a/lib/puppet/provider/package/apt.rb +++ b/lib/puppet/provider/package/apt.rb @@ -14,6 +14,10 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do ENV['DEBIAN_FRONTEND'] = "noninteractive" + # disable common apt helpers to allow non-interactive package installs + ENV['APT_LISTBUGS_FRONTEND'] = "none" + ENV['APT_LISTCHANGES_FRONTEND'] = "none" + # A derivative of DPKG; this is how most people actually manage # Debian boxes, and the only thing that differs is that it can # install packages from remote sites. -- cgit From 4d36a5152ac8e183f04bdbc6e8a7d3cdbb5ba8ce Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Tue, 7 Sep 2010 06:23:01 +1000 Subject: Fixed alias metaparam docs error --- lib/puppet/type.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet') diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 53c23aa32..291179a02 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -1031,7 +1031,7 @@ class Type } service { sshd: - subscribe => file[sshdconfig] + subscribe => File[sshdconfig] } When you use this feature, the parser sets `sshdconfig` as the name, -- cgit From e91a8cc975216501f764f5f2dea40d72154dc426 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 13 Aug 2010 12:24:08 -0700 Subject: [#4462] uncaught Timeout::Error puppet agent was not catching all species of exceptions, causing it to crash on net/http timeout errors. This patch broadens the types of exceptions that are caught. --- lib/puppet/agent.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/puppet') diff --git a/lib/puppet/agent.rb b/lib/puppet/agent.rb index 52acc64aa..47dd44a0e 100644 --- a/lib/puppet/agent.rb +++ b/lib/puppet/agent.rb @@ -37,7 +37,9 @@ class Puppet::Agent with_client do |client| begin sync.synchronize { lock { result = client.run(*args) } } - rescue => detail + rescue SystemExit,NoMemoryError + raise + rescue Exception => detail puts detail.backtrace if Puppet[:trace] Puppet.err "Could not run #{client_class}: #{detail}" end -- cgit From b397b698314daae36f59751521be113cfd337095 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sat, 21 Aug 2010 19:44:06 -0700 Subject: Fix for #4489 -- apply was using the rest terminus Basing pervasive low-level behaviour changes on the application name isn't a good idea, but if we're going to do it we need to remember to update the test when we rename the application. Further, if we optimize around such low-level tests (as we did when implementing file-streaming) we need to carry the tests over into the new data paths. This commit addresses both of these isues, restoring 0.25.x stand-alone file serving by adjusting the process-name test in the indirector to recognize "apply" as standalone (and thus not use http to fetch the files) and by adding a branch to the file streaming code to do the same when fetching the content. I am not certain that this change is globally correct; there may be other related problems that will not be fixed (and may in fact be exacerbated) by this patch. --- lib/puppet/type/file/content.rb | 2 ++ lib/puppet/type/file/source.rb | 10 ++++++++++ 2 files changed, 12 insertions(+) (limited to 'lib/puppet') diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb index 0d0bb5571..f5b65d3fd 100755 --- a/lib/puppet/type/file/content.rb +++ b/lib/puppet/type/file/content.rb @@ -166,6 +166,8 @@ module Puppet yield source_or_content elsif source_or_content.nil? yield read_file_from_filebucket + elsif Puppet.settings[:name] == "apply" + yield source_or_content.content elsif source_or_content.local? chunk_file_from_disk(source_or_content) { |chunk| yield chunk } else diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb index 0e7aac72d..7d03de2b0 100755 --- a/lib/puppet/type/file/source.rb +++ b/lib/puppet/type/file/source.rb @@ -94,6 +94,16 @@ module Puppet metadata && metadata.checksum end + # Look up (if necessary) and return remote content. + cached_attr(:content) do + raise Puppet::DevError, "No source for content was stored with the metadata" unless metadata.source + + unless tmp = Puppet::FileServing::Content.find(metadata.source) + fail "Could not find any content at %s" % metadata.source + end + tmp.content + end + # Copy the values from the source to the resource. Yay. def copy_source_values devfail "Somehow got asked to copy source values without any metadata" unless metadata -- cgit From 4d55c6e72f2576fe7ab27f874db030de5ab6fcee Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sat, 4 Sep 2010 18:45:09 -0700 Subject: Fix for tests broken by fix for #4489 -- stub standalone If the file streaming is to be thwarted when running standalone the test for standalone needs to be stubbed when running specs, lest the tests inexplicably fail. --- lib/puppet/type/file/content.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/puppet') diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb index f5b65d3fd..b8f30a9c7 100755 --- a/lib/puppet/type/file/content.rb +++ b/lib/puppet/type/file/content.rb @@ -161,12 +161,16 @@ module Puppet } end + def self.standalone? + Puppet.settings[:name] == "apply" + end + def each_chunk_from(source_or_content) if source_or_content.is_a?(String) yield source_or_content elsif source_or_content.nil? yield read_file_from_filebucket - elsif Puppet.settings[:name] == "apply" + elsif self.class.standalone? yield source_or_content.content elsif source_or_content.local? chunk_file_from_disk(source_or_content) { |chunk| yield chunk } -- cgit From 4a9c85763b7bf2db6da52daa9e8221eb59ffa9d2 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sun, 5 Sep 2010 11:26:58 -0700 Subject: Fix for #4693 -- implicit stages should never be serialized My fix for #4542 was overly enthusiastic about assuring that all resources had a stage, resulting in stages designations being serialized for resources in manifests which did not use resources (everything was in implicit main). This broke 0.25.x compatibility, as all catalogs now refered to stages. This patch scales back the change for #4542 slightly, supressing the setting of main on the puppetmaster and relying on the default behaviour on the client (for 2.6.x and later, treat it as main; for 0.25.x, do nothing). --- lib/puppet/parser/compiler.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet') diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index 7504b276b..e1227e753 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -71,7 +71,7 @@ class Puppet::Parser::Compiler raise ArgumentError, "Could not find stage #{resource[:stage] || :main} specified by #{resource}" end - resource[:stage] ||= stage.title + resource[:stage] ||= stage.title unless stage.title == :main @catalog.add_edge(stage, resource) end -- cgit From 763e7cb6f3f8e1104ab1da515701de1dfc8f57e9 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Mon, 6 Sep 2010 11:09:15 -0700 Subject: Minimal fix for #4691 -- class name uppercased in $name The class name is now stored internally with an initial capital, which changed the contents of $name in a way that broke some manifests. This fix stores the downcased version in $name. --- lib/puppet/resource/type.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet') diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb index f6d378512..1d378aaa6 100644 --- a/lib/puppet/resource/type.rb +++ b/lib/puppet/resource/type.rb @@ -234,7 +234,7 @@ class Puppet::Resource::Type end scope.setvar("title", resource.title) unless set.include? :title - scope.setvar("name", resource.name) unless set.include? :name + scope.setvar("name", resource.name.to_s.downcase) unless set.include? :name scope.setvar("module_name", module_name) if module_name and ! set.include? :module_name if caller_name = scope.parent_module_name and ! set.include?(:caller_module_name) -- cgit