Hello community, here is the log from the commit of package puppet for openSUSE:Factory checked in at 2014-10-06 22:05:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/puppet (Old) and /work/SRC/openSUSE:Factory/.puppet.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "puppet" Changes: -------- --- /work/SRC/openSUSE:Factory/puppet/puppet.changes 2014-09-10 17:02:53.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.puppet.new/puppet.changes 2014-10-06 22:05:07.000000000 +0200 @@ -1,0 +2,42 @@ +Sat Sep 27 06:31:18 UTC 2014 - [email protected] + +- Also create user/group when only installing the puppet client + +------------------------------------------------------------------- +Wed Sep 24 15:23:25 UTC 2014 - [email protected] + +- Updated systemd coding style + +------------------------------------------------------------------- +Thu Sep 18 17:32:47 UTC 2014 - [email protected] + +- Fix packaging for SLE_11 + +------------------------------------------------------------------- +Tue Sep 16 19:59:22 UTC 2014 - [email protected] + +- Update to 3.7.1 + * PUP-3222: Windows service provider references a non-existent class + * PUP-3190: “each” no longer supported in Puppet 3.7.0 + * PUP-3191: Symlinks to missing targets cause a File Not Found error + instead of a warning + * PUP-3231: Specifying –tags doesn’t cause suitability check to be + skipped for skipped resources + * PUP-894: Too easy to hit “CRL not yet valid for <host>” + (and not very informative) + * PUP-1680: “incorrect header check” using Ruby 2 + * PUP-3177: Resource titles ending with square brackets fail + * PUP-3174: After enabling directory environments the manifestdir + setting is still required to be valid + * PUP-3162: Block $environment in directory based environment + configuration settings + * PUP-3186: Puppetmaster removes /etc/puppet/environments/production + if it’s a link rather than a directory + + See release notes for update information: + https://docs.puppetlabs.com/puppet/3.7/reference/release_notes.html + + For a full list of bugs fixes see: + https://tickets.puppetlabs.com/secure/ReleaseNote.jspa?projectId=10102&version=11854 + +------------------------------------------------------------------- Old: ---- puppet-3.7.0.tar.gz New: ---- puppet-3.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ puppet.spec ++++++ --- /var/tmp/diff_new_pack.A5m0ge/_old 2014-10-06 22:05:09.000000000 +0200 +++ /var/tmp/diff_new_pack.A5m0ge/_new 2014-10-06 22:05:09.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package puppet # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,7 +22,7 @@ %define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services Name: puppet -Version: 3.7.0 +Version: 3.7.1 Release: 0 Summary: A network tool for managing many disparate systems License: Apache-2.0 @@ -49,8 +49,11 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build Requires(pre): /usr/sbin/groupadd Requires(pre): /usr/sbin/useradd +%if 0%{?suse_version} >= 1210 BuildRequires: systemd %{?systemd_requires} +%define has_systemd 1 +%endif %define _unitdir /usr/lib/systemd @@ -64,7 +67,9 @@ %package server Summary: A network tool for managing many disparate systems Group: Productivity/Networking/System +%if 0%{?suse_version} > 1210 %{?systemd_requires} +%endif %description server Puppet lets you centrally manage every important aspect of your system @@ -77,7 +82,9 @@ Summary: Vim syntax files for Puppet manifests Group: Productivity/Text/Editors Requires: vim +%if 0%{?suse_version} > 1110 BuildArch: noarch +%endif Supplements: packageand(vim:%{name}) %{!?vim_data_dir:%global vim_data_dir /usr/share/vim/%(readlink /usr/share/vim/current)} @@ -100,8 +107,18 @@ mkdir -p %{buildroot}%{_unitdir}/system install -m0644 ext/redhat/puppet.conf %{buildroot}%{_sysconfdir}/puppet/puppet.conf install -m0644 conf/auth.conf %{buildroot}%{_sysconfdir}/puppet/auth.conf +# +%if 0%{?has_systemd} ln -sf service %{buildroot}/%{_sbindir}/rcpuppet ln -sf service %{buildroot}/%{_sbindir}/rcpuppetmaster +%else +mkdir -p %{buildroot}%_initddir +install -m0755 ext/suse/client.init %{buildroot}/%_initddir/puppet +install -m0755 ext/suse/server.init %{buildroot}/%_initddir/puppetmaster +ln -sf %_initddir/puppet %{buildroot}/%{_sbindir}/rcpuppet +ln -sf %_initddir/puppetmaster %{buildroot}/%{_sbindir}/rcpuppetmaster +%endif +# install -m 644 %{SOURCE1} %{buildroot}/%{_fwdefdir}/puppetmasterd install -m 644 %{SOURCE2} %{buildroot}/%{_fwdefdir}/puppet # Latest git calls the service for agent puppet again @@ -152,36 +169,74 @@ %pre server getent group puppet >/dev/null || /usr/sbin/groupadd -r puppet getent passwd puppet >/dev/null || /usr/sbin/useradd -r -g puppet -d /var/lib/puppet -s /bin/false -c "Puppet daemon" puppet + +%if 0%{?has_systemd} %service_add_pre puppetmaster.service +%endif %pre +getent group puppet >/dev/null || /usr/sbin/groupadd -r puppet +getent passwd puppet >/dev/null || /usr/sbin/useradd -r -g puppet -d /var/lib/puppet -s /bin/false -c "Puppet daemon" puppet +%if 0%{?has_systemd} %service_add_pre puppet.service +%endif %preun +%if 0%{?has_systemd} %service_del_preun puppet.service +%endif + +%if 0%{?suse_version} == 1110 +%stop_on_removal %{name} +%endif %postun +%if 0%{?has_systemd} %service_del_postun puppet.service +%endif + +%if 0%{?suse_version} == 1110 +%insserv_cleanup +%endif %post # Compatibility with old setups -if [ -f /etc/sysconfig/puppet ] && [ -z "`grep 'PUPPET_EXTRA_OPTS="' /etc/sysconfig/puppet | grep ' --server=${PUPPET_SERVER} --port=${PUPPET_PORT} --logdest=${PUPPET_LOG}"'`" ]; then - echo 'PUPPET_EXTRA_OPTS=" --server=${PUPPET_SERVER} --port=${PUPPET_PORT} --logdest=${PUPPET_LOG} ${PUPPET_EXTRA_OPTS}"' >> /etc/sysconfig/puppet +if [ -f /etc/sysconfig/puppet ] && [ -z "`grep 'PUPPET_EXTRA_OPTS="' /etc/sysconfig/puppet | grep ' --server=${PUPPET_SERVER} --masterport=${PUPPET_PORT} --logdest=${PUPPET_LOG}"'`" ]; then + echo 'PUPPET_EXTRA_OPTS=" --server=${PUPPET_SERVER} --masterport=${PUPPET_PORT} --logdest=${PUPPET_LOG} ${PUPPET_EXTRA_OPTS}"' >> /etc/sysconfig/puppet fi + +%if 0%{?has_systemd} %service_add_post puppet.service +%endif %preun server +%if 0%{?has_systemd} %service_del_preun puppetmaster.service +%endif + +%if 0%{?suse_version} == 1110 +%stop_on_removal %{name} +%endif %postun server +%if 0%{?has_systemd} %service_del_postun puppetmaster.service +%endif + +%if 0%{?suse_version} == 1110 +%insserv_cleanup +%endif %post server # Compatibility with old setups if [ -f /etc/sysconfig/puppetmasterd ] && [ -z "`grep 'PUPPETMASTER_EXTRA_OPTS="' /etc/sysconfig/puppetmasterd | grep ' --manifest=${PUPPETMASTER_MANIFEST} --masterport=${PUPPETMASTER_PORTS[0]} --logdest ${PUPPETMASTER_LOG}'`" ]; then echo 'PUPPETMASTER_EXTRA_OPTS=" --manifest=${PUPPETMASTER_MANIFEST} --masterport=${PUPPETMASTER_PORTS[0]} --logdest ${PUPPETMASTER_LOG} ${PUPPETMASTER_EXTRA_OPTS}' >> /etc/sysconfig/puppet fi + +%if 0%{?has_systemd} %service_add_post puppetmaster.service +%endif + if [ -f /run/puppet_migrate ]; then cat > %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF Warning: If you used puppet on openSUSE/SLE before be aware, that service is now @@ -236,6 +291,11 @@ %{_sbindir}/rcpuppet %config %{_fwdefdir}/puppet %{_unitdir}/system/puppet.service +%if 0%{?suse_version} == 1110 +%_initddir/puppet +%dir /usr/lib/systemd +%dir /usr/lib/systemd/system +%endif %files server %defattr(-, root, root, 0755) @@ -243,6 +303,11 @@ %{_sbindir}/rcpuppetmaster %config %{_fwdefdir}/puppetmasterd %{_unitdir}/system/puppetmaster.service +%if 0%{?suse_version} == 1110 +%_initddir/puppetmaster +%dir /usr/lib/systemd +%dir /usr/lib/systemd/system +%endif %files vim %defattr(-, root, root) ++++++ puppet-3.7.0.tar.gz -> puppet-3.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/Gemfile new/puppet-3.7.1/Gemfile --- old/puppet-3.7.0/Gemfile 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/Gemfile 2014-09-15 22:33:02.000000000 +0200 @@ -23,7 +23,9 @@ #gem 'ruby-augeas', :group => :development end -gem "puppet", :path => File.dirname(__FILE__), :require => false +if !ENV['PUPPET_LOADED'] + gem "puppet", :path => File.dirname(__FILE__), :require => false +end gem "facter", *location_for(ENV['FACTER_LOCATION'] || ['> 1.6', '< 3']) gem "hiera", *location_for(ENV['HIERA_LOCATION'] || '~> 1.0') gem "rake", "10.1.1", :require => false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/ext/debian/changelog new/puppet-3.7.1/ext/debian/changelog --- old/puppet-3.7.0/ext/debian/changelog 2014-09-04 00:22:51.000000000 +0200 +++ new/puppet-3.7.1/ext/debian/changelog 2014-09-15 22:33:06.000000000 +0200 @@ -1,8 +1,8 @@ -puppet (3.7.0-1puppetlabs1) hardy lucid natty oneiric unstable sid squeeze wheezy precise; urgency=low +puppet (3.7.1-1puppetlabs1) hardy lucid natty oneiric unstable sid squeeze wheezy precise; urgency=low - * Update to version 3.7.0-1puppetlabs1 + * Update to version 3.7.1-1puppetlabs1 - -- Puppet Labs Release <[email protected]> Wed, 03 Sep 2014 15:22:51 -0700 + -- Puppet Labs Release <[email protected]> Mon, 15 Sep 2014 13:33:06 -0700 puppet (3.2.3-0.1rc0puppetlabs1) lucid unstable sid squeeze wheezy precise quantal raring; urgency=low diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/ext/ips/puppet.p5m new/puppet-3.7.1/ext/ips/puppet.p5m --- old/puppet-3.7.0/ext/ips/puppet.p5m 2014-09-04 00:22:51.000000000 +0200 +++ new/puppet-3.7.1/ext/ips/puppet.p5m 2014-09-15 22:33:06.000000000 +0200 @@ -1,6 +1,6 @@ -set name=pkg.fmri value=pkg://puppetlabs.com/system/management/@3.7.0,13.3.0-0 +set name=pkg.fmri value=pkg://puppetlabs.com/system/management/@3.7.1,13.3.0-0 set name=pkg.summary value="Puppet, an automated configuration management tool" -set name=pkg.human-version value="3.7.0" +set name=pkg.human-version value="3.7.1" set name=pkg.description value="Puppet, an automated configuration management tool" set name=info.classification value="org.opensolaris.category.2008:System/Administration and Configuration" set name=org.opensolaris.consolidation value="puppet" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/ext/redhat/puppet.spec new/puppet-3.7.1/ext/redhat/puppet.spec --- old/puppet-3.7.0/ext/redhat/puppet.spec 2014-09-04 00:22:51.000000000 +0200 +++ new/puppet-3.7.1/ext/redhat/puppet.spec 2014-09-15 22:33:06.000000000 +0200 @@ -16,8 +16,8 @@ %endif # VERSION is subbed out during rake srpm process -%global realversion 3.7.0 -%global rpmversion 3.7.0 +%global realversion 3.7.1 +%global rpmversion 3.7.1 %global confdir ext/redhat %global pending_upgrade_path %{_localstatedir}/lib/rpm-state/puppet @@ -446,8 +446,8 @@ rm -rf %{buildroot} %changelog -* Wed Sep 03 2014 Puppet Labs Release <[email protected]> - 3.7.0-1 -- Build for 3.7.0 +* Mon Sep 15 2014 Puppet Labs Release <[email protected]> - 3.7.1-1 +- Build for 3.7.1 * Wed Oct 2 2013 Jason Antman <[email protected]> - Move systemd service and unit file names back to "puppet" from erroneous "puppetagent" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/defaults.rb new/puppet-3.7.1/lib/puppet/defaults.rb --- old/puppet-3.7.0/lib/puppet/defaults.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/defaults.rb 2014-09-15 22:33:02.000000000 +0200 @@ -1056,13 +1056,6 @@ In either case, the path can point to a single file or to a directory of manifests to be evaluated in alphabetical order.", - :hook => proc do |value| - uninterpolated_value = self.value(true) - if uninterpolated_value =~ /\$environment/ || value =~ /\$environment/ then - raise(Puppet::Settings::ValidationError, - "You cannot interpolate '$environment' within the 'default_manifest' setting.") - end - end }, :disable_per_environment_manifest => { :default => false, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/module_tool/applications/unpacker.rb new/puppet-3.7.1/lib/puppet/module_tool/applications/unpacker.rb --- old/puppet-3.7.0/lib/puppet/module_tool/applications/unpacker.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/module_tool/applications/unpacker.rb 2014-09-15 22:33:02.000000000 +0200 @@ -46,7 +46,7 @@ tmpdirpath = Pathname.new tmpdir symlinks.each do |s| - Puppet.warning "Symlinks in modules are unsupported. Please investigate symlink #{s.relative_path_from tmpdirpath}->#{s.realpath.relative_path_from tmpdirpath}." + Puppet.warning "Symlinks in modules are unsupported. Please investigate symlink #{s.relative_path_from tmpdirpath}->#{Puppet::FileSystem.readlink(s)}." end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/network/http/compression.rb new/puppet-3.7.1/lib/puppet/network/http/compression.rb --- old/puppet-3.7.0/lib/puppet/network/http/compression.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/network/http/compression.rb 2014-09-15 22:33:02.000000000 +0200 @@ -46,7 +46,11 @@ end def add_accept_encoding(headers={}) - headers['accept-encoding'] = 'gzip; q=1.0, deflate; q=1.0; identity' if Puppet.settings[:http_compression] + if Puppet.settings[:http_compression] + headers['accept-encoding'] = 'gzip; q=1.0, deflate; q=1.0; identity' + else + headers['accept-encoding'] = 'identity' + end headers end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/pops/loader/loader_paths.rb new/puppet-3.7.1/lib/puppet/pops/loader/loader_paths.rb --- old/puppet-3.7.0/lib/puppet/pops/loader/loader_paths.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/pops/loader/loader_paths.rb 2014-09-15 22:33:02.000000000 +0200 @@ -75,7 +75,7 @@ end class FunctionPath4x < RubySmartPath - FUNCTION_PATH_4X = File.join('lib', 'puppet', 'functions') + FUNCTION_PATH_4X = File.join('puppet', 'functions') def relative_path FUNCTION_PATH_4X diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/pops/loader/module_loaders.rb new/puppet-3.7.1/lib/puppet/pops/loader/module_loaders.rb --- old/puppet-3.7.0/lib/puppet/pops/loader/module_loaders.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/pops/loader/module_loaders.rb 2014-09-15 22:33:02.000000000 +0200 @@ -20,6 +20,28 @@ # @api private # module Puppet::Pops::Loader::ModuleLoaders + def self.system_loader_from(parent_loader, loaders) + # Puppet system may be installed in a fixed location via RPM, installed as a Gem, via source etc. + # The only way to find this across the different ways puppet can be installed is + # to search up the path from this source file's __FILE__ location until it finds the base of + # puppet. + # + puppet_lib = File.join(File.dirname(__FILE__), '../../..') + Puppet::Pops::Loader::ModuleLoaders::FileBased.new(parent_loader, + loaders, + nil, + puppet_lib, + 'puppet_system') + end + + def self.module_loader_from(parent_loader, loaders, module_name, module_path) + Puppet::Pops::Loader::ModuleLoaders::FileBased.new(parent_loader, + loaders, + module_name, + File.join(module_path, 'lib'), + module_name) + end + class AbstractPathBasedModuleLoader < Puppet::Pops::Loader::BaseLoader # The name of the module, or nil, if this is a global "component" @@ -47,11 +69,6 @@ def initialize(parent_loader, loaders, module_name, path, loader_name) super parent_loader, loader_name - # Irrespective of the path referencing a directory or file, the path must exist. - unless Puppet::FileSystem.exist?(path) - raise ArgumentError, "The given path '#{path}' does not exist!" - end - @module_name = module_name @path = path @smart_paths = Puppet::Pops::Loader::LoaderPaths::SmartPaths.new(self) @@ -178,9 +195,6 @@ # def initialize(parent_loader, loaders, module_name, path, loader_name) super - unless Puppet::FileSystem.directory?(path) - raise ArgumentError, "The given module root path '#{path}' is not a directory (required for file system based module path entry)" - end @path_index = Set.new() end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/pops/loaders.rb new/puppet-3.7.1/lib/puppet/pops/loaders.rb --- old/puppet-3.7.0/lib/puppet/pops/loaders.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/pops/loaders.rb 2014-09-15 22:33:02.000000000 +0200 @@ -64,16 +64,7 @@ private def create_puppet_system_loader() - module_name = nil - loader_name = 'puppet_system' - - # Puppet system may be installed in a fixed location via RPM, installed as a Gem, via source etc. - # The only way to find this across the different ways puppet can be installed is - # to search up the path from this source file's __FILE__ location until it finds the parent of - # lib/puppet... e.g.. dirname(__FILE__)/../../.. (i.e. <somewhere>/lib/puppet/pops/loaders.rb). - # - puppet_lib = File.join(File.dirname(__FILE__), '../../..') - Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, self, module_name, puppet_lib, loader_name) + Puppet::Pops::Loader::ModuleLoaders.system_loader_from(static_loader, self) end def create_environment_loader(environment) @@ -121,7 +112,7 @@ # Create data about this module md = LoaderModuleData.new(puppet_module) mr[puppet_module.name] = md - md.public_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(parent_loader, self, md.name, md.path, md.name) + md.public_loader = Puppet::Pops::Loader::ModuleLoaders.module_loader_from(parent_loader, self, md.name, md.path) end # NOTE: Do not resolve all modules here - this is wasteful if only a subset of modules / functions are used # The resolution is triggered by asking for a module's private loader, since this means there is interest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/provider/service/windows.rb new/puppet-3.7.1/lib/puppet/provider/service/windows.rb --- old/puppet-3.7.0/lib/puppet/provider/service/windows.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/provider/service/windows.rb 2014-09-15 22:33:02.000000000 +0200 @@ -21,21 +21,21 @@ def enable w32ss = Win32::Service.configure( 'service_name' => @resource[:name], 'start_type' => Win32::Service::SERVICE_AUTO_START ) raise Puppet::Error.new("Win32 service enable of #{@resource[:name]} failed" ) if( w32ss.nil? ) - rescue Win32::Service::Error => detail + rescue => detail raise Puppet::Error.new("Cannot enable #{@resource[:name]}, error was: #{detail}", detail ) end def disable w32ss = Win32::Service.configure( 'service_name' => @resource[:name], 'start_type' => Win32::Service::SERVICE_DISABLED ) raise Puppet::Error.new("Win32 service disable of #{@resource[:name]} failed" ) if( w32ss.nil? ) - rescue Win32::Service::Error => detail + rescue => detail raise Puppet::Error.new("Cannot disable #{@resource[:name]}, error was: #{detail}", detail ) end def manual_start w32ss = Win32::Service.configure( 'service_name' => @resource[:name], 'start_type' => Win32::Service::SERVICE_DEMAND_START ) raise Puppet::Error.new("Win32 service manual enable of #{@resource[:name]} failed" ) if( w32ss.nil? ) - rescue Win32::Service::Error => detail + rescue => detail raise Puppet::Error.new("Cannot enable #{@resource[:name]} for manual start, error was: #{detail}", detail ) end @@ -55,7 +55,7 @@ else raise Puppet::Error.new("Unknown start type: #{w32ss.start_type}") end - rescue Win32::Service::Error => detail + rescue => detail raise Puppet::Error.new("Cannot get start type for #{@resource[:name]}, error was: #{detail}", detail ) end @@ -95,7 +95,7 @@ end debug("Service #{@resource[:name]} is #{w32ss.current_state}") return state - rescue Win32::Service::Error => detail + rescue => detail raise Puppet::Error.new("Cannot get status of #{@resource[:name]}, error was: #{detail}", detail ) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/resource.rb new/puppet-3.7.1/lib/puppet/resource.rb --- old/puppet-3.7.0/lib/puppet/resource.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/resource.rb 2014-09-15 22:33:02.000000000 +0200 @@ -551,10 +551,12 @@ end def extract_type_and_title(argtype, argtitle) - if (argtitle || argtype) =~ /^([^\[\]]+)\[(.+)\]$/m then [ $1, $2 ] - elsif argtitle then [ argtype, argtitle ] - elsif argtype.is_a?(Puppet::Type) then [ argtype.class.name, argtype.title ] - elsif argtype.is_a?(Hash) then + if (argtype.nil? || argtype == :component || argtype == :whit) && + argtitle =~ /^([^\[\]]+)\[(.+)\]$/m then [ $1, $2 ] + elsif argtitle.nil? && argtype =~ /^([^\[\]]+)\[(.+)\]$/m then [ $1, $2 ] + elsif argtitle then [ argtype, argtitle ] + elsif argtype.is_a?(Puppet::Type) then [ argtype.class.name, argtype.title ] + elsif argtype.is_a?(Hash) then raise ArgumentError, "Puppet::Resource.new does not take a hash as the first argument. "+ "Did you mean (#{(argtype[:type] || argtype["type"]).inspect}, #{(argtype[:title] || argtype["title"]).inspect }) ?" else raise ArgumentError, "No title provided and #{argtype.inspect} is not a valid resource reference" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/settings.rb new/puppet-3.7.1/lib/puppet/settings.rb --- old/puppet-3.7.0/lib/puppet/settings.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/settings.rb 2014-09-15 22:33:02.000000000 +0200 @@ -887,8 +887,8 @@ sections = nil if sections.empty? catalog = Puppet::Resource::Catalog.new("Settings", Puppet::Node::Environment::NONE) - @config.keys.find_all { |key| @config[key].is_a?(FileSetting) }.each do |key| + next if (key == :manifestdir && should_skip_manifestdir?()) file = @config[key] next unless (sections.nil? or sections.include?(file.section)) next unless resource = file.to_resource @@ -905,6 +905,13 @@ catalog end + def should_skip_manifestdir?() + setting = @config[:environmentpath] + !(setting.nil? || setting.value.nil? || setting.value.empty?) + end + + private :should_skip_manifestdir? + # Convert our list of config settings into a configuration file. def to_config str = %{The configuration file for #{Puppet.run_mode.name}. Note that this file @@ -1130,11 +1137,13 @@ configured_environment = self[:environment] if configured_environment == "production" && envdir && Puppet::FileSystem.exist?(envdir) configured_environment_path = File.join(envdir, configured_environment) - catalog.add_resource( - Puppet::Resource.new(:file, - configured_environment_path, - :parameters => { :ensure => 'directory' }) - ) + if !Puppet::FileSystem.symlink?(configured_environment_path) + catalog.add_resource( + Puppet::Resource.new(:file, + configured_environment_path, + :parameters => { :ensure => 'directory' }) + ) + end end end @@ -1232,6 +1241,7 @@ # @api public class ChainedValues ENVIRONMENT_SETTING = "environment".freeze + ENVIRONMENT_INTERPOLATION_ALLOWED = ['config_version'].freeze # @see Puppet::Settings.values # @api private @@ -1280,7 +1290,7 @@ else # Convert it if necessary begin - val = convert(val) + val = convert(val, name) rescue InterpolationError => err # This happens because we don't have access to the param name when the # exception is originally raised, but we want it in the message @@ -1296,27 +1306,45 @@ private - def convert(value) + def convert(value, setting_name) case value when nil nil when String - value.gsub(/\$(\w+)|\$\{(\w+)\}/) do |value| + failed_environment_interpolation = false + interpolated_value = value.gsub(/\$(\w+)|\$\{(\w+)\}/) do |expression| varname = $2 || $1 - if varname == ENVIRONMENT_SETTING && @environment - @environment - elsif varname == "run_mode" - @mode - elsif !(pval = interpolate(varname.to_sym)).nil? - pval + interpolated_expression = + if varname != ENVIRONMENT_SETTING || ok_to_interpolate_environment(setting_name) + if varname == ENVIRONMENT_SETTING && @environment + @environment + elsif varname == "run_mode" + @mode + elsif !(pval = interpolate(varname.to_sym)).nil? + pval + else + raise InterpolationError, "Could not find value for #{expression}" + end else - raise InterpolationError, "Could not find value for #{value}" + failed_environment_interpolation = true + expression end + interpolated_expression end + if failed_environment_interpolation + Puppet.warning("You cannot interpolate $environment within '#{setting_name}' when using directory environments. Its value will remain #{interpolated_value}.") + end + interpolated_value else value end end + + def ok_to_interpolate_environment(setting_name) + return true if Puppet.settings.value(:environmentpath, nil, true).empty? + + ENVIRONMENT_INTERPOLATION_ALLOWED.include?(setting_name.to_s) + end end class Values diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/ssl/validator/default_validator.rb new/puppet-3.7.1/lib/puppet/ssl/validator/default_validator.rb --- old/puppet-3.7.0/lib/puppet/ssl/validator/default_validator.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/ssl/validator/default_validator.rb 2014-09-15 22:33:02.000000000 +0200 @@ -11,6 +11,8 @@ attr_reader :verify_errors attr_reader :ssl_configuration + FIVE_MINUTES_AS_SECONDS = 5 * 60 + # Creates a new DefaultValidator, optionally with an SSL Configuration and SSL Host. # # @param ssl_configuration [Puppet::SSL::Configuration] (a default configuration) ssl_configuration the SSL configuration to use @@ -52,7 +54,7 @@ # SSL_VERIFY_PEER flag is set. It must be supplied by the application and # receives two arguments: preverify_ok indicates, whether the verification of # the certificate in question was passed (preverify_ok=1) or not - # (preverify_ok=0). x509_ctx is a pointer to the complete context used for + # (preverify_ok=0). x509_store_ctx is a pointer to the complete context used for # the certificate chain verification. # # See {Puppet::Network::HTTP::Connection} for more information and where this @@ -60,28 +62,47 @@ # # @param [Boolean] preverify_ok indicates whether the verification of the # certificate in question was passed (preverify_ok=true) - # @param [OpenSSL::SSL::SSLContext] ssl_context holds the SSLContext for the - # chain being verified. + # @param [OpenSSL::X509::StoreContext] store_context holds the X509 store context + # for the chain being verified. # # @return [Boolean] false if the peer is invalid, true otherwise. # # @api private # - def call(preverify_ok, ssl_context) - # We must make a copy since the scope of the ssl_context will be lost + def call(preverify_ok, store_context) + # We must make a copy since the scope of the store_context will be lost # across invocations of this method. - current_cert = ssl_context.current_cert - @peer_certs << Puppet::SSL::Certificate.from_instance(current_cert) - if preverify_ok + current_cert = store_context.current_cert + @peer_certs << Puppet::SSL::Certificate.from_instance(current_cert) + # If we've copied all of the certs in the chain out of the SSL library - if @peer_certs.length == ssl_context.chain.length + if @peer_certs.length == store_context.chain.length # (#20027) The peer cert must be issued by a specific authority preverify_ok = valid_peer? end else - if ssl_context.error_string - @verify_errors << "#{ssl_context.error_string} for #{current_cert.subject}" + error = store_context.error || 0 + error_string = store_context.error_string || "OpenSSL error #{error}" + + case error + when OpenSSL::X509::V_ERR_CRL_NOT_YET_VALID + # current_crl can be nil + # https://github.com/ruby/ruby/blob/ruby_1_9_3/ext/openssl/ossl_x509store.c#L501-L510 + crl = store_context.current_crl + if crl + if crl.last_update && crl.last_update < Time.now + FIVE_MINUTES_AS_SECONDS + Puppet.debug("Ignoring CRL not yet valid, current time #{Time.now.utc}, CRL last updated #{crl.last_update.utc}") + preverify_ok = true + else + @verify_errors << "#{error_string} for #{crl.issuer}" + end + else + @verify_errors << error_string + end + else + current_cert = store_context.current_cert + @verify_errors << "#{error_string} for #{current_cert.subject}" end end preverify_ok diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/transaction.rb new/puppet-3.7.1/lib/puppet/transaction.rb --- old/puppet-3.7.0/lib/puppet/transaction.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/transaction.rb 2014-09-15 22:33:02.000000000 +0200 @@ -105,6 +105,7 @@ overly_deferred_resource_handler = lambda do |resource| # We don't automatically assign unsuitable providers, so if there # is one, it must have been selected by the user. + return if missing_tags?(resource) if resource.provider resource.err "Provider #{resource.provider.class.name} is not functional on this host" else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/lib/puppet/version.rb new/puppet-3.7.1/lib/puppet/version.rb --- old/puppet-3.7.0/lib/puppet/version.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/lib/puppet/version.rb 2014-09-15 22:33:02.000000000 +0200 @@ -7,7 +7,7 @@ module Puppet - PUPPETVERSION = '3.7.0' + PUPPETVERSION = '3.7.1' ## # version is a public API method intended to always provide a fast and diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/integration/defaults_spec.rb new/puppet-3.7.1/spec/integration/defaults_spec.rb --- old/puppet-3.7.0/spec/integration/defaults_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/integration/defaults_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -10,12 +10,6 @@ it "returns ./manifests by default" do expect(Puppet[:default_manifest]).to eq('./manifests') end - - it "errors when $environment is part of the value" do - expect { - Puppet[:default_manifest] = '/$environment/manifest.pp' - }.to raise_error Puppet::Settings::ValidationError, /cannot interpolate.*\$environment/ - end end describe "when disable_per_environment_manifest is set" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/integration/environments/default_manifest_spec.rb new/puppet-3.7.1/spec/integration/environments/default_manifest_spec.rb --- old/puppet-3.7.0/spec/integration/environments/default_manifest_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/integration/environments/default_manifest_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -2,7 +2,6 @@ module EnvironmentsDefaultManifestsSpec describe "default manifests" do - FS = Puppet::FileSystem shared_examples_for "puppet with default_manifest settings" do let(:confdir) { Puppet[:confdir] } @@ -113,16 +112,6 @@ ) end - it "raises an exception if default_manifest has $environment in it" do - File.open(File.join(confdir, "puppet.conf"), "w") do |f| - f.puts(<<-EOF) - environmentpath=#{environmentpath} - default_manifest=/foo/$environment - EOF - end - - expect { Puppet.initialize_settings }.to raise_error(Puppet::Settings::ValidationError, /cannot interpolate.*\$environment.*in.*default_manifest/) - end end context "with disable_per_environment_manifest true" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/integration/environments/settings_interpolation_spec.rb new/puppet-3.7.1/spec/integration/environments/settings_interpolation_spec.rb --- old/puppet-3.7.0/spec/integration/environments/settings_interpolation_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/puppet-3.7.1/spec/integration/environments/settings_interpolation_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -0,0 +1,165 @@ +require 'pp' +require 'spec_helper' + +module SettingsInterpolationSpec +describe "interpolating $environment" do + let(:confdir) { Puppet[:confdir] } + let(:cmdline_args) { ['--confdir', confdir, '--vardir', Puppet[:vardir], '--hiera_config', Puppet[:hiera_config]] } + + before(:each) do + FileUtils.mkdir_p(confdir) + end + + shared_examples_for "a setting that does not interpolate $environment" do + + before(:each) do + set_puppet_conf(confdir, <<-EOF) + environmentpath=$confdir/environments + #{setting}=#{value} + EOF + end + + it "does not interpolate $environment" do + Puppet.initialize_settings(cmdline_args) + expect(Puppet[:environmentpath]).to eq("#{confdir}/environments") + expect(Puppet[setting.intern]).to eq(expected) + end + + it "displays the interpolated value in the warning" do + Puppet.initialize_settings(cmdline_args) + Puppet[setting.intern] + expect(@logs).to have_matching_log(/cannot interpolate \$environment within '#{setting}'.*Its value will remain #{Regexp.escape(expected)}/) + end + end + + context "when environmentpath is set" do + + describe "config_version" do + it "interpolates $environment" do + envname = 'testing' + setting = 'config_version' + value = '/some/script $environment' + expected = "#{File.expand_path('/some/script')} testing" + + set_puppet_conf(confdir, <<-EOF) + environmentpath=$confdir/environments + environment=#{envname} + EOF + + set_environment_conf("#{confdir}/environments", envname, <<-EOF) + #{setting}=#{value} + EOF + + Puppet.initialize_settings(cmdline_args) + expect(Puppet[:environmentpath]).to eq("#{confdir}/environments") + environment = Puppet.lookup(:environments).get(envname) + expect(environment.config_version).to eq(expected) + expect(@logs).to be_empty + end + end + + describe "basemodulepath" do + let(:setting) { "basemodulepath" } + let(:value) { "$confdir/environments/$environment/modules:$confdir/environments/$environment/other_modules" } + let(:expected) { "#{confdir}/environments/$environment/modules:#{confdir}/environments/$environment/other_modules" } + + it_behaves_like "a setting that does not interpolate $environment" + + it "logs a single warning for multiple instaces of $environment in the setting" do + set_puppet_conf(confdir, <<-EOF) + environmentpath=$confdir/environments + #{setting}=#{value} + EOF + + Puppet.initialize_settings(cmdline_args) + expect(@logs.map(&:to_s).grep(/cannot interpolate \$environment within '#{setting}'/).count).to eq(1) + end + end + + describe "environment" do + let(:setting) { "environment" } + let(:value) { "whatareyouthinking$environment" } + let(:expected) { value } + + it_behaves_like "a setting that does not interpolate $environment" + end + + describe "the default_manifest" do + let(:setting) { "default_manifest" } + let(:value) { "$confdir/manifests/$environment" } + let(:expected) { "#{confdir}/manifests/$environment" } + + it_behaves_like "a setting that does not interpolate $environment" + end + + it "does not interpolate $environment and logs a warning when interpolating environmentpath" do + setting = 'environmentpath' + value = "$confdir/environments/$environment" + expected = "#{confdir}/environments/$environment" + + set_puppet_conf(confdir, <<-EOF) + #{setting}=#{value} + EOF + + Puppet.initialize_settings(cmdline_args) + expect(Puppet[setting.intern]).to eq(expected) + expect(@logs).to have_matching_log(/cannot interpolate \$environment within '#{setting}'/) + end + end + + def assert_does_interpolate_environment(setting, value, expected_interpolation) + set_puppet_conf(confdir, <<-EOF) + #{setting}=#{value} + EOF + + Puppet.initialize_settings(cmdline_args) + expect(Puppet[:environmentpath]).to be_empty + expect(Puppet[setting.intern]).to eq(expected_interpolation) + expect(@logs).to_not have_matching_log(/cannot interpolate \$environment within '#{setting}'/) + end + + context "when environmentpath is not set" do + it "does interpolate $environment in config_version" do + value = "/some/script $environment" + expect = "/some/script production" + assert_does_interpolate_environment("config_version", value, expect) + end + + it "does interpolate $environment in basemodulepath" do + value = "$confdir/environments/$environment/modules:$confdir/environments/$environment/other_modules" + expected = "#{confdir}/environments/production/modules:#{confdir}/environments/production/other_modules" + assert_does_interpolate_environment("basemodulepath", value, expected) + end + + it "does interpolate $environment in default_manifest, which is fine, because this setting isn't used" do + value = "$confdir/manifests/$environment" + expected = "#{confdir}/manifests/production" + + assert_does_interpolate_environment("default_manifest", value, expected) + end + + it "raises something" do + value = expected = "whatareyouthinking$environment" + expect { + assert_does_interpolate_environment("environment", value, expected) + }.to raise_error(SystemStackError, /stack level too deep/) + end + end + + def set_puppet_conf(confdir, settings) + write_file(File.join(confdir, "puppet.conf"), settings) + end + + def set_environment_conf(environmentpath, environment, settings) + envdir = File.join(environmentpath, environment) + FileUtils.mkdir_p(envdir) + write_file(File.join(envdir, 'environment.conf'), settings) + end + + def write_file(file, contents) + File.open(file, "w") do |f| + f.puts(contents) + end + end +end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/integration/provider/service/windows_spec.rb new/puppet-3.7.1/spec/integration/provider/service/windows_spec.rb --- old/puppet-3.7.0/spec/integration/provider/service/windows_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/puppet-3.7.1/spec/integration/provider/service/windows_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -0,0 +1,48 @@ +#! /usr/bin/env ruby +require 'spec_helper' + +describe Puppet::Type.type(:service).provider(:windows), '(integration)', + :if => Puppet.features.microsoft_windows? do + + require 'puppet/util/windows' + + before :each do + Puppet::Type.type(:service).stubs(:defaultprovider).returns described_class + end + + context 'should fail querying services that do not exist' do + let(:service) do + Puppet::Type.type(:service).new(:name => 'foobarservice1234') + end + + it "with a Puppet::Error when querying enabled?" do + expect { service.provider.enabled? }.to raise_error(Puppet::Error) + end + + it "with a Puppet::Error when querying status" do + expect { service.provider.status }.to raise_error(Puppet::Error) + end + end + + context 'should return valid values when querying a service that does exist' do + let(:service) do + Puppet::Type.type(:service).new(:name => 'lmhosts') + end + + it "with a valid boolean when asked if enabled" do + expect([:true, :false]).to include(service.provider.enabled?) + end + + it "with a valid status when asked about status" do + expect([ + :running, + :'continue pending', + :'pause pending', + :paused, + :running, + :'start pending', + :'stop pending', + :stopped]).to include(service.provider.status) + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/integration/util/windows/security_spec.rb new/puppet-3.7.1/spec/integration/util/windows/security_spec.rb --- old/puppet-3.7.0/spec/integration/util/windows/security_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/integration/util/windows/security_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -447,7 +447,7 @@ describe "when the sid refers to a deleted trustee" do it "should retrieve the user sid" do sid = nil - user = Puppet::Util::Windows::ADSI::User.create("delete_me_user") + user = Puppet::Util::Windows::ADSI::User.create("puppet#{rand(10000)}") user.commit begin sid = Puppet::Util::Windows::ADSI::User.new(user.name).sid.to_s @@ -463,7 +463,7 @@ it "should retrieve the group sid" do sid = nil - group = Puppet::Util::Windows::ADSI::Group.create("delete_me_group") + group = Puppet::Util::Windows::ADSI::Group.create("puppet#{rand(10000)}") group.commit begin sid = Puppet::Util::Windows::ADSI::Group.new(group.name).sid.to_s diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/lib/puppet_spec/matchers.rb new/puppet-3.7.1/spec/lib/puppet_spec/matchers.rb --- old/puppet-3.7.0/spec/lib/puppet_spec/matchers.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/lib/puppet_spec/matchers.rb 2014-09-15 22:33:02.000000000 +0200 @@ -21,6 +21,11 @@ end end +RSpec::Matchers.define :have_matching_log do |expected| + match do |actual| + actual.map(&:to_s).any? { |item| item =~ expected } + end +end RSpec::Matchers.define :exit_with do |expected| actual = nil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/unit/functions/epp_spec.rb new/puppet-3.7.1/spec/unit/functions/epp_spec.rb --- old/puppet-3.7.0/spec/unit/functions/epp_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/unit/functions/epp_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -1,4 +1,3 @@ - require 'spec_helper' describe "the epp function" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/unit/network/http/compression_spec.rb new/puppet-3.7.1/spec/unit/network/http/compression_spec.rb --- old/puppet-3.7.0/spec/unit/network/http/compression_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/unit/network/http/compression_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -61,9 +61,9 @@ headers['accept-encoding'].should =~ /identity/ end - it "should not add Accept-Encoding header if http compression is not available" do + it "should add an Accept-Encoding 'identity' header if http compression is disabled" do Puppet[:http_compression] = false - @uncompressor.add_accept_encoding({}).should == {} + @uncompressor.add_accept_encoding({}).should == {'accept-encoding' => 'identity'} end describe "when uncompressing response body" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/unit/pops/loaders/dependency_loader_spec.rb new/puppet-3.7.1/spec/unit/pops/loaders/dependency_loader_spec.rb --- old/puppet-3.7.0/spec/unit/pops/loaders/dependency_loader_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/unit/pops/loaders/dependency_loader_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -16,10 +16,10 @@ 'foo.rb' => 'Puppet::Functions.create_function("foo") { def foo; end; }' }}}}}) - module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, loaders, 'testmodule', module_dir, 'test1') - dep_loader = Puppet::Pops::Loader::DependencyLoader.new(static_loader, 'test-dep', [module_loader]) + loader = loader_for('testmodule', module_dir) + expect do - dep_loader.load_typed(typed_name(:function, 'testmodule::foo')).value + loader.load_typed(typed_name(:function, 'testmodule::foo')).value end.to raise_error(ArgumentError, /produced mis-matched name, expected 'testmodule::foo', got foo/) end @@ -28,10 +28,10 @@ 'lib' => { 'puppet' => { 'functions' => { 'testmodule' => { 'foo.rb' => 'Puppet::Functions.create_function("testmodule::foo") { def foo; end; }' }}}}}) - module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, loaders, 'testmodule', module_dir, 'test1') - dep_loader = Puppet::Pops::Loader::DependencyLoader.new(static_loader, 'test-dep', [module_loader]) - function = dep_loader.load_typed(typed_name(:function, 'testmodule::foo')).value + loader = loader_for('testmodule', module_dir) + + function = loader.load_typed(typed_name(:function, 'testmodule::foo')).value expect(function.class.name).to eq('testmodule::foo') expect(function.is_a?(Puppet::Functions::Function)).to eq(true) @@ -42,19 +42,24 @@ 'lib' => { 'puppet' => { 'functions' => { 'testmodule' => { 'foo.rb' => 'Puppet::Functions.create_function("testmodule::foo") { def foo; end; }' }}}}}) - module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, loaders, 'testmodule', module_dir, 'test1') - dep_loader = Puppet::Pops::Loader::DependencyLoader.new(static_loader, 'test-dep', [module_loader]) - function = dep_loader.load_typed(typed_name(:function, 'testmodule::foo')).value + loader = loader_for('testmodule', module_dir) + + function = loader.load_typed(typed_name(:function, 'testmodule::foo')).value expect(function.class.name).to eq('testmodule::foo') expect(function.is_a?(Puppet::Functions::Function)).to eq(true) - function = dep_loader.load_typed(typed_name(:function, 'testmodule::foo')).value + function = loader.load_typed(typed_name(:function, 'testmodule::foo')).value expect(function.class.name).to eq('testmodule::foo') expect(function.is_a?(Puppet::Functions::Function)).to eq(true) end end + def loader_for(name, dir) + module_loader = Puppet::Pops::Loader::ModuleLoaders.module_loader_from(static_loader, loaders, name, dir) + Puppet::Pops::Loader::DependencyLoader.new(static_loader, 'test-dep', [module_loader]) + end + def typed_name(type, name) Puppet::Pops::Loader::Loader::TypedName.new(type, name) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/unit/pops/loaders/loader_paths_spec.rb new/puppet-3.7.1/spec/unit/pops/loaders/loader_paths_spec.rb --- old/puppet-3.7.0/spec/unit/pops/loaders/loader_paths_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/unit/pops/loaders/loader_paths_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -9,47 +9,35 @@ let(:static_loader) { Puppet::Pops::Loader::StaticLoader.new() } let(:unused_loaders) { nil } - describe 'the relative_path_for_types method' do - it 'produces paths to load in precendence order' do - module_dir = dir_containing('testmodule', { - 'functions' => {}, - 'lib' => { - 'puppet' => { - 'functions' => {}, - }}}) - module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, unused_loaders, 'testmodule', module_dir, 'test1') - - effective_paths = Puppet::Pops::Loader::LoaderPaths.relative_paths_for_type(:function, module_loader) - - expect(effective_paths.collect(&:generic_path)).to eq([ - File.join(module_dir, 'lib', 'puppet', 'functions') - ]) - end - - it 'module loader has smart-paths that prunes unavailable paths' do - module_dir = dir_containing('testmodule', {'lib' => {'puppet' => {'functions' => {'foo.rb' => 'Puppet::Functions.create_function("testmodule::foo") { def foo; end; }' }}}}) - module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, unused_loaders, 'testmodule', module_dir, 'test1') - - effective_paths = module_loader.smart_paths.effective_paths(:function) - - expect(effective_paths.size).to be_eql(1) - expect(effective_paths[0].generic_path).to be_eql(File.join(module_dir, 'lib', 'puppet', 'functions')) - end - - it 'all function smart-paths produces entries if they exist' do - module_dir = dir_containing('testmodule', { - 'lib' => { - 'puppet' => { - 'functions' => {'foo4x.rb' => 'ignored in this test'}, - }}}) - module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, unused_loaders, 'testmodule', module_dir, 'test1') - - effective_paths = module_loader.smart_paths.effective_paths(:function) - - expect(effective_paths.size).to eq(1) - expect(module_loader.path_index.size).to eq(1) - path_index = module_loader.path_index - expect(path_index).to include(File.join(module_dir, 'lib', 'puppet', 'functions', 'foo4x.rb')) - end + it 'module loader has smart-paths that prunes unavailable paths' do + module_dir = dir_containing('testmodule', {'lib' => {'puppet' => {'functions' => + {'foo.rb' => + 'Puppet::Functions.create_function("testmodule::foo") { + def foo; end; + }' + } + }}}) + module_loader = Puppet::Pops::Loader::ModuleLoaders.module_loader_from(static_loader, unused_loaders, 'testmodule', module_dir) + + effective_paths = module_loader.smart_paths.effective_paths(:function) + + expect(effective_paths.size).to be_eql(1) + expect(effective_paths[0].generic_path).to be_eql(File.join(module_dir, 'lib', 'puppet', 'functions')) + end + + it 'all function smart-paths produces entries if they exist' do + module_dir = dir_containing('testmodule', { + 'lib' => { + 'puppet' => { + 'functions' => {'foo4x.rb' => 'ignored in this test'}, + }}}) + module_loader = Puppet::Pops::Loader::ModuleLoaders.module_loader_from(static_loader, unused_loaders, 'testmodule', module_dir) + + effective_paths = module_loader.smart_paths.effective_paths(:function) + + expect(effective_paths.size).to eq(1) + expect(module_loader.path_index.size).to eq(1) + path_index = module_loader.path_index + expect(path_index).to include(File.join(module_dir, 'lib', 'puppet', 'functions', 'foo4x.rb')) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/unit/pops/loaders/module_loaders_spec.rb new/puppet-3.7.1/spec/unit/pops/loaders/module_loaders_spec.rb --- old/puppet-3.7.0/spec/unit/pops/loaders/module_loaders_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/unit/pops/loaders/module_loaders_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -26,7 +26,7 @@ } }) - module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, loaders, 'testmodule', module_dir, 'test1') + module_loader = Puppet::Pops::Loader::ModuleLoaders.module_loader_from(static_loader, loaders, 'testmodule', module_dir) function = module_loader.load_typed(typed_name(:function, 'foo4x')).value expect(function.class.name).to eq('foo4x') @@ -51,7 +51,7 @@ } }}) - module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, loaders, 'testmodule', module_dir, 'test1') + module_loader = Puppet::Pops::Loader::ModuleLoaders.module_loader_from(static_loader, loaders, 'testmodule', module_dir) function = module_loader.load_typed(typed_name(:function, 'testmodule::foo4x')).value expect(function.class.name).to eq('testmodule::foo4x') expect(function.is_a?(Puppet::Functions::Function)).to eq(true) @@ -68,7 +68,7 @@ end CODE }}}}}) - module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, loaders, 'testmodule', module_dir, 'test1') + module_loader = Puppet::Pops::Loader::ModuleLoaders.module_loader_from(static_loader, loaders, 'testmodule', module_dir) module_dir2 = dir_containing('testmodule2', { 'lib' => { 'puppet' => { 'functions' => { 'testmodule2' => { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/unit/provider/service/windows_spec.rb new/puppet-3.7.1/spec/unit/provider/service/windows_spec.rb --- old/puppet-3.7.0/spec/unit/provider/service/windows_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/unit/provider/service/windows_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -51,6 +51,14 @@ }.to raise_error(Puppet::Error, /Cannot start #{name}, error was: The service name is invalid./) end + it "raises an error if the service doesn't exist" do + Win32::Service.expects(:config_info).with(name).raises(SystemCallError, 'OpenService') + + expect { + provider.start + }.to raise_error(Puppet::Error, /Cannot get start type for #{name}/) + end + describe "when the service is disabled" do before :each do config.start_type = Win32::Service.get_start_type(Win32::Service::SERVICE_DISABLED) @@ -112,6 +120,14 @@ provider.status.should == :running end end + + it "raises an error if the service doesn't exist" do + Win32::Service.expects(:status).with(name).raises(SystemCallError, 'OpenService') + + expect { + provider.status + }.to raise_error(Puppet::Error, /Cannot get status of #{name}/) + end end describe "#restart" do @@ -146,6 +162,14 @@ provider.enabled?.should == :false end + it "raises an error if the service doesn't exist" do + Win32::Service.expects(:config_info).with(name).raises(SystemCallError, 'OpenService') + + expect { + provider.enabled? + }.to raise_error(Puppet::Error, /Cannot get start type for #{name}/) + end + # We need to guard this section explicitly since rspec will always # construct all examples, even if it isn't going to run them. if Puppet.features.microsoft_windows? @@ -165,6 +189,14 @@ Win32::Service.expects(:configure).with('service_name' => name, 'start_type' => Win32::Service::SERVICE_AUTO_START).returns(Win32::Service) provider.enable end + + it "raises an error if the service doesn't exist" do + Win32::Service.expects(:configure).with(has_entry('service_name' => name)).raises(SystemCallError, 'OpenService') + + expect { + provider.enable + }.to raise_error(Puppet::Error, /Cannot enable #{name}/) + end end describe "#disable" do @@ -172,6 +204,14 @@ Win32::Service.expects(:configure).with('service_name' => name, 'start_type' => Win32::Service::SERVICE_DISABLED).returns(Win32::Service) provider.disable end + + it "raises an error if the service doesn't exist" do + Win32::Service.expects(:configure).with(has_entry('service_name' => name)).raises(SystemCallError, 'OpenService') + + expect { + provider.disable + }.to raise_error(Puppet::Error, /Cannot disable #{name}/) + end end describe "#manual_start" do @@ -179,5 +219,13 @@ Win32::Service.expects(:configure).with('service_name' => name, 'start_type' => Win32::Service::SERVICE_DEMAND_START).returns(Win32::Service) provider.manual_start end + + it "raises an error if the service doesn't exist" do + Win32::Service.expects(:configure).with(has_entry('service_name' => name)).raises(SystemCallError, 'OpenService') + + expect { + provider.manual_start + }.to raise_error(Puppet::Error, /Cannot enable #{name}/) + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/unit/resource_spec.rb new/puppet-3.7.1/spec/unit/resource_spec.rb --- old/puppet-3.7.0/spec/unit/resource_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/unit/resource_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -85,6 +85,12 @@ ref.title.should =="baz" end + it "should not interpret the title as a reference if the type is a non component or whit reference" do + ref = Puppet::Resource.new("Notify", "foo::bar[baz]") + ref.type.should == "Notify" + ref.title.should =="foo::bar[baz]" + end + it "should be able to extract its information from a Puppet::Type instance" do ral = Puppet::Type.type(:file).new :path => basepath+"/foo" ref = Puppet::Resource.new(ral) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/unit/settings_spec.rb new/puppet-3.7.1/spec/unit/settings_spec.rb --- old/puppet-3.7.0/spec/unit/settings_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/unit/settings_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -2,9 +2,12 @@ require 'spec_helper' require 'ostruct' require 'puppet/settings/errors' +require 'puppet_spec/files' +require 'matchers/resource' describe Puppet::Settings do include PuppetSpec::Files + include Matchers::Resource let(:main_config_file_default_location) do File.join(Puppet::Util::RunMode[:master].conf_dir, "puppet.conf") @@ -1338,6 +1341,16 @@ @settings.to_catalog end + it "should ignore manifestdir if environmentpath is set" do + @settings.define_settings :main, + :manifestdir => { :type => :directory, :default => @prefix+"/manifestdir", :desc => "a" }, + :environmentpath => { :type => :path, :default => @prefix+"/envs", :desc => "a" } + + catalog = @settings.to_catalog(:main) + + expect(catalog).to_not have_resource("File[#{@prefix}/manifestdir]") + end + describe "on Microsoft Windows" do before :each do Puppet.features.stubs(:root?).returns true @@ -1395,6 +1408,13 @@ catalog = @settings.to_catalog expect(catalog.resource_keys).to include(["File", "#{default_path}/production"]) end + + it "does not add if the path to the default directory environment exists as a symlink", :if => Puppet.features.manages_symlinks? do + Dir.mkdir(default_path) + Puppet::FileSystem.symlink("#{tmpenv}/nowhere", File.join(default_path, 'production')) + catalog = @settings.to_catalog + expect(catalog.resource_keys).to_not include(["File", "#{default_path}/production"]) + end end describe "when adding users and groups to the catalog" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.0/spec/unit/ssl/validator_spec.rb new/puppet-3.7.1/spec/unit/ssl/validator_spec.rb --- old/puppet-3.7.0/spec/unit/ssl/validator_spec.rb 2014-09-04 00:22:46.000000000 +0200 +++ new/puppet-3.7.1/spec/unit/ssl/validator_spec.rb 2014-09-15 22:33:02.000000000 +0200 @@ -39,14 +39,80 @@ context 'When pre-verification is not OK' do context 'and the ssl_context is in an error state' do - before :each do - ssl_context.stubs(:error_string).returns("Something went wrong.") + let(:root_subject) { OpenSSL::X509::Certificate.new(root_ca).subject.to_s } + let(:code) { OpenSSL::X509::V_ERR_INVALID_CA } + + it 'rejects the connection' do + ssl_context.stubs(:error_string).returns("Something went wrong") + ssl_context.stubs(:error).returns(code) + + expect(subject.call(false, ssl_context)).to eq(false) end it 'makes the error available via #verify_errors' do + ssl_context.stubs(:error_string).returns("Something went wrong") + ssl_context.stubs(:error).returns(code) + + subject.call(false, ssl_context) + expect(subject.verify_errors).to eq(["Something went wrong for #{root_subject}"]) + end + + it 'uses a generic message if error_string is nil' do + ssl_context.stubs(:error_string).returns(nil) + ssl_context.stubs(:error).returns(code) + + subject.call(false, ssl_context) + expect(subject.verify_errors).to eq(["OpenSSL error #{code} for #{root_subject}"]) + end + + it 'uses 0 for nil error codes' do + ssl_context.stubs(:error_string).returns("Something went wrong") + ssl_context.stubs(:error).returns(nil) + subject.call(false, ssl_context) - msg_suffix = OpenSSL::X509::Certificate.new(root_ca).subject - subject.verify_errors.should == ["Something went wrong. for #{msg_suffix}"] + expect(subject.verify_errors).to eq(["Something went wrong for #{root_subject}"]) + end + + context "when CRL is not yet valid" do + before :each do + ssl_context.stubs(:error_string).returns("CRL is not yet valid") + ssl_context.stubs(:error).returns(OpenSSL::X509::V_ERR_CRL_NOT_YET_VALID) + end + + it 'rejects nil CRL' do + ssl_context.stubs(:current_crl).returns(nil) + + expect(subject.call(false, ssl_context)).to eq(false) + expect(subject.verify_errors).to eq(["CRL is not yet valid"]) + end + + it 'includes the CRL issuer in the verify error message' do + crl = OpenSSL::X509::CRL.new + crl.issuer = OpenSSL::X509::Name.new([['CN','Puppet CA: puppetmaster.example.com']]) + crl.last_update = Time.now + 24 * 60 * 60 + ssl_context.stubs(:current_crl).returns(crl) + + subject.call(false, ssl_context) + expect(subject.verify_errors).to eq(["CRL is not yet valid for /CN=Puppet CA: puppetmaster.example.com"]) + end + + it 'rejects CRLs whose last_update time is more than 5 minutes in the future' do + crl = OpenSSL::X509::CRL.new + crl.issuer = OpenSSL::X509::Name.new([['CN','Puppet CA: puppetmaster.example.com']]) + crl.last_update = Time.now + 24 * 60 * 60 + ssl_context.stubs(:current_crl).returns(crl) + + expect(subject.call(false, ssl_context)).to eq(false) + end + + it 'accepts CRLs whose last_update time is 10 seconds in the future' do + crl = OpenSSL::X509::CRL.new + crl.issuer = OpenSSL::X509::Name.new([['CN','Puppet CA: puppetmaster.example.com']]) + crl.last_update = Time.now + 10 + ssl_context.stubs(:current_crl).returns(crl) + + expect(subject.call(false, ssl_context)).to eq(true) + end end end end @@ -54,7 +120,7 @@ context 'When pre-verification is OK' do context 'and the ssl_context is in an error state' do before :each do - ssl_context.stubs(:error_string).returns("Something went wrong.") + ssl_context.stubs(:error_string).returns("Something went wrong") end it 'does not make the error available via #verify_errors' do -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
