summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-02-11 13:51:48 -0600
committerLuke Kanies <luke@madstop.com>2009-02-11 13:51:48 -0600
commita2270b4a4f093c6c4f171dcf0c0e05fe101dd979 (patch)
treef0d893dfe6fe13c8c9e0670c1e5459ec336318ba /lib
parent9bac833dcfdd8d6a00188faee0487e787b7a0101 (diff)
parent6b0c1b9170c69829bdf5956d1dec0949dcc08b35 (diff)
downloadpuppet-a2270b4a4f093c6c4f171dcf0c0e05fe101dd979.tar.gz
puppet-a2270b4a4f093c6c4f171dcf0c0e05fe101dd979.tar.xz
puppet-a2270b4a4f093c6c4f171dcf0c0e05fe101dd979.zip
Merge branch '0.24.x'
Conflicts: CHANGELOG spec/unit/type/file/selinux.rb
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet.rb2
-rwxr-xr-xlib/puppet/external/nagios/base.rb25
-rw-r--r--lib/puppet/external/nagios/grammar.ry11
-rw-r--r--lib/puppet/external/nagios/parser.rb96
-rw-r--r--lib/puppet/parser/ast/astarray.rb3
-rw-r--r--lib/puppet/parser/ast/resource.rb40
-rw-r--r--lib/puppet/parser/collector.rb3
-rw-r--r--lib/puppet/parser/functions/realize.rb2
-rw-r--r--lib/puppet/provider/naginator.rb6
-rwxr-xr-xlib/puppet/provider/parsedfile.rb53
-rw-r--r--lib/puppet/type.rb4
-rw-r--r--lib/puppet/type/file/selcontext.rb8
-rwxr-xr-xlib/puppet/type/user.rb6
-rw-r--r--lib/puppet/type/yumrepo.rb5
-rw-r--r--lib/puppet/util/inifile.rb1
-rw-r--r--lib/puppet/util/nagios_maker.rb4
16 files changed, 137 insertions, 132 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb
index c2d108d7f..2cbf7fb29 100644
--- a/lib/puppet.rb
+++ b/lib/puppet.rb
@@ -24,7 +24,7 @@ require 'puppet/util/suidmanager'
# it's also a place to find top-level commands like 'debug'
module Puppet
- PUPPETVERSION = '0.24.6'
+ PUPPETVERSION = '0.24.7'
def Puppet.version
return PUPPETVERSION
diff --git a/lib/puppet/external/nagios/base.rb b/lib/puppet/external/nagios/base.rb
index 6a0c1831c..d95b808dd 100755
--- a/lib/puppet/external/nagios/base.rb
+++ b/lib/puppet/external/nagios/base.rb
@@ -416,20 +416,18 @@ class Nagios::Base
:dependent_service_description, :host_name, :hostgroup_name,
:service_description, :inherits_parent, :execution_failure_criteria,
:notification_failure_criteria, :dependency_period,
- :register, :use,
- :_naginator_name
+ :register, :use
- setnamevar :_naginator_name
+ setnamevar :service_description
end
newtype :serviceescalation do
setparameters :host_name, :hostgroup_name, :service_description, :contacts,
:contact_groups, :first_notification, :last_notification,
:notification_interval, :escalation_period, :escalation_options,
- :register, :use,
- :_naginator_name
+ :register, :use
- setnamevar :_naginator_name
+ setnamevar :service_description
end
newtype :hostdependency do
@@ -437,20 +435,18 @@ class Nagios::Base
setparameters :dependent_host_name, :dependent_hostgroup_name, :host_name,
:hostgroup_name, :inherits_parent, :execution_failure_criteria,
:notification_failure_criteria, :dependency_period,
- :register, :use,
- :_naginator_name
+ :register, :use
- setnamevar :_naginator_name
+ setnamevar :host_name
end
newtype :hostescalation do
setparameters :host_name, :hostgroup_name, :contacts, :contact_groups,
:first_notification, :last_notification, :notification_interval,
:escalation_period, :escalation_options,
- :register, :use,
- :_naginator_name
+ :register, :use
- setnamevar :_naginator_name
+ setnamevar :host_name
end
newtype :hostextinfo do
@@ -467,10 +463,9 @@ class Nagios::Base
setparameters :host_name, :service_description, :notes, :notes_url,
:action_url, :icon_image, :icon_image_alt,
- :register, :use,
- :_naginator_name
+ :register, :use
- setnamevar :_naginator_name
+ setnamevar :service_description
end
end
diff --git a/lib/puppet/external/nagios/grammar.ry b/lib/puppet/external/nagios/grammar.ry
index f50818f1a..87c909280 100644
--- a/lib/puppet/external/nagios/grammar.ry
+++ b/lib/puppet/external/nagios/grammar.ry
@@ -55,6 +55,8 @@ end
----inner
+class ::Nagios::Parser::SyntaxError < RuntimeError; end
+
def parse(src)
@src = src
@@ -66,12 +68,7 @@ def parse(src)
@line = 0
@yydebug = true
- begin
- do_parse
- rescue SyntaxError
- $stderr.print "#{$!}\n"
- exit
- end
+ do_parse
end
# The lexer. Very simple.
@@ -183,6 +180,6 @@ def on_error(token, value, vstack )
if token == '$end'.intern
puts "okay, this is silly"
else
- raise SyntaxError, msg
+ raise ::Nagios::Parser::SyntaxError, msg
end
end
diff --git a/lib/puppet/external/nagios/parser.rb b/lib/puppet/external/nagios/parser.rb
index b7e2c21d8..d8a8bceea 100644
--- a/lib/puppet/external/nagios/parser.rb
+++ b/lib/puppet/external/nagios/parser.rb
@@ -1,22 +1,20 @@
#
# DO NOT MODIFY!!!!
-# This file is automatically generated by racc 1.4.4
+# This file is automatically generated by racc 1.4.5
# from racc grammer file "grammar.ry".
#
#
# parser.rb: generated by racc (runtime embedded)
#
-
-###### racc/parser.rb
-
+###### racc/parser.rb begin
unless $".index 'racc/parser.rb'
$".push 'racc/parser.rb'
-self.class.module_eval <<'..end /usr/lib/ruby/1.8/racc/parser.rb modeval..id1306b79176', '/usr/lib/ruby/1.8/racc/parser.rb', 1
+self.class.module_eval <<'..end racc/parser.rb modeval..id5256434e8a', 'racc/parser.rb', 1
#
-# parser.rb
+# $Id: parser.rb,v 1.7 2005/11/20 17:31:32 aamine Exp $
#
-# Copyright (c) 1999-2003 Minero Aoki <aamine@loveruby.net>
+# Copyright (c) 1999-2005 Minero Aoki
#
# This program is free software.
# You can distribute/modify this program under the same terms of ruby.
@@ -25,8 +23,6 @@ self.class.module_eval <<'..end /usr/lib/ruby/1.8/racc/parser.rb modeval..id1306
# into a Racc output file, you may use that output file
# without restriction.
#
-# $raccId: parser.rb,v 1.4 2003/11/03 13:41:47 aamine Exp $
-#
unless defined?(NotImplementedError)
NotImplementedError = NotImplementError
@@ -39,7 +35,6 @@ unless defined?(::ParseError)
ParseError = Racc::ParseError
end
-
module Racc
unless defined?(Racc_No_Extentions)
@@ -48,14 +43,14 @@ module Racc
class Parser
- Racc_Runtime_Version = '1.4.4'
- Racc_Runtime_Revision = '$raccRevision: 1.4 $'.split[1]
+ Racc_Runtime_Version = '1.4.5'
+ Racc_Runtime_Revision = '$Revision: 1.7 $'.split[1]
- Racc_Runtime_Core_Version_R = '1.4.4'
- Racc_Runtime_Core_Revision_R = '$raccRevision: 1.4 $'.split[1]
+ Racc_Runtime_Core_Version_R = '1.4.5'
+ Racc_Runtime_Core_Revision_R = '$Revision: 1.7 $'.split[1]
begin
require 'racc/cparse'
- # Racc_Runtime_Core_Version_C = (defined in extension)
+ # Racc_Runtime_Core_Version_C = (defined in extention)
Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
unless new.respond_to?(:_racc_do_parse_c, true)
raise LoadError, 'old cparse.so'
@@ -121,7 +116,7 @@ module Racc
raise NotImplementedError, "#{self.class}\#next_token is not defined"
end
- def _racc_do_parse_rb( arg, in_debug )
+ def _racc_do_parse_rb(arg, in_debug)
action_table, action_check, action_default, action_pointer,
goto_table, goto_check, goto_default, goto_pointer,
nt_base, reduce_table, token_table, shift_n,
@@ -166,11 +161,11 @@ module Racc
### yyparse
###
- def yyparse( recv, mid )
+ def yyparse(recv, mid)
__send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true)
end
- def _racc_yyparse_rb( recv, mid, arg, c_debug )
+ def _racc_yyparse_rb(recv, mid, arg, c_debug)
action_table, action_check, action_default, action_pointer,
goto_table, goto_check, goto_default, goto_pointer,
nt_base, reduce_table, token_table, shift_n,
@@ -189,7 +184,6 @@ module Racc
end
end
recv.__send__(mid) do |tok, val|
-# $stderr.puts "rd: tok=#{tok}, val=#{val}"
unless tok
@racc_t = 0
else
@@ -203,12 +197,7 @@ module Racc
act = action_table[i] and
action_check[i] == @racc_state[-1]
act = action_default[@racc_state[-1]]
-# $stderr.puts "02: act=#{act}"
-# $stderr.puts "curstate=#{@racc_state[-1]}"
- else
-# $stderr.puts "01: act=#{act}"
end
-
while act = _racc_evalact(act, arg)
;
end
@@ -221,9 +210,6 @@ module Racc
act = action_table[i] and
action_check[i] == @racc_state[-1]
act = action_default[@racc_state[-1]]
-# $stderr.puts "04: act=#{act}"
- else
-# $stderr.puts "03: act=#{act}"
end
while act = _racc_evalact(act, arg)
;
@@ -237,13 +223,12 @@ module Racc
### common
###
- def _racc_evalact( act, arg )
-# $stderr.puts "ea: act=#{act}"
+ def _racc_evalact(act, arg)
action_table, action_check, action_default, action_pointer,
goto_table, goto_check, goto_default, goto_pointer,
nt_base, reduce_table, token_table, shift_n,
reduce_n, use_result, * = arg
-nerr = 0 # tmp
+ nerr = 0 # tmp
if act > 0 and act < shift_n
#
@@ -276,7 +261,7 @@ nerr = 0 # tmp
when 2 # yyaccept
return shift_n
else
- raise RuntimeError, '[Racc Bug] unknown jump code'
+ raise '[Racc Bug] unknown jump code'
end
end
@@ -314,7 +299,6 @@ nerr = 0 # tmp
break
end
end
-
throw :racc_end_parse, nil if @racc_state.size <= 1
@racc_state.pop
@racc_vstack.pop
@@ -326,7 +310,7 @@ nerr = 0 # tmp
return act
else
- raise RuntimeError, "[Racc Bug] unknown action #{act.inspect}"
+ raise "[Racc Bug] unknown action #{act.inspect}"
end
racc_next_state(@racc_state[-1], @racc_state) if @yydebug
@@ -334,7 +318,7 @@ nerr = 0 # tmp
nil
end
- def _racc_do_reduce( arg, act )
+ def _racc_do_reduce(arg, act)
action_table, action_check, action_default, action_pointer,
goto_table, goto_check, goto_default, goto_pointer,
nt_base, reduce_table, token_table, shift_n,
@@ -375,7 +359,7 @@ nerr = 0 # tmp
goto_default[k1]
end
- def on_error( t, val, vstack )
+ def on_error(t, val, vstack)
raise ParseError, sprintf("\nparse error on value %s (%s)",
val.inspect, token_to_str(t) || '?')
end
@@ -396,20 +380,20 @@ nerr = 0 # tmp
# for debugging output
#
- def racc_read_token( t, tok, val )
+ def racc_read_token(t, tok, val)
@racc_debug_out.print 'read '
@racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
@racc_debug_out.puts val.inspect
@racc_debug_out.puts
end
- def racc_shift( tok, tstack, vstack )
+ def racc_shift(tok, tstack, vstack)
@racc_debug_out.puts "shift #{racc_token2str tok}"
racc_print_stacks tstack, vstack
@racc_debug_out.puts
end
- def racc_reduce( toks, sim, tstack, vstack )
+ def racc_reduce(toks, sim, tstack, vstack)
out = @racc_debug_out
out.print 'reduce '
if toks.empty?
@@ -428,20 +412,20 @@ nerr = 0 # tmp
@racc_debug_out.puts
end
- def racc_e_pop( state, tstack, vstack )
+ def racc_e_pop(state, tstack, vstack)
@racc_debug_out.puts 'error recovering mode: pop token'
racc_print_states state
racc_print_stacks tstack, vstack
@racc_debug_out.puts
end
- def racc_next_state( curstate, state )
+ def racc_next_state(curstate, state)
@racc_debug_out.puts "goto #{curstate}"
racc_print_states state
@racc_debug_out.puts
end
- def racc_print_stacks( t, v )
+ def racc_print_stacks(t, v)
out = @racc_debug_out
out.print ' ['
t.each_index do |i|
@@ -450,34 +434,37 @@ nerr = 0 # tmp
out.puts ' ]'
end
- def racc_print_states( s )
+ def racc_print_states(s)
out = @racc_debug_out
out.print ' ['
s.each {|st| out.print ' ', st }
out.puts ' ]'
end
- def racc_token2str( tok )
+ def racc_token2str(tok)
self.class::Racc_token_to_s_table[tok] or
- raise RuntimeError, "[Racc Bug] can't convert token #{tok} to string"
+ raise "[Racc Bug] can't convert token #{tok} to string"
end
- def token_to_str( t )
+ def token_to_str(t)
self.class::Racc_token_to_s_table[t]
end
end
end
-..end /usr/lib/ruby/1.8/racc/parser.rb modeval..id1306b79176
-end # end of racc/parser.rb
+..end racc/parser.rb modeval..id5256434e8a
+end
+###### racc/parser.rb end
module Nagios
class Parser < Racc::Parser
-module_eval <<'..end grammar.ry modeval..id458299781d', 'grammar.ry', 57
+module_eval <<'..end grammar.ry modeval..idcb2ea30b34', 'grammar.ry', 57
+
+class ::Nagios::Parser::SyntaxError < RuntimeError; end
def parse(src)
@src = src
@@ -490,12 +477,7 @@ def parse(src)
@line = 0
@yydebug = true
- begin
- do_parse
- rescue SyntaxError
- $stderr.print "#{$!}\n"
- exit
- end
+ do_parse
end
# The lexer. Very simple.
@@ -607,12 +589,12 @@ def on_error(token, value, vstack )
if token == '$end'.intern
puts "okay, this is silly"
else
- raise SyntaxError, msg
+ raise ::Nagios::Parser::SyntaxError, msg
end
end
-..end grammar.ry modeval..id458299781d
+..end grammar.ry modeval..idcb2ea30b34
-##### racc 1.4.4 generates ###
+##### racc 1.4.5 generates ###
racc_reduce_table = [
0, 0, :racc_error,
diff --git a/lib/puppet/parser/ast/astarray.rb b/lib/puppet/parser/ast/astarray.rb
index 0fccbca75..8f09aa922 100644
--- a/lib/puppet/parser/ast/astarray.rb
+++ b/lib/puppet/parser/ast/astarray.rb
@@ -30,9 +30,10 @@ class Puppet::Parser::AST
items << child
end
}
+
rets = items.flatten.collect { |child|
child.safeevaluate(scope)
- }.flatten
+ }
return rets.reject { |o| o.nil? }
end
diff --git a/lib/puppet/parser/ast/resource.rb b/lib/puppet/parser/ast/resource.rb
index 1a07fc585..d222893b3 100644
--- a/lib/puppet/parser/ast/resource.rb
+++ b/lib/puppet/parser/ast/resource.rb
@@ -18,34 +18,34 @@ class Resource < AST::ResourceReference
param.safeevaluate(scope)
}
- objtitles = @title.safeevaluate(scope)
+ resource_titles = @title.safeevaluate(scope)
# it's easier to always use an array, even for only one name
- unless objtitles.is_a?(Array)
- objtitles = [objtitles]
+ unless resource_titles.is_a?(Array)
+ resource_titles = [resource_titles]
end
- objtype = qualified_type(scope)
+ resource_type = qualified_type(scope)
+
+ # We want virtual to be true if exported is true. We can't
+ # just set :virtual => self.virtual in the initialization,
+ # because sometimes the :virtual attribute is set *after*
+ # :exported, in which case it clobbers :exported if :exported
+ # is true. Argh, this was a very tough one to track down.
+ virt = self.virtual || self.exported
# This is where our implicit iteration takes place; if someone
# passed an array as the name, then we act just like the called us
# many times.
- objtitles.collect { |objtitle|
+ resource_titles.flatten.collect { |resource_title|
exceptwrap :type => Puppet::ParseError do
- exp = self.exported || scope.resource.exported?
- # We want virtual to be true if exported is true. We can't
- # just set :virtual => self.virtual in the initialization,
- # because sometimes the :virtual attribute is set *after*
- # :exported, in which case it clobbers :exported if :exported
- # is true. Argh, this was a very tough one to track down.
- virt = self.virtual || scope.resource.virtual? || exp
- obj = Puppet::Parser::Resource.new(
- :type => objtype,
- :title => objtitle,
+ resource = Puppet::Parser::Resource.new(
+ :type => resource_type,
+ :title => resource_title,
:params => paramobjects,
:file => self.file,
:line => self.line,
- :exported => exp,
+ :exported => self.exported,
:virtual => virt,
:source => scope.source,
:scope => scope
@@ -53,11 +53,11 @@ class Resource < AST::ResourceReference
# And then store the resource in the compiler.
# At some point, we need to switch all of this to return
- # objects instead of storing them like this.
- scope.compiler.add_resource(scope, obj)
- obj
+ # resources instead of storing them like this.
+ scope.compiler.add_resource(scope, resource)
+ resource
end
- }.reject { |obj| obj.nil? }
+ }.reject { |resource| resource.nil? }
end
# Set the parameters for our object.
diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb
index fb7d95c52..9423db26b 100644
--- a/lib/puppet/parser/collector.rb
+++ b/lib/puppet/parser/collector.rb
@@ -72,8 +72,7 @@ class Puppet::Parser::Collector
def collect_exported
# First get everything from the export table. Just reuse our
# collect_virtual method but tell it to use 'exported? for the test.
- resources = collect_virtual(true).reject { |r| ! r.virtual? }.each { |r| r.exported = false }
- #resources = collect_virtual(true).reject { |r| ! r.virtual? }
+ resources = collect_virtual(true).reject { |r| ! r.virtual? }
count = resources.length
diff --git a/lib/puppet/parser/functions/realize.rb b/lib/puppet/parser/functions/realize.rb
index 1bdde234e..6aff19d29 100644
--- a/lib/puppet/parser/functions/realize.rb
+++ b/lib/puppet/parser/functions/realize.rb
@@ -8,7 +8,7 @@ Puppet::Parser::Functions::newfunction(:realize, :doc => "Make a virtual object
reference; e.g.: ``realize User[luke]``." ) do |vals|
coll = Puppet::Parser::Collector.new(self, :nomatter, nil, nil, :virtual)
vals = [vals] unless vals.is_a?(Array)
- coll.resources = vals
+ coll.resources = vals.flatten
compiler.add_collection(coll)
end
diff --git a/lib/puppet/provider/naginator.rb b/lib/puppet/provider/naginator.rb
index 8e8a3d65e..233d82eb6 100644
--- a/lib/puppet/provider/naginator.rb
+++ b/lib/puppet/provider/naginator.rb
@@ -23,7 +23,11 @@ class Puppet::Provider::Naginator < Puppet::Provider::ParsedFile
end
def self.parse(text)
- Nagios::Parser.new.parse(text)
+ begin
+ Nagios::Parser.new.parse(text)
+ rescue => detail
+ raise Puppet::Error, "Could not parse configuration for %s: %s" % [resource_type.name, detail]
+ end
end
def self.to_file(records)
diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb
index b4a4a3b91..a4c4bc87c 100755
--- a/lib/puppet/provider/parsedfile.rb
+++ b/lib/puppet/provider/parsedfile.rb
@@ -108,10 +108,11 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
# Return a list of all of the records we can find.
def self.instances
- prefetch()
- @records.find_all { |r| r[:record_type] == self.name }.collect { |r|
- new(r)
- }
+ targets.collect do |target|
+ prefetch_target(target)
+ end.flatten.reject { |r| skip_record?(r) }.collect do |record|
+ new(record)
+ end
end
# Override the default method with a lot more functionality.
@@ -171,31 +172,39 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
# resource instance.
def self.prefetch(resources = nil)
# Reset the record list.
- @records = []
- targets(resources).each do |target|
- @records += prefetch_target(target)
- end
+ @records = prefetch_all_targets(resources)
- if resources
- matchers = resources.dup
- @records.each do |record|
- # Skip things like comments and blank lines
- next if skip_record?(record)
+ match_providers_with_resources(resources)
+ end
- if name = record[:name] and resource = resources[name]
+ def self.match_providers_with_resources(resources)
+ return unless resources
+ matchers = resources.dup
+ @records.each do |record|
+ # Skip things like comments and blank lines
+ next if skip_record?(record)
+
+ if name = record[:name] and resource = resources[name]
+ resource.provider = new(record)
+ elsif respond_to?(:match)
+ if resource = match(record, matchers)
+ # Remove this resource from circulation so we don't unnecessarily try to match
+ matchers.delete(resource.title)
+ record[:name] = resource[:name]
resource.provider = new(record)
- elsif respond_to?(:match)
- if resource = match(record, matchers)
- # Remove this resource from circulation so we don't unnecessarily try to match
- matchers.delete(resource.title)
- record[:name] = resource[:name]
- resource.provider = new(record)
- end
end
end
end
end
+ def self.prefetch_all_targets(resources)
+ records = []
+ targets(resources).each do |target|
+ records += prefetch_target(target)
+ end
+ records
+ end
+
# Prefetch an individual target.
def self.prefetch_target(target)
target_records = retrieve(target).each do |r|
@@ -217,6 +226,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
# Is there an existing record with this name?
def self.record?(name)
+ return nil unless @records
@records.find { |r| r[:name] == name }
end
@@ -367,4 +377,3 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
end
end
end
-
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index f8aa701f0..706ea1386 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -715,10 +715,6 @@ class Type
end
end
- if p = self.provider and p.respond_to?(:prefetch)
- p.prefetch
- end
-
# this only operates on properties, not properties + children
# it's important that we call retrieve() on the type instance,
# not directly on the property, because it allows the type to override
diff --git a/lib/puppet/type/file/selcontext.rb b/lib/puppet/type/file/selcontext.rb
index 8ef51366a..717f58805 100644
--- a/lib/puppet/type/file/selcontext.rb
+++ b/lib/puppet/type/file/selcontext.rb
@@ -44,6 +44,14 @@ module Puppet
return property_default
end
+ def insync?(value)
+ if not selinux_support?
+ debug("SELinux bindings not found. Ignoring parameter.")
+ return true
+ end
+ super
+ end
+
def sync
self.set_selinux_context(@resource[:path], @should, name)
return :file_changed
diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb
index 492dd6136..074afb6b2 100755
--- a/lib/puppet/type/user.rb
+++ b/lib/puppet/type/user.rb
@@ -100,6 +100,8 @@ module Puppet
end
def insync?(is)
+ return true unless self.should
+
# We know the 'is' is a number, so we need to convert the 'should' to a number,
# too.
@should.each do |value|
@@ -142,6 +144,10 @@ module Puppet
newproperty(:password, :required_features => :manages_passwords) do
desc "The user's password, in whatever encrypted format the local machine requires. Be sure to enclose any value that includes a dollar sign ($) in single quotes (\')."
+ validate do |value|
+ raise ArgumentError, "Passwords cannot include ':'" if value.include?(":")
+ end
+
def change_to_s(currentvalue, newvalue)
if currentvalue == :absent
return "created password"
diff --git a/lib/puppet/type/yumrepo.rb b/lib/puppet/type/yumrepo.rb
index 1e917793b..4f7b26b8a 100644
--- a/lib/puppet/type/yumrepo.rb
+++ b/lib/puppet/type/yumrepo.rb
@@ -178,7 +178,10 @@ module Puppet
# Store all modifications back to disk
def self.store
- inifile.store
+ file = inifile.store
+ unless file.nil?
+ File.chmod(0644, file)
+ end
end
# This is only used during testing.
diff --git a/lib/puppet/util/inifile.rb b/lib/puppet/util/inifile.rb
index 9f5582e95..f5fab8530 100644
--- a/lib/puppet/util/inifile.rb
+++ b/lib/puppet/util/inifile.rb
@@ -163,6 +163,7 @@ module Puppet::Util::IniConfig
end
if dirty
Puppet::Util::FileType.filetype(:flat).new(file).write(text)
+ return file
end
end
end
diff --git a/lib/puppet/util/nagios_maker.rb b/lib/puppet/util/nagios_maker.rb
index a7aae4e70..316334929 100644
--- a/lib/puppet/util/nagios_maker.rb
+++ b/lib/puppet/util/nagios_maker.rb
@@ -42,6 +42,7 @@ module Puppet::Util::NagiosMaker
target = "/etc/nagios/#{full_name.to_s}.cfg"
provider = type.provide(:naginator, :parent => Puppet::Provider::Naginator, :default_target => target) {}
+ provider.nagios_type
type.desc "The Nagios type #{name.to_s}. This resource type is autogenerated using the
model developed in Naginator_, and all of the Nagios types are generated using the
@@ -51,6 +52,9 @@ module Puppet::Util::NagiosMaker
files. By default, the statements will be added to ``#{target}``, but
you can send them to a different file by setting their ``target`` attribute.
+ You can purge Nagios resources using the ``resources`` type, but *only*
+ in the default file locations. This is an architectural limitation.
+
.. _naginator: http://reductivelabs.com/trac/naginator
"
end