Hello community, here is the log from the commit of package rubygem-puppet for openSUSE:Factory checked in at 2016-01-28 17:23:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-puppet (Old) and /work/SRC/openSUSE:Factory/.rubygem-puppet.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-puppet" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-puppet/rubygem-puppet.changes 2015-12-09 22:33:29.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-puppet.new/rubygem-puppet.changes 2016-01-28 17:23:56.000000000 +0100 @@ -1,0 +2,6 @@ +Fri Jan 22 17:15:04 UTC 2016 - [email protected] + +- Update to 3.8.5 + https://docs.puppetlabs.com/puppet/3.8/reference/release_notes.html#puppet-385 + +------------------------------------------------------------------- Old: ---- puppet-3.8.4.gem New: ---- puppet-3.8.5.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-puppet.spec ++++++ --- /var/tmp/diff_new_pack.PLXK0l/_old 2016-01-28 17:23:57.000000000 +0100 +++ /var/tmp/diff_new_pack.PLXK0l/_new 2016-01-28 17:23:57.000000000 +0100 @@ -24,7 +24,7 @@ # Name: rubygem-puppet -Version: 3.8.4 +Version: 3.8.5 Release: 0 %define mod_name puppet %define mod_full_name %{mod_name}-%{version} ++++++ puppet-3.8.4.gem -> puppet-3.8.5.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/build_defaults.yaml new/ext/build_defaults.yaml --- old/ext/build_defaults.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/ext/build_defaults.yaml 1970-01-01 01:00:00.000000000 +0100 @@ -19,17 +19,17 @@ ref: 'refs/tags/3.8.3' repo: 'git://github.com/puppetlabs/puppet_for_the_win.git' facter: - ref: 'refs/tags/2.4.4' + ref: 'refs/tags/2.4.5' repo: 'git://github.com/puppetlabs/facter.git' hiera: ref: 'refs/tags/1.3.4' repo: 'git://github.com/puppetlabs/hiera.git' sys: ref: - x86: 'refs/tags/1.9.3-p551.6' - x64: 'refs/tags/2.0.0.9-x64' + x86: 'refs/tags/1.9.3-p551.8' + x64: 'refs/tags/2.0.0.11-x64' repo: 'git://github.com/puppetlabs/puppet-win32-ruby.git' -apt_host: 'apt.puppetlabs.com' +apt_signing_server: 'apt.puppetlabs.com' apt_repo_url: 'http://apt.puppetlabs.com' apt_repo_path: '/opt/repository/incoming' ips_repo: '/var/pkgrepo' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/daemon.rb new/lib/puppet/daemon.rb --- old/lib/puppet/daemon.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/daemon.rb 1970-01-01 01:00:00.000000000 +0100 @@ -24,6 +24,7 @@ SIGNAL_CHECK_INTERVAL = 5 attr_accessor :agent, :server, :argv + attr_reader :signals def initialize(pidfile, scheduler = Puppet::Scheduler::Scheduler.new()) @scheduler = scheduler @@ -107,13 +108,21 @@ # Trap a couple of the main signals. This should probably be handled # in a way that anyone else can register callbacks for traps, but, eh. def set_signal_traps - signals = {:INT => :stop, :TERM => :stop } - # extended signals not supported under windows - signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs }) unless Puppet.features.microsoft_windows? - signals.each do |signal, method| + [:INT, :TERM].each do |signal| Signal.trap(signal) do - Puppet.notice "Caught #{signal}; storing #{method}" - @signals << method + Puppet.notice "Caught #{signal}; exiting" + stop + end + end + + # extended signals not supported under windows + if !Puppet.features.microsoft_windows? + signals = {:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs } + signals.each do |signal, method| + Signal.trap(signal) do + Puppet.notice "Caught #{signal}; storing #{method}" + @signals << method + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/node.rb new/lib/puppet/node.rb --- old/lib/puppet/node.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/node.rb 1970-01-01 01:00:00.000000000 +0100 @@ -18,6 +18,8 @@ ::PSON.register_document_type('Node',self) + ENVIRONMENT = 'environment'.freeze + def self.from_data_hash(data) raise ArgumentError, "No name provided in serialized data" unless name = data['name'] @@ -58,7 +60,7 @@ if @environment @environment else - if env = parameters["environment"] + if env = parameters[ENVIRONMENT] self.environment = env elsif environment_name self.environment = environment_name @@ -80,6 +82,13 @@ else @environment = env end + + # Keep environment_name attribute and parameter in sync if they have been set + unless @environment.nil? + @parameters[ENVIRONMENT] = @environment.name if @parameters.include?(ENVIRONMENT) + self.environment_name = @environment.name if instance_variable_defined?(:@environment_name) + end + @environment end def has_environment_instance? @@ -129,7 +138,7 @@ @parameters[name] = value unless @parameters.include?(name) end - @parameters["environment"] ||= self.environment.name.to_s + @parameters[ENVIRONMENT] ||= self.environment.name.to_s end # Calculate the list of names we might use for looking diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/pops/evaluator/access_operator.rb new/lib/puppet/pops/evaluator/access_operator.rb --- old/lib/puppet/pops/evaluator/access_operator.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/pops/evaluator/access_operator.rb 1970-01-01 01:00:00.000000000 +0100 @@ -39,7 +39,7 @@ fail(Puppet::Pops::Issues::BAD_STRING_SLICE_ARITY, @semantic.left_expr, {:actual => keys.size}) when 1 # Note that Ruby 1.8.7 requires a length of 1 to produce a String - k1 = coerce_numeric(keys[0], @semantic.keys, scope) + k1 = coerce_numeric(keys[0], @semantic.keys[0], scope) bad_access_key_type(o, 0, k1, Integer) unless k1.is_a?(Integer) k2 = 1 k1 = k1 < 0 ? o.length + k1 : k1 # abs pos @@ -50,8 +50,8 @@ o[ k1, k2 ] end when 2 - k1 = coerce_numeric(keys[0], @semantic.keys, scope) - k2 = coerce_numeric(keys[1], @semantic.keys, scope) + k1 = coerce_numeric(keys[0], @semantic.keys[0], scope) + k2 = coerce_numeric(keys[1], @semantic.keys[1], scope) [k1, k2].each_with_index { |k,i| bad_access_key_type(o, i, k, Integer) unless k.is_a?(Integer) } k1 = k1 < 0 ? o.length + k1 : k1 # abs pos (negative is count from end) @@ -317,6 +317,9 @@ end ranged_integer = Puppet::Pops::Types::PIntegerType.new() from, to = keys + # NOTE! Do not merge the following line to 4.x. It has the same check in the initialize method + raise ArgumentError, "'from' must be less or equal to 'to'. Got (#{from}, #{to}" if from.is_a?(Numeric) && to.is_a?(Numeric) && from > to + ranged_integer.from = from == :default ? nil : from ranged_integer.to = to == :default ? nil : to ranged_integer @@ -333,6 +336,9 @@ end ranged_float = Puppet::Pops::Types::PFloatType.new() from, to = keys + # NOTE! Do not merge the following line to 4.x. It has the same check in the initialize method + raise ArgumentError, "'from' must be less or equal to 'to'. Got (#{from}, #{to}" if from.is_a?(Numeric) && to.is_a?(Numeric) && from > to + ranged_float.from = from == :default || from.nil? ? nil : Float(from) ranged_float.to = to == :default || to.nil? ? nil : Float(to) ranged_float @@ -428,6 +434,9 @@ end ranged_integer = Puppet::Pops::Types::PIntegerType.new() from, to = keys + # NOTE! Do not merge the following line to 4.x. It has the same check in the initialize method + raise ArgumentError, "'from' must be less or equal to 'to'. Got (#{from}, #{to}" if from.is_a?(Numeric) && to.is_a?(Numeric) && from > to + ranged_integer.from = from == :default ? nil : from ranged_integer.to = to == :default ? nil : to ranged_integer diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/pops/issues.rb new/lib/puppet/pops/issues.rb --- old/lib/puppet/pops/issues.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/pops/issues.rb 1970-01-01 01:00:00.000000000 +0100 @@ -546,6 +546,10 @@ "Resource Override can only operate on resources, got: #{label.label(actual)}" end + DUPLICATE_PARAMETER = hard_issue :DUPLICATE_PARAMETER, :param_name do + "The parameter '#{param_name}' is declared more than once in the parameter list" + end + RESERVED_PARAMETER = hard_issue :RESERVED_PARAMETER, :container, :param_name do "The parameter $#{param_name} redefines a built in parameter in #{label.the(container)}" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/pops/types/type_calculator.rb new/lib/puppet/pops/types/type_calculator.rb --- old/lib/puppet/pops/types/type_calculator.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/pops/types/type_calculator.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1069,11 +1069,7 @@ to = range.to x = from.nil? ? 1 : from y = to.nil? ? TheInfinity : to - if x < y - [x, y] - else - [y, x] - end + [x, y] end # @api private diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/pops/types/type_factory.rb new/lib/puppet/pops/types/type_factory.rb --- old/lib/puppet/pops/types/type_factory.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/pops/types/type_factory.rb 1970-01-01 01:00:00.000000000 +0100 @@ -17,6 +17,9 @@ # @api public # def self.range(from, to) + # NOTE! Do not merge the following line to 4.x. It has the same check in the initialize method + raise ArgumentError, "'from' must be less or equal to 'to'. Got (#{from}, #{to}" if from.is_a?(Numeric) && to.is_a?(Numeric) && from > to + t = Types::PIntegerType.new() # optimize eq with symbol (faster when it is left) t.from = from unless (:default == from || from == 'default') @@ -28,6 +31,9 @@ # @api public # def self.float_range(from, to) + # NOTE! Do not merge the following line to 4.x. It has the same check in the initialize method + raise ArgumentError, "'from' must be less or equal to 'to'. Got (#{from}, #{to}" if from.is_a?(Numeric) && to.is_a?(Numeric) && from > to + t = Types::PFloatType.new() # optimize eq with symbol (faster when it is left) t.from = Float(from) unless :default == from || from.nil? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/pops/types/types.rb new/lib/puppet/pops/types/types.rb --- old/lib/puppet/pops/types/types.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/pops/types/types.rb 1970-01-01 01:00:00.000000000 +0100 @@ -121,11 +121,7 @@ def range f = from || NEGATIVE_INFINITY t = to || INFINITY - if f < t - [f, t] - else - [t,f] - end + [f, t] end # Returns Enumerator if no block is given @@ -133,11 +129,7 @@ def each return self.to_enum unless block_given? return nil if from.nil? || to.nil? - if to < from - from.downto(to) {|x| yield x } - else - from.upto(to) {|x| yield x } - end + from.upto(to) {|x| yield x } end def hash @@ -212,11 +204,7 @@ return [0, INFINITY] if size_type.nil? f = size_type.from || 0 t = size_type.to || INFINITY - if f < t - [f, t] - else - [t,f] - end + [f, t] end def hash diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/pops/validation/checker4_0.rb new/lib/puppet/pops/validation/checker4_0.rb --- old/lib/puppet/pops/validation/checker4_0.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/pops/validation/checker4_0.rb 1970-01-01 01:00:00.000000000 +0100 @@ -233,6 +233,7 @@ def check_EppExpression(o) if o.eContainer.is_a?(Puppet::Pops::Model::LambdaExpression) internal_check_no_capture(o.eContainer, o) + internal_check_parameter_name_uniqueness(o.eContainer) end end @@ -327,12 +328,14 @@ def check_HostClassDefinition(o) check_NamedDefinition(o) internal_check_no_capture(o) + internal_check_parameter_name_uniqueness(o) internal_check_reserved_params(o) end def check_ResourceTypeDefinition(o) check_NamedDefinition(o) internal_check_no_capture(o) + internal_check_parameter_name_uniqueness(o) internal_check_reserved_params(o) end @@ -366,6 +369,13 @@ end end + def internal_check_parameter_name_uniqueness(o) + unique = Set.new + o.parameters.each do |p| + acceptor.accept(Issues::DUPLICATE_PARAMETER, p, {:param_name => p.name}) unless unique.add?(p.name) + end + end + def check_IfExpression(o) rvalue(o.test) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/provider/group/windows_adsi.rb new/lib/puppet/provider/group/windows_adsi.rb --- old/lib/puppet/provider/group/windows_adsi.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/provider/group/windows_adsi.rb 1970-01-01 01:00:00.000000000 +0100 @@ -39,6 +39,11 @@ return '' if users.nil? or !users.kind_of?(Array) users = users.map do |user_name| sid = Puppet::Util::Windows::SID.name_to_sid_object(user_name) + if !sid + resource.debug("#{user_name} (unresolvable to SID)") + next user_name + end + if sid.account =~ /\\/ account, _ = Puppet::Util::Windows::ADSI::User.parse_name(sid.account) else @@ -50,6 +55,10 @@ return users.join(',') end + def member_valid?(user_name) + ! Puppet::Util::Windows::SID.name_to_sid_object(user_name).nil? + end + def group @group ||= Puppet::Util::Windows::ADSI::Group.new(@resource[:name]) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/provider/package/pip.rb new/lib/puppet/provider/package/pip.rb --- old/lib/puppet/provider/package/pip.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/provider/package/pip.rb 1970-01-01 01:00:00.000000000 +0100 @@ -3,6 +3,7 @@ require 'puppet/provider/package' require 'xmlrpc/client' +require 'puppet/util/http_proxy' Puppet::Type.type(:package).provide :pip, :parent => ::Puppet::Provider::Package do @@ -56,7 +57,16 @@ # cache of PyPI's package list so this operation will always have to # ask the web service. def latest - client = XMLRPC::Client.new2("http://pypi.python.org/pypi") + http_proxy_host = Puppet::Util::HttpProxy.http_proxy_host + http_proxy_port = Puppet::Util::HttpProxy.http_proxy_port + if http_proxy_host && http_proxy_port + proxy = "#{http_proxy_host}:#{http_proxy_port}" + else + # nil is acceptable + proxy = http_proxy_host + end + + client = XMLRPC::Client.new2("http://pypi.python.org/pypi", proxy) client.http_header_extra = {"Content-Type" => "text/xml"} client.timeout = 10 result = client.call("package_releases", @resource[:name]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/provider/service/launchd.rb new/lib/puppet/provider/service/launchd.rb --- old/lib/puppet/provider/service/launchd.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/provider/service/launchd.rb 1970-01-01 01:00:00.000000000 +0100 @@ -205,6 +205,12 @@ # format. def self.read_plist(path) begin + return Plist::parse_xml(path) + rescue ArgumentError => detail + Puppet.debug("Error reading #{path}: #{detail}. Retrying with plutil.") + end + + begin Plist::parse_xml(plutil('-convert', 'xml1', '-o', '/dev/stdout', path)) rescue Puppet::ExecutionFailure => detail Puppet.warning("Cannot read file #{path}; Puppet is skipping it. \n" + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/provider/service/upstart.rb new/lib/puppet/provider/service/upstart.rb --- old/lib/puppet/provider/service/upstart.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/provider/service/upstart.rb 1970-01-01 01:00:00.000000000 +0100 @@ -151,7 +151,11 @@ end def status - return super if not is_upstart? + if (@resource[:hasstatus] == :false) || + @resource[:status] || + ! is_upstart? + return super + end output = status_exec(@resource[:name].split) if output =~ /start\// diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/resource.rb new/lib/puppet/resource.rb --- old/lib/puppet/resource.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/resource.rb 1970-01-01 01:00:00.000000000 +0100 @@ -387,7 +387,7 @@ begin Puppet::DataBinding.indirection.find( name, - :environment => scope.environment.to_s, + :environment => scope.environment, :variables => scope) rescue Puppet::DataBinding::LookupError => e raise Puppet::Error.new("Error from DataBinding '#{Puppet[:data_binding_terminus]}' while looking up '#{name}': #{e.message}", e) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/type/group.rb new/lib/puppet/type/group.rb --- old/lib/puppet/type/group.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/type/group.rb 1970-01-01 01:00:00.000000000 +0100 @@ -80,7 +80,9 @@ newproperty(:members, :array_matching => :all, :required_features => :manages_members) do desc "The members of the group. For directory services where group - membership is stored in the group objects, not the users." + membership is stored in the group objects, not the users. Use + with auth_membership to determine whether the specified members + are inclusive or the minimum." def change_to_s(currentvalue, newvalue) currentvalue = currentvalue.join(",") if currentvalue != :absent @@ -99,16 +101,26 @@ def is_to_s(currentvalue) if provider.respond_to?(:members_to_s) currentvalue = '' if currentvalue.nil? - return provider.members_to_s(currentvalue.split(',')) + currentvalue = currentvalue.is_a?(Array) ? currentvalue : currentvalue.split(',') + + return provider.members_to_s(currentvalue) end super(currentvalue) end alias :should_to_s :is_to_s + + validate do |value| + if provider.respond_to?(:member_valid?) + return provider.member_valid?(value) + end + end end newparam(:auth_membership, :boolean => true, :parent => Puppet::Parameter::Boolean) do - desc "whether the provider is authoritative for group membership." + desc "Whether the provider is authoritative for group membership. This + must be set to true to allow setting the group to no members with + `members => [],`." defaultto true end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/util/windows/security.rb new/lib/puppet/util/windows/security.rb --- old/lib/puppet/util/windows/security.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/util/windows/security.rb 1970-01-01 01:00:00.000000000 +0100 @@ -372,7 +372,10 @@ dacl.allow(well_known_nobody_sid, nobody_allow) # TODO: system should be first? - dacl.allow(well_known_system_sid, system_allow) + flags = !isdir ? 0 : + Puppet::Util::Windows::AccessControlEntry::CONTAINER_INHERIT_ACE | + Puppet::Util::Windows::AccessControlEntry::OBJECT_INHERIT_ACE + dacl.allow(well_known_system_sid, system_allow, flags) # add inherit-only aces for child dirs and files that are created within the dir inherit_only = Puppet::Util::Windows::AccessControlEntry::INHERIT_ONLY_ACE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/puppet/version.rb new/lib/puppet/version.rb --- old/lib/puppet/version.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/puppet/version.rb 1970-01-01 01:00:00.000000000 +0100 @@ -7,7 +7,7 @@ module Puppet - PUPPETVERSION = '3.8.4' + PUPPETVERSION = '3.8.5' ## # version is a public API method intended to always provide a fast and diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 1970-01-01 01:00:00.000000000 +0100 +++ new/metadata 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: puppet version: !ruby/object:Gem::Version - version: 3.8.4 + version: 3.8.5 prerelease: platform: ruby authors: @@ -9,7 +9,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2015-11-03 00:00:00.000000000 Z +date: 2016-01-21 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: facter diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/integration/util/windows/security_spec.rb new/spec/integration/util/windows/security_spec.rb --- old/spec/integration/util/windows/security_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/integration/util/windows/security_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -237,6 +237,24 @@ system_aces.each do |ace| ace.mask.should == klass::FILE_ALL_ACCESS && ! ace.inherited? end + + if Puppet::FileSystem.directory?(path) + system_aces.each do |ace| + ace.object_inherit?.should be_true + ace.container_inherit?.should be_true + end + + # it's critically important that this file be default created + # and that this file not have it's owner / group / mode set by winsec + nested_file = File.join(path, 'nested_file') + File.new(nested_file, 'w').close + + system_aces = winsec.get_aces_for_path_by_sid(nested_file, sids[:system]) + # even when SYSTEM is the owner (in CI), there should be an inherited SYSTEM + system_aces.any? do |ace| + ace.mask == klass::FILE_ALL_ACCESS && ace.inherited? + end.should be_true + end end describe "for modes that require deny aces" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/unit/daemon_spec.rb new/spec/unit/daemon_spec.rb --- old/spec/unit/daemon_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/unit/daemon_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -47,15 +47,24 @@ let(:server) { stub("Server", :start => nil, :wait_for_shutdown => nil) } describe "when setting signal traps" do - signals = {:INT => :stop, :TERM => :stop } - signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs}) unless Puppet.features.microsoft_windows? - signals.each do |signal, method| - it "should log and call #{method} when it receives #{signal}" do - Signal.expects(:trap).with(signal).yields + [:INT, :TERM].each do |signal| + it "logs a notice and exits when sent #{signal}" do + Signal.stubs(:trap).with(signal).yields + Puppet.expects(:notice).with("Caught #{signal}; exiting") + daemon.expects(:stop) - Puppet.expects(:notice) + daemon.set_signal_traps + end + end + + {:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs}.each do |signal, method| + it "logs a notice and remembers to call #{method} when it receives #{signal}" do + Signal.stubs(:trap).with(signal).yields + Puppet.expects(:notice).with("Caught #{signal}; storing #{method}") daemon.set_signal_traps + + expect(daemon.signals).to eq([method]) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/unit/node_spec.rb new/spec/unit/node_spec.rb --- old/spec/unit/node_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/unit/node_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -48,6 +48,14 @@ node.parameters["environment"] = :bar node.environment.name.should == :bar end + + it "should allow its environment parameter to be set by attribute after initialization" do + node = Puppet::Node.new("foo", { :parameters => { 'environment' => :foo } }) + node.environment_name = :foo + node.environment = :bar + expect(node.environment_name).to eq(:bar) + expect(node.parameters['environment']).to eq(:bar) + end end it "can survive a round-trip through YAML" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/unit/pops/evaluator/access_ops_spec.rb new/spec/unit/pops/evaluator/access_ops_spec.rb --- old/spec/unit/pops/evaluator/access_ops_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/unit/pops/evaluator/access_ops_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -123,9 +123,9 @@ expect(evaluate(expr)).to eql(range(1,1)) end - it 'produces an Integer[from, <from]' do + it 'gives an error for Integer[from, <from]' do expr = fqr('Integer')[1,0] - expect(evaluate(expr)).to eql(range(1,0)) + expect{evaluate(expr)}.to raise_error(/'from' must be less or equal to 'to'/) end it 'produces an error for Integer[] if there are more than 2 keys' do @@ -154,9 +154,9 @@ expect(evaluate(expr)).to eql(float_range(1.0,1.0)) end - it 'produces a Float[from, <from]' do + it 'gives an error for Float[from, <from]' do expr = fqr('Float')[1.0,0.0] - expect(evaluate(expr)).to eql(float_range(1.0,0.0)) + expect{evaluate(expr)}.to raise_error(/'from' must be less or equal to 'to'/) end it 'produces an error for Float[] if there are more than 2 keys' do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/unit/pops/parser/parser_rspec_helper.rb new/spec/unit/pops/parser/parser_rspec_helper.rb --- old/spec/unit/pops/parser/parser_rspec_helper.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/unit/pops/parser/parser_rspec_helper.rb 1970-01-01 01:00:00.000000000 +0100 @@ -8,4 +8,9 @@ parser = Puppet::Pops::Parser::Parser.new() parser.parse_string(code) end + + def parse_epp(code) + parser = Puppet::Pops::Parser::EppParser.new() + parser.parse_string(code) + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/unit/pops/validator/validator_spec.rb new/spec/unit/pops/validator/validator_spec.rb --- old/spec/unit/pops/validator/validator_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/unit/pops/validator/validator_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -177,6 +177,18 @@ end end + context 'for parameter names' do + ['class', 'define'].each do |word| + it "should require that #{word} parameter names are unique" do + expect(validate(parse("#{word} foo($a = 10, $a = 20) {}"))).to have_issue(Puppet::Pops::Issues::DUPLICATE_PARAMETER) + end + end + + it "should require that template parameter names are unique" do + expect(validate(parse_epp("<%-| $a, $a |-%><%= $a == doh %>"))).to have_issue(Puppet::Pops::Issues::DUPLICATE_PARAMETER) + end + end + context 'for reserved parameter names' do ['name', 'title'].each do |word| it "produces an error when $#{word} is used as a parameter in a class" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/unit/provider/group/windows_adsi_spec.rb new/spec/unit/provider/group/windows_adsi_spec.rb --- old/spec/unit/provider/group/windows_adsi_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/unit/provider/group/windows_adsi_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -35,11 +35,13 @@ let(:user1) { stub(:account => 'user1', :domain => '.', :to_s => 'user1sid') } let(:user2) { stub(:account => 'user2', :domain => '.', :to_s => 'user2sid') } let(:user3) { stub(:account => 'user3', :domain => '.', :to_s => 'user3sid') } + let(:invalid_user) { SecureRandom.uuid } before :each do Puppet::Util::Windows::SID.stubs(:name_to_sid_object).with('user1').returns(user1) Puppet::Util::Windows::SID.stubs(:name_to_sid_object).with('user2').returns(user2) Puppet::Util::Windows::SID.stubs(:name_to_sid_object).with('user3').returns(user3) + Puppet::Util::Windows::SID.stubs(:name_to_sid_object).with(invalid_user).returns(nil) end describe "#members_insync?" do @@ -123,6 +125,9 @@ it "should return a user string like DOMAIN\\USER,DOMAIN2\\USER2" do provider.members_to_s(['user1', 'user2']).should == '.\user1,.\user2' end + it "should return the username when it cannot be resolved to a SID (for the sake of resource_harness error messages)" do + expect(provider.members_to_s([invalid_user])).to eq("#{invalid_user}") + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/unit/provider/package/pip_spec.rb new/spec/unit/provider/package/pip_spec.rb --- old/spec/unit/provider/package/pip_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/unit/provider/package/pip_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -12,7 +12,6 @@ @client = stub_everything('client') @client.stubs(:call).with('package_releases', 'real_package').returns(["1.3", "1.2.5", "1.2.4"]) @client.stubs(:call).with('package_releases', 'fake_package').returns([]) - XMLRPC::Client.stubs(:new2).returns(@client) end describe "parse" do @@ -118,23 +117,53 @@ end describe "latest" do + context "connecting directly" do - it "should find a version number for real_package" do - @resource[:name] = "real_package" - @provider.latest.should_not == nil - end + before :each do + XMLRPC::Client.expects(:new2).with("http://pypi.python.org/pypi", nil).returns(@client) + end - it "should not find a version number for fake_package" do - @resource[:name] = "fake_package" - @provider.latest.should == nil - end + it "should find a version number for real_package" do + @resource[:name] = "real_package" + @provider.latest.should_not == nil + end + + it "should not find a version number for fake_package" do + @resource[:name] = "fake_package" + @provider.latest.should == nil + end + + it "should handle a timeout gracefully" do + @resource[:name] = "fake_package" + @client.stubs(:call).raises(Timeout::Error) + lambda { @provider.latest }.should raise_error(Puppet::Error) + end - it "should handle a timeout gracefully" do - @resource[:name] = "fake_package" - @client.stubs(:call).raises(Timeout::Error) - lambda { @provider.latest }.should raise_error(Puppet::Error) end + context "connecting via a proxy" do + before :each do + Puppet::Util::HttpProxy.expects(:http_proxy_host).returns 'some_host' + Puppet::Util::HttpProxy.expects(:http_proxy_port).returns 'some_port' + XMLRPC::Client.expects(:new2).with("http://pypi.python.org/pypi", "some_host:some_port").returns(@client) + end + + it "should find a version number for real_package" do + @resource[:name] = "real_package" + @provider.latest.should_not == nil + end + + it "should not find a version number for fake_package" do + @resource[:name] = "fake_package" + @provider.latest.should == nil + end + + it "should handle a timeout gracefully" do + @resource[:name] = "fake_package" + @client.stubs(:call).raises(Timeout::Error) + lambda { @provider.latest }.should raise_error(Puppet::Error) + end + end end describe "install" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/unit/provider/service/launchd_spec.rb new/spec/unit/provider/service/launchd_spec.rb --- old/spec/unit/provider/service/launchd_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/unit/provider/service/launchd_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -274,6 +274,7 @@ } end let(:busted_plist_path) { '/Library/LaunchAgents/org.busted.plist' } + let(:binary_plist_path) { '/Library/LaunchAgents/org.binary.plist' } it "[17624] should warn that the plist in question is being skipped" do provider.expects(:launchd_paths).returns(['/Library/LaunchAgents']) @@ -284,6 +285,8 @@ end it "[15929] should skip plists that plutil cannot read" do + Plist.expects(:parse_xml).with(busted_plist_path).raises(ArgumentError, 'boom') + Puppet.expects(:debug).with("Error reading #{busted_plist_path}: boom. Retrying with plutil.") provider.expects(:plutil).with('-convert', 'xml1', '-o', '/dev/stdout', busted_plist_path).raises(Puppet::ExecutionFailure, 'boom') Puppet.expects(:warning).with("Cannot read file #{busted_plist_path}; " + @@ -291,6 +294,14 @@ "Details: boom") provider.read_plist(busted_plist_path) end + + it "should read binary plists with plutil" do + Plist.expects(:parse_xml).with(binary_plist_path).raises(ArgumentError, 'boom') + Puppet.expects(:debug).with("Error reading #{binary_plist_path}: boom. Retrying with plutil.") + provider.expects(:plutil).with('-convert', 'xml1', '-o', '/dev/stdout', binary_plist_path).returns('plist') + Plist.expects(:parse_xml).with('plist').returns('plist_map') + expect(provider.read_plist(binary_plist_path)).to eq('plist_map') + end end it "should return the cached value when available" do provider.instance_variable_set(:@label_to_path_map, {'xx'=>'yy'}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/unit/provider/service/upstart_spec.rb new/spec/unit/provider/service/upstart_spec.rb --- old/spec/unit/provider/service/upstart_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/unit/provider/service/upstart_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -100,6 +100,63 @@ provider.status.should == :running end + describe "when a special status command is specifed" do + it "should use the provided status command" do + resource = Puppet::Type.type(:service).new(:name => 'foo', :provider => :upstart, :status => '/bin/foo') + provider = provider_class.new(resource) + provider.stubs(:is_upstart?).returns(true) + + provider.expects(:status_exec).with(['foo']).never + provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + Process::Status.any_instance.stubs(:exitstatus).returns(0) + provider.status + end + + it "should return :stopped when the provided status command return non-zero" do + resource = Puppet::Type.type(:service).new(:name => 'foo', :provider => :upstart, :status => '/bin/foo') + provider = provider_class.new(resource) + provider.stubs(:is_upstart?).returns(true) + + provider.expects(:status_exec).with(['foo']).never + provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + $CHILD_STATUS.stubs(:exitstatus).returns 1 + provider.status.should == :stopped + end + + it "should return :running when the provided status command return zero" do + resource = Puppet::Type.type(:service).new(:name => 'foo', :provider => :upstart, :status => '/bin/foo') + provider = provider_class.new(resource) + provider.stubs(:is_upstart?).returns(true) + + provider.expects(:status_exec).with(['foo']).never + provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + $CHILD_STATUS.stubs(:exitstatus).returns 0 + provider.status.should == :running + end + end + + describe "when :hasstatus is set to false" do + it "should return :stopped if the pid can not be found" do + resource = Puppet::Type.type(:service).new(:name => 'foo', :hasstatus => false, :provider => :upstart) + provider = provider_class.new(resource) + provider.stubs(:is_upstart?).returns(true) + + provider.expects(:status_exec).with(['foo']).never + provider.expects(:getpid).returns nil + provider.status.should == :stopped + end + + it "should return :running if the pid can be found" do + resource = Puppet::Type.type(:service).new(:name => 'foo', :hasstatus => false, :provider => :upstart) + provider = provider_class.new(resource) + provider.stubs(:is_upstart?).returns(true) + + provider.expects(:status_exec).with(['foo']).never + provider.expects(:getpid).returns 2706 + provider.status.should == :running + end + end + it "should properly handle services with 'start' in their name" do resource = Puppet::Type.type(:service).new(:name => "foostartbar", :provider => :upstart) provider = provider_class.new(resource)
