diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/defaults.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/network/http_server/mongrel.rb | 7 | ||||
| -rw-r--r-- | lib/puppet/network/xmlrpc/client.rb | 13 | ||||
| -rw-r--r-- | lib/puppet/parser/compile.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/parser/resource.rb | 35 | ||||
| -rwxr-xr-x | lib/puppet/provider/package/fink.rb | 2 | ||||
| -rwxr-xr-x | lib/puppet/provider/sshkey/parsed.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/transaction.rb | 2 | ||||
| -rwxr-xr-x | lib/puppet/type/pfile/ensure.rb | 5 | ||||
| -rwxr-xr-x | lib/puppet/type/pfile/source.rb | 4 | ||||
| -rwxr-xr-x | lib/puppet/type/sshkey.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/util/tagging.rb | 34 |
12 files changed, 83 insertions, 36 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index a95023895..0c8ac3f82 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -66,7 +66,11 @@ module Puppet :owner => "root", :desc => "Where SSL certificates are kept." }, - :rundir => { :default => rundir, + :rundir => { + :default => rundir, + :mode => 01777, + :owner => "$user", + :group => "$group", :desc => "Where Puppet PID files are kept." }, :genconfig => [false, diff --git a/lib/puppet/network/http_server/mongrel.rb b/lib/puppet/network/http_server/mongrel.rb index d6e21b189..d340f3d63 100644 --- a/lib/puppet/network/http_server/mongrel.rb +++ b/lib/puppet/network/http_server/mongrel.rb @@ -127,7 +127,12 @@ module Puppet::Network client = dn_matchdata[1].to_str valid = (params[Puppet[:ssl_client_verify_header]] == 'SUCCESS') else - client = Resolv.getname(ip) + begin + client = Resolv.getname(ip) + rescue => detail + Puppet.err "Could not resolve %s: %s" % [ip, detail] + client = "unknown" + end valid = false end diff --git a/lib/puppet/network/xmlrpc/client.rb b/lib/puppet/network/xmlrpc/client.rb index 27bb3dc5e..f6a5e8db6 100644 --- a/lib/puppet/network/xmlrpc/client.rb +++ b/lib/puppet/network/xmlrpc/client.rb @@ -90,6 +90,13 @@ module Puppet::Network @clients[handler] || self.mkclient(handler) end + def http + unless @http + @http = Puppet::Network::HttpPool.http_instance(@host, @port, true) + end + @http + end + def initialize(hash = {}) hash[:Path] ||= "/RPC2" hash[:Server] ||= Puppet[:server] @@ -125,7 +132,11 @@ module Puppet::Network end def start - @http.start unless @http.started? + begin + @http.start unless @http.started? + rescue => detail + Puppet.err "Could not connect to server: %s" % detail + end end def local diff --git a/lib/puppet/parser/compile.rb b/lib/puppet/parser/compile.rb index f76103a28..e1e230d48 100644 --- a/lib/puppet/parser/compile.rb +++ b/lib/puppet/parser/compile.rb @@ -309,6 +309,9 @@ class Puppet::Parser::Compile done = false if evaluate_collections done = false if evaluate_definitions break if done + + count += 1 + if count > 1000 raise Puppet::ParseError, "Somehow looped more than 1000 times while evaluating host catalog" end diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index 3f346166e..7dc42ccec 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -3,18 +3,18 @@ class Puppet::Parser::Resource require 'puppet/parser/resource/param' require 'puppet/parser/resource/reference' + require 'puppet/util/tagging' include Puppet::Util include Puppet::Util::MethodHelper include Puppet::Util::Errors include Puppet::Util::Logging + include Puppet::Util::Tagging attr_accessor :source, :line, :file, :scope, :rails_id attr_accessor :virtual, :override, :translated attr_reader :exported, :evaluated, :params - attr_writer :tags - # Determine whether the provided parameter name is a relationship parameter. def self.relationship_parameter?(name) unless defined?(@relationship_names) @@ -86,6 +86,7 @@ class Puppet::Parser::Resource add_overrides() add_defaults() add_metaparams() + add_scope_tags() validate() end @@ -130,13 +131,8 @@ class Puppet::Parser::Resource raise ArgumentError, "Resources do not accept %s" % options.keys.collect { |k| k.to_s }.join(", ") end - @tags = [] tag(@ref.type) - tag(@ref.title) if @ref.title.to_s =~ /^[-\w]+$/ - - if scope.resource - @tags += scope.resource.tags - end + tag(@ref.title) if valid_tag?(@ref.title.to_s) end # Merge an override resource in. This will throw exceptions if @@ -223,23 +219,6 @@ class Puppet::Parser::Resource @ref.to_s end - # Add a tag to our current list. These tags will be added to all - # of the objects contained in this scope. - def tag(*ary) - ary.collect { |tag| tag.to_s.downcase }.collect { |tag| tag.split("::") }.flatten.each do |tag| - unless tag =~ /^\w[-\w]*$/ - fail Puppet::ParseError, "Invalid tag %s" % tag.inspect - end - unless @tags.include?(tag) - @tags << tag - end - end - end - - def tags - @tags.dup - end - def to_hash @params.inject({}) do |hash, ary| param = ary[1] @@ -374,6 +353,12 @@ class Puppet::Parser::Resource end end + def add_scope_tags + if scope_resource = scope.resource + tag(*scope_resource.tags) + end + end + # Accept a parameter from an override. def override_parameter(param) # This can happen if the override is defining a new parameter, rather diff --git a/lib/puppet/provider/package/fink.rb b/lib/puppet/provider/package/fink.rb index e0933df08..030e1a347 100755 --- a/lib/puppet/provider/package/fink.rb +++ b/lib/puppet/provider/package/fink.rb @@ -9,8 +9,6 @@ Puppet::Type.type(:package).provide :fink, :parent => :dpkg, :source => :dpkg do commands :aptcache => "/sw/bin/apt-cache" commands :dpkgquery => "/sw/bin/dpkg-query" - defaultfor :operatingsystem => :darwin - has_feature :versionable # A derivative of DPKG; this is how most people actually manage diff --git a/lib/puppet/provider/sshkey/parsed.rb b/lib/puppet/provider/sshkey/parsed.rb index cb1010c5b..6f7d98f56 100755 --- a/lib/puppet/provider/sshkey/parsed.rb +++ b/lib/puppet/provider/sshkey/parsed.rb @@ -12,6 +12,8 @@ Puppet::Type.type(:sshkey).provide(:parsed, :default_target => known, :filetype => :flat ) do + desc "Parse and generate host-wide known hosts files for SSH." + text_line :comment, :match => /^#/ text_line :blank, :match => /^\s+/ diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 6a4981298..f304cadc6 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -424,7 +424,7 @@ class Transaction # Should we ignore tags? def ignore_tags? - ! @catalog.host_config? + ! (@catalog.host_config? or Puppet[:name] == "puppet") end # this should only be called by a Puppet::Type::Component resource now diff --git a/lib/puppet/type/pfile/ensure.rb b/lib/puppet/type/pfile/ensure.rb index 0a6f73d95..3aa918f65 100755 --- a/lib/puppet/type/pfile/ensure.rb +++ b/lib/puppet/type/pfile/ensure.rb @@ -136,6 +136,11 @@ module Puppet # We have to treat :present specially, because it works with any # type of file. def insync?(currentvalue) + if property = @resource.property(:source) and ! property.described? + warning "No specified sources exist" + return true + end + if self.should == :present if currentvalue.nil? or currentvalue == :absent return false diff --git a/lib/puppet/type/pfile/source.rb b/lib/puppet/type/pfile/source.rb index 1849d5a61..3dfb5cccd 100755 --- a/lib/puppet/type/pfile/source.rb +++ b/lib/puppet/type/pfile/source.rb @@ -138,10 +138,10 @@ module Puppet # Use the info we get from describe() to check if we're in sync. def insync?(currentvalue) unless described? - info "No specified sources exist" + warning "No specified sources exist" return true end - + if currentvalue == :nocopy return true end diff --git a/lib/puppet/type/sshkey.rb b/lib/puppet/type/sshkey.rb index bf4b0aac8..c2bdd39e3 100755 --- a/lib/puppet/type/sshkey.rb +++ b/lib/puppet/type/sshkey.rb @@ -53,14 +53,14 @@ module Puppet end newparam(:name) do - desc "The host name." + desc "The host name that the key is associated with." isnamevar end newproperty(:target) do - desc "The file in which to store the mount table. Only used by - those providers that write to disk (i.e., not NetInfo)." + desc "The file in which to store the ssh key. Only used by + the ``parsed`` provider." defaultto { if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile) @resource.class.defaultprovider.default_target diff --git a/lib/puppet/util/tagging.rb b/lib/puppet/util/tagging.rb new file mode 100644 index 000000000..25d74c420 --- /dev/null +++ b/lib/puppet/util/tagging.rb @@ -0,0 +1,34 @@ +# Created on 2008-01-19 +# Copyright Luke Kanies + +# A common module to handle tagging. +module Puppet::Util::Tagging + # Add a tag to our current list. These tags will be added to all + # of the objects contained in this scope. + def tag(*ary) + @tags ||= [] + + qualified = [] + + ary.collect { |tag| tag.to_s.downcase }.each do |tag| + fail(Puppet::ParseError, "Invalid tag %s" % tag.inspect) unless valid_tag?(tag) + qualified << tag if tag.include?("::") + @tags << tag unless @tags.include?(tag) + end + + qualified.collect { |name| name.split("::") }.flatten.each { |tag| @tags << tag unless @tags.include?(tag) } + end + + # Return a copy of the tag list, so someone can't ask for our tags + # and then modify them. + def tags + @tags ||= [] + @tags.dup + end + + private + + def valid_tag?(tag) + tag =~ /^\w[-\w:]*$/ + end +end |
