Hello community, here is the log from the commit of package puppet for openSUSE:Factory checked in at 2014-11-11 01:10:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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-10-29 21:11:04.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.puppet.new/puppet.changes 2014-11-11 01:11:23.000000000 +0100 @@ -1,0 +2,23 @@ +Sat Nov 8 20:23:07 UTC 2014 - da...@darins.net + +- update to 3.7.3 + * PUP-3601: Bump facter dependency to 2.3.0 + * PUP-3471: Windows Puppet x86 Installer Expands Environment Variables in Path + * PUP-3302: Puppet resource broken when directory environments enabled + * PUP-3500: Adding a setting to puppet.conf that has a :hook handled on define preloads incorrect directory environment settings. + * PUP-3505: Future parser handling undef’s incorrectly + * PUP-3514: Future parser not showing line/column for error + * PUP-3558: Future parser, square brackets in references cause syntax errors related to non-ASCII characters + * PUP-3602: Do not convert strings that are on the form “0e" to floating point + * PUP-3555: introduce override-able factory pattern for constructing environment cache entries + + 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=12001 + +- remove old .changelog +- fix invalid arg in init script for SLE + +------------------------------------------------------------------- Old: ---- puppet-3.7.2.tar.gz puppet.changelog New: ---- puppet-3.7.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ puppet.spec ++++++ --- /var/tmp/diff_new_pack.rk5Fvn/_old 2014-11-11 01:11:25.000000000 +0100 +++ /var/tmp/diff_new_pack.rk5Fvn/_new 2014-11-11 01:11:25.000000000 +0100 @@ -22,7 +22,7 @@ %define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services Name: puppet -Version: 3.7.2 +Version: 3.7.3 Release: 0 Summary: A network tool for managing many disparate systems License: Apache-2.0 @@ -31,7 +31,6 @@ Source: http://downloads.puppetlabs.com/puppet/%{name}-%{version}.tar.gz Source1: puppetmaster.fw Source2: puppet.fw -Source7: puppet.changelog Obsoletes: hiera-puppet < 1.0.0 Provides: hiera-puppet >= 1.0.0 Requires: facter >= 1.6.0 @@ -93,7 +92,6 @@ %prep %setup -q -cp %{S:7} ChangeLog %build @@ -113,6 +111,8 @@ ln -sf service %{buildroot}/%{_sbindir}/rcpuppetmaster %else mkdir -p %{buildroot}%_initddir +# fix old port arg +sed -i 's/--port/--masterport/' ext/suse/client.init 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 @@ -248,7 +248,7 @@ %files %defattr(-,root,root,-) -%doc LICENSE README.* ChangeLog +%doc LICENSE README.* %{_bindir}/puppet %{_bindir}/extlookup2hiera %{_libdir}/ruby/vendor_ruby/%{rb_ver}/puppet/ ++++++ puppet-3.7.2.tar.gz -> puppet-3.7.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/ext/build_defaults.yaml new/puppet-3.7.3/ext/build_defaults.yaml --- old/puppet-3.7.2/ext/build_defaults.yaml 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/ext/build_defaults.yaml 2014-11-03 23:23:12.000000000 +0100 @@ -16,10 +16,10 @@ build_dmg: TRUE build_msi: puppet_for_the_win: - ref: 'f4f74b1c8d8792089d1d3328b01f5ff075771eb0' + ref: '4eb71b5b063f611eb447d561d51481831a66b5dd' repo: 'git://github.com/puppetlabs/puppet_for_the_win.git' facter: - ref: 'refs/tags/2.2.0' + ref: 'refs/tags/2.3.0' repo: 'git://github.com/puppetlabs/facter.git' hiera: ref: 'refs/tags/1.3.4' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/ext/debian/changelog new/puppet-3.7.3/ext/debian/changelog --- old/puppet-3.7.2/ext/debian/changelog 2014-10-21 23:52:30.000000000 +0200 +++ new/puppet-3.7.3/ext/debian/changelog 2014-11-03 23:23:19.000000000 +0100 @@ -1,8 +1,8 @@ -puppet (3.7.2-1puppetlabs1) hardy lucid natty oneiric unstable sid squeeze wheezy precise; urgency=low +puppet (3.7.3-1puppetlabs1) hardy lucid natty oneiric unstable sid squeeze wheezy precise; urgency=low - * Update to version 3.7.2-1puppetlabs1 + * Update to version 3.7.3-1puppetlabs1 - -- Puppet Labs Release <i...@puppetlabs.com> Tue, 21 Oct 2014 14:52:30 -0700 + -- Puppet Labs Release <i...@puppetlabs.com> Mon, 03 Nov 2014 14:23:19 -0800 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.2/ext/ips/puppet.p5m new/puppet-3.7.3/ext/ips/puppet.p5m --- old/puppet-3.7.2/ext/ips/puppet.p5m 2014-10-21 23:52:30.000000000 +0200 +++ new/puppet-3.7.3/ext/ips/puppet.p5m 2014-11-03 23:23:19.000000000 +0100 @@ -1,6 +1,6 @@ -set name=pkg.fmri value=pkg://puppetlabs.com/system/management/@3.7.2,13.4.0-0 +set name=pkg.fmri value=pkg://puppetlabs.com/system/management/@3.7.3,13.4.0-0 set name=pkg.summary value="Puppet, an automated configuration management tool" -set name=pkg.human-version value="3.7.2" +set name=pkg.human-version value="3.7.3" 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.2/ext/redhat/puppet.spec new/puppet-3.7.3/ext/redhat/puppet.spec --- old/puppet-3.7.2/ext/redhat/puppet.spec 2014-10-21 23:52:30.000000000 +0200 +++ new/puppet-3.7.3/ext/redhat/puppet.spec 2014-11-03 23:23:19.000000000 +0100 @@ -16,8 +16,8 @@ %endif # VERSION is subbed out during rake srpm process -%global realversion 3.7.2 -%global rpmversion 3.7.2 +%global realversion 3.7.3 +%global rpmversion 3.7.3 %global confdir ext/redhat %global pending_upgrade_path %{_localstatedir}/lib/rpm-state/puppet @@ -446,8 +446,8 @@ rm -rf %{buildroot} %changelog -* Tue Oct 21 2014 Puppet Labs Release <i...@puppetlabs.com> - 3.7.2-1 -- Build for 3.7.2 +* Mon Nov 03 2014 Puppet Labs Release <i...@puppetlabs.com> - 3.7.3-1 +- Build for 3.7.3 * Wed Oct 2 2013 Jason Antman <ja...@jasonantman.com> - 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.2/lib/puppet/application.rb new/puppet-3.7.3/lib/puppet/application.rb --- old/puppet-3.7.2/lib/puppet/application.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/lib/puppet/application.rb 2014-11-03 23:23:12.000000000 +0100 @@ -359,10 +359,10 @@ # has not been made from the command line. # configured_environment_name = Puppet[:environment] - if self.class.run_mode.name != :agent - configured_environment = Puppet.lookup(:environments).get!(configured_environment_name) - else + if self.class.run_mode.name == :agent configured_environment = Puppet::Node::Environment.remote(configured_environment_name) + else + configured_environment = Puppet.lookup(:environments).get!(configured_environment_name) end configured_environment = configured_environment.override_from_commandline(Puppet.settings) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/lib/puppet/environments.rb new/puppet-3.7.3/lib/puppet/environments.rb --- old/puppet-3.7.2/lib/puppet/environments.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/lib/puppet/environments.rb 2014-11-03 23:23:12.000000000 +0100 @@ -316,9 +316,30 @@ class Cached < Combined INFINITY = 1.0 / 0.0 + class DefaultCacheExpirationService + def created(env) + end + + def expired?(env_name) + false + end + + def evicted(env_name) + end + end + + def self.cache_expiration_service=(service) + @cache_expiration_service = service + end + + def self.cache_expiration_service + @cache_expiration_service || DefaultCacheExpirationService.new + end + def initialize(*loaders) super @cache = {} + @cache_expiration_service = Puppet::Environments::Cached.cache_expiration_service end def get(name) @@ -355,6 +376,7 @@ # Creates a suitable cache entry given the time to live for one environment # def entry(env) + @cache_expiration_service.created(env) ttl = (conf = get_conf(env.name)) ? conf.environment_timeout : Puppet.settings.value(:environment_timeout) case ttl when 0 @@ -369,8 +391,9 @@ # Evicts the entry if it has expired # Also clears caches in Settings that may prevent the entry from being updated def evict_if_expired(name) - if (result = @cache[name]) && result.expired? + if (result = @cache[name]) && (result.expired? || @cache_expiration_service.expired?(name)) @cache.delete(name) + @cache_expiration_service.evicted(name) Puppet.settings.clear_environment_settings(name) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/lib/puppet/indirector/resource/ral.rb new/puppet-3.7.3/lib/puppet/indirector/resource/ral.rb --- old/puppet-3.7.2/lib/puppet/indirector/resource/ral.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/lib/puppet/indirector/resource/ral.rb 2014-11-03 23:23:12.000000000 +0100 @@ -36,7 +36,7 @@ res = request.instance ral_res = res.to_ral - catalog = Puppet::Resource::Catalog.new + catalog = Puppet::Resource::Catalog.new(nil, request.environment) catalog.add_resource ral_res transaction = catalog.apply diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/lib/puppet/pops/parser/lexer2.rb new/puppet-3.7.3/lib/puppet/pops/parser/lexer2.rb --- old/puppet-3.7.2/lib/puppet/pops/parser/lexer2.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/lib/puppet/pops/parser/lexer2.rb 2014-11-03 23:23:12.000000000 +0100 @@ -329,7 +329,7 @@ emit(TOKEN_COMMA, before) when '[' - if (before == 0 || scn.string[before-1,1] =~ /[[:blank:]\r\n]+/) + if (before == 0 || scn.string[locator.char_offset(before)-1,1] =~ /[[:blank:]\r\n]+/) emit(TOKEN_LISTSTART, before) else emit(TOKEN_LBRACK, before) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/lib/puppet/pops/parser/parser_support.rb new/puppet-3.7.3/lib/puppet/pops/parser/parser_support.rb --- old/puppet-3.7.2/lib/puppet/pops/parser/parser_support.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/lib/puppet/pops/parser/parser_support.rb 2014-11-03 23:23:12.000000000 +0100 @@ -46,13 +46,25 @@ [namespace, name].join('::').sub(/^::/, '') end - # Raises a Parse error. - def error(value, message, options = {}) + # Raises a Parse error with location information. Information about file is always obtained from the + # lexer. Line and position is produced if the given semantic is a Positioned object and have been given an offset. + # + def error(semantic, message) + semantic = semantic.current() if semantic.is_a?(Puppet::Pops::Model::Factory) + # Adapt the model so it is possible to get location information. + # The model may not have been added to the source tree, so give it the lexer's locator + # directly instead of searching for the root Program where the locator is normally stored. + # + if semantic.is_a?(Puppet::Pops::Model::Positioned) + adapter = Puppet::Pops::Adapters::SourcePosAdapter.adapt(semantic) + adapter.locator = @lexer.locator + else + adapter = nil + end except = Puppet::ParseError.new(message) - except.line = options[:line] || value[:line] - except.file = options[:file] || value[:file] - except.pos = options[:pos] || value[:pos] - + except.file = @lexer.locator.file + except.line = adapter.line if adapter + except.pos = adapter.pos if adapter raise except end @@ -114,10 +126,9 @@ end # Parses a String of pp DSL code. - # @todo make it possible to pass a given origin # - def parse_string(code) - @lexer.string = code + def parse_string(code, path = '') + @lexer.lex_string(code, path) _parse() end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/lib/puppet/pops/utils.rb new/puppet-3.7.3/lib/puppet/pops/utils.rb --- old/puppet-3.7.2/lib/puppet/pops/utils.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/lib/puppet/pops/utils.rb 2014-11-03 23:23:12.000000000 +0100 @@ -14,6 +14,26 @@ end end + # Convert a match from Puppet::Pops::Patterns::NUMERIC to floating point value if + # possible + def self.match_to_fp(match) + if match[5].to_s.length > 0 + # Use default radix (default is decimal == 10) for floats + # Do not convert a value that is 0 raised to 10^somevalue to float - the value is always 0 + # i.e. 0000.0e1, 0e1, 0.0000e1 + if Integer(match[4]) == 0 && match[5] =~ /\A\.?0*[eE].*\z/ + nil + else + fp_value = Float(match[2]) + if fp_value != Puppet::Pops::Types::TypeCalculator::TheInfinity + match[1] == '-' ? -fp_value : fp_value + else + nil + end + end + end + end + # To Numeric with radix, or nil if not a number. # If the value is already Numeric it is returned verbatim with a radix of 10. # @param o [String, Number] a string containing a number in octal, hex, integer (decimal) or floating point form @@ -29,8 +49,8 @@ if !match nil elsif match[5].to_s.length > 0 - # Use default radix (default is decimal == 10) for floats - match[1] == '-' ? [-Float(match[2]), 10] : [Float(match[2]), 10] + fp_value = match_to_fp(match) + fp_value.nil? ? nil : [fp_value, 10] else # Set radix (default is decimal == 10) radix = 10 @@ -68,7 +88,7 @@ if !match nil elsif match[5].to_s.length > 0 - match[1] == '-' ? -Float(match[2]) : Float(match[2]) + match_to_fp(match) else match[1] == '-' ? -Integer(match[2]) : Integer(match[2]) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/lib/puppet/resource.rb new/puppet-3.7.3/lib/puppet/resource.rb --- old/puppet-3.7.2/lib/puppet/resource.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/lib/puppet/resource.rb 2014-11-03 23:23:13.000000000 +0100 @@ -357,8 +357,8 @@ def missing_arguments resource_type.arguments.select do |param, default| - param = param.to_sym - parameters[param].nil? || parameters[param].value == :undef + the_param = parameters[param.to_sym] + the_param.nil? || the_param.value.nil? || the_param.value == :undef end end private :missing_arguments diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/lib/puppet/settings.rb new/puppet-3.7.3/lib/puppet/settings.rb --- old/puppet-3.7.2/lib/puppet/settings.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/lib/puppet/settings.rb 2014-11-03 23:23:13.000000000 +0100 @@ -576,8 +576,9 @@ end # Call any hooks we should be calling. + value_sets = value_sets_for(env, preferred_run_mode) @config.values.select(&:has_hook?).each do |setting| - value_sets_for(env, self.preferred_run_mode).each do |source| + value_sets.each do |source| if source.include?(setting.name) # We still have to use value to retrieve the value, since # we want the fully interpolated value, not $vardir/lib or whatever. @@ -587,7 +588,11 @@ if setting.call_hook_on_initialize? @hooks_to_call_on_application_initialization << setting else - setting.handle(self.value(setting.name, env)) + setting.handle(ChainedValues.new( + preferred_run_mode, + env, + value_sets, + @config).interpolate(setting.name)) end break end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/lib/puppet/type/file/source.rb new/puppet-3.7.3/lib/puppet/type/file/source.rb --- old/puppet-3.7.2/lib/puppet/type/file/source.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/lib/puppet/type/file/source.rb 2014-11-03 23:23:13.000000000 +0100 @@ -95,7 +95,7 @@ metadata && metadata.checksum end - # Look up (if necessary) and return remote content. + # Look up (if necessary) and return local content. def content return @content if @content raise Puppet::DevError, "No source for content was stored with the metadata" unless metadata.source @@ -170,7 +170,7 @@ value.each do |source| begin options = { - :environment => resource.catalog.environment, + :environment => resource.catalog.environment_instance, :links => resource[:links], :source_permissions => resource[:source_permissions] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/lib/puppet/type/file.rb new/puppet-3.7.3/lib/puppet/type/file.rb --- old/puppet-3.7.2/lib/puppet/type/file.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/lib/puppet/type/file.rb 2014-11-03 23:23:13.000000000 +0100 @@ -671,7 +671,7 @@ :recurselimit => self[:recurselimit], :ignore => self[:ignore], :checksum_type => (self[:source] || self[:content]) ? self[:checksum] : :none, - :environment => catalog.environment + :environment => catalog.environment_instance ) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/lib/puppet/version.rb new/puppet-3.7.3/lib/puppet/version.rb --- old/puppet-3.7.2/lib/puppet/version.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/lib/puppet/version.rb 2014-11-03 23:23:13.000000000 +0100 @@ -7,7 +7,7 @@ module Puppet - PUPPETVERSION = '3.7.2' + PUPPETVERSION = '3.7.3' ## # 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.2/spec/integration/environments/setting_hooks_spec.rb new/puppet-3.7.3/spec/integration/environments/setting_hooks_spec.rb --- old/puppet-3.7.2/spec/integration/environments/setting_hooks_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/puppet-3.7.3/spec/integration/environments/setting_hooks_spec.rb 2014-11-03 23:23:13.000000000 +0100 @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe "setting hooks" do + let(:confdir) { Puppet[:confdir] } + let(:environmentpath) { File.expand_path("envdir", confdir) } + + describe "reproducing PUP-3500" do + let(:productiondir) { File.join(environmentpath, "production") } + + before(:each) do + FileUtils.mkdir_p(productiondir) + end + + it "accesses correct directory environment settings after intializing a setting with an on_write hook" do + expect(Puppet.settings.setting(:certname).call_hook).to eq(:on_write_only) + + File.open(File.join(confdir, "puppet.conf"), "w") do |f| + f.puts("environmentpath=#{environmentpath}") + f.puts("certname=something") + end + + Puppet.initialize_settings + production_env = Puppet.lookup(:environments).get(:production) + expect(Puppet.settings.value(:manifest, production_env)).to eq("#{productiondir}/manifests") + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/spec/integration/parser/resource_expressions_spec.rb new/puppet-3.7.3/spec/integration/parser/resource_expressions_spec.rb --- old/puppet-3.7.2/spec/integration/parser/resource_expressions_spec.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/spec/integration/parser/resource_expressions_spec.rb 2014-11-03 23:23:13.000000000 +0100 @@ -206,6 +206,19 @@ "@@notify { example: } realize(Notify[example])" => "defined(Notify[example])", "@@notify { exported: message => set } notify { real: message => Notify[exported][message] }" => "Notify[real][message] == 'set'") end + + context "explicit undefs" do + # PUP-3505 + produces(" + $x = 10 + define foo($x = undef) { + notify { example: + message => \"'$x'\" + } + } + foo {'blah': x => undef } + " => "Notify[example][message] == \"''\"") + end end describe "current parser" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/spec/integration/type/file_spec.rb new/puppet-3.7.3/spec/integration/type/file_spec.rb --- old/puppet-3.7.2/spec/integration/type/file_spec.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/spec/integration/type/file_spec.rb 2014-11-03 23:23:13.000000000 +0100 @@ -70,6 +70,12 @@ end end + around :each do |example| + Puppet.override(:environments => Puppet::Environments::Static.new) do + example.run + end + end + before do # stub this to not try to create state.yaml Puppet::Util::Storage.stubs(:store) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/spec/unit/environments_spec.rb new/puppet-3.7.3/spec/unit/environments_spec.rb --- old/puppet-3.7.2/spec/unit/environments_spec.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/spec/unit/environments_spec.rb 2014-11-03 23:23:13.000000000 +0100 @@ -360,6 +360,59 @@ end end end + + context "custom cache expiration service" do + let(:envs_created) { Set.new } + let(:envs_expired) { Set.new } + let(:envs_evicted) { Set.new } + + it "should support registering a custom cache expiration service" do + + class CustomExpirationService + def initialize(envs_created, envs_expired, envs_evicted) + @envs_created = envs_created + @envs_expired = envs_expired + @envs_evicted = envs_evicted + end + + def created(env) + @envs_created << env.name + end + def expired?(env_name) + @envs_expired << env_name + true + end + def evicted(env_name) + @envs_evicted << env_name + end + end + + Puppet[:environment_timeout] = "unlimited" + directory_tree = FS::MemoryFile.a_directory(File.expand_path("envdir"), [ + FS::MemoryFile.a_directory("static1", [ + FS::MemoryFile.a_missing_file("environment.conf"), + ]), + ]) + + loader_from(:filesystem => [directory_tree], + :directory => directory_tree) do |loader| + begin + orig_svc = Puppet::Environments::Cached.cache_expiration_service + Puppet::Environments::Cached.cache_expiration_service = + CustomExpirationService.new(envs_created, envs_expired, envs_evicted) + cached = Puppet::Environments::Cached.new(loader) + cached.get(:static1) + cached.get(:static1) + + expect(envs_created.include?(:static1)).to eq(true) + expect(envs_expired.include?(:static1)).to eq(true) + expect(envs_evicted.include?(:static1)).to eq(true) + ensure + Puppet::Environments::Cached.cache_expiration_service = orig_svc + end + end + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/spec/unit/indirector/catalog/static_compiler_spec.rb new/puppet-3.7.3/spec/unit/indirector/catalog/static_compiler_spec.rb --- old/puppet-3.7.2/spec/unit/indirector/catalog/static_compiler_spec.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/spec/unit/indirector/catalog/static_compiler_spec.rb 2014-11-03 23:23:13.000000000 +0100 @@ -139,7 +139,8 @@ options[:request] ||= request # Build a catalog suitable for the static compiler to operate on - catalog = Puppet::Resource::Catalog.new("#{options[:request].key}", Puppet::Node::Environment.remote(:testing)) + environment = Puppet::Node::Environment.remote(:testing) + catalog = Puppet::Resource::Catalog.new("#{options[:request].key}", environment) # Mock out the fileserver, otherwise converting the catalog to a fake_fileserver_metadata = fileserver_metadata(options) @@ -150,7 +151,7 @@ indirection.stubs(:find).with do |uri, opts| expect(uri).to eq options[:source].sub('puppet:///','') expect(opts[:links]).to eq :manage - expect(opts[:environment]).to eq "testing" + expect(opts[:environment]).to eq environment end.returns(fake_fileserver_metadata) # I want a resource that all the file resources require and another diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/spec/unit/indirector/resource/ral_spec.rb new/puppet-3.7.3/spec/unit/indirector/resource/ral_spec.rb --- old/puppet-3.7.2/spec/unit/indirector/resource/ral_spec.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/spec/unit/indirector/resource/ral_spec.rb 2014-11-03 23:23:13.000000000 +0100 @@ -119,29 +119,15 @@ end describe "save" do - before do - @rebuilt_res = stub 'rebuilt instance' - @ral_res = stub 'ral resource', :to_resource => @rebuilt_res - @instance = stub 'instance', :to_ral => @ral_res - @request = stub 'request', :key => "user/", :instance => @instance - @catalog = stub 'catalog' - @report = stub 'report' - @transaction = stub 'transaction', :report => @report + it "returns a report covering the application of the given resource to the system" do + resource = Puppet::Resource.new(:notify, "the title") + ral = Puppet::Resource::Ral.new - Puppet::Resource::Catalog.stubs(:new).returns(@catalog) - @catalog.stubs(:apply).returns(@transaction) - @catalog.stubs(:add_resource) - end - - it "should apply a new catalog with a ral object in it" do - Puppet::Resource::Catalog.expects(:new).returns(@catalog) - @catalog.expects(:add_resource).with(@ral_res) - @catalog.expects(:apply).returns(@transaction) - Puppet::Resource::Ral.new.save(@request).should - end + applied_resource, report = ral.save(Puppet::Indirector::Request.new(:ral, :save, 'testing', resource, :environment => Puppet::Node::Environment.remote(:testing))) - it "should return a regular resource that used to be the ral resource" do - Puppet::Resource::Ral.new.save(@request).should == [@rebuilt_res, @report] + expect(applied_resource.title).to eq("the title") + expect(report.environment).to eq("testing") + expect(report.resource_statuses["Notify[the title]"].changed).to eq(true) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/spec/unit/pops/parser/lexer2_spec.rb new/puppet-3.7.3/spec/unit/pops/parser/lexer2_spec.rb --- old/puppet-3.7.2/spec/unit/pops/parser/lexer2_spec.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/spec/unit/pops/parser/lexer2_spec.rb 2014-11-03 23:23:13.000000000 +0100 @@ -351,16 +351,32 @@ end end - it 'should support unicode characters' do - code = <<-CODE - "x\\u2713y" - CODE - if Puppet::Pops::Parser::Locator::RUBYVER < Puppet::Pops::Parser::Locator::RUBY_1_9_3 - # Ruby 1.8.7 reports the multibyte char as several octal characters - tokens_scanned_from(code).should match_tokens2([:STRING, "x\342\234\223y"]) - else - # >= Ruby 1.9.3 reports \u - tokens_scanned_from(code).should match_tokens2([:STRING, "x\u2713y"]) + context 'when dealing with multi byte characters' do + it 'should support unicode characters' do + code = <<-CODE + "x\\u2713y" + CODE + if Puppet::Pops::Parser::Locator::RUBYVER < Puppet::Pops::Parser::Locator::RUBY_1_9_3 + # Ruby 1.8.7 reports the multibyte char as several octal characters + tokens_scanned_from(code).should match_tokens2([:STRING, "x\342\234\223y"]) + else + # >= Ruby 1.9.3 reports \u + tokens_scanned_from(code).should match_tokens2([:STRING, "x\u2713y"]) + end + end + + it 'should not select LISTSTART token when preceded by multibyte chars' do + # This test is sensitive to the number of multibyte characters and position of the expressions + # within the string - it is designed to fail if the position is calculated on the byte offset of the '[' + # instead of the char offset. + # + code = "$a = '\u00f6\u00fc\u00fc\u00fc\u00fc\u00e4\u00e4\u00f6\u00e4'\nnotify {'x': message => B['dkda'] }\n" + tokens_scanned_from(code).should match_tokens2( + :VARIABLE, :EQUALS, :STRING, + [:NAME, 'notify'], :LBRACE, + [:STRING, 'x'], :COLON, + :NAME, :FARROW, :CLASSREF, :LBRACK, :STRING, :RBRACK, + :RBRACE) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/spec/unit/pops/parser/parser_spec.rb new/puppet-3.7.3/spec/unit/pops/parser/parser_spec.rb --- old/puppet-3.7.2/spec/unit/pops/parser/parser_spec.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/spec/unit/pops/parser/parser_spec.rb 2014-11-03 23:23:13.000000000 +0100 @@ -30,4 +30,18 @@ expect(adapter.offset).to eq(10) expect(adapter.length).to eq(0) end + + it "should raise an error with position information when error is raised from within parser" do + parser = Puppet::Pops::Parser::Parser.new() + the_error = nil + begin + parser.parse_string("File [1] { }", 'fakefile.pp') + rescue Puppet::ParseError => e + the_error = e + end + expect(the_error).to be_a(Puppet::ParseError) + expect(the_error.file).to eq('fakefile.pp') + expect(the_error.line).to eq(1) + expect(the_error.pos).to eq(6) + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/spec/unit/pops/utils_spec.rb new/puppet-3.7.3/spec/unit/pops/utils_spec.rb --- old/puppet-3.7.2/spec/unit/pops/utils_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/puppet-3.7.3/spec/unit/pops/utils_spec.rb 2014-11-03 23:23:13.000000000 +0100 @@ -0,0 +1,70 @@ +require 'spec_helper' +require 'puppet/pops' + +describe 'pops utils' do + context 'when converting strings to numbers' do + it 'should convert "0" to 0' do + expect(Puppet::Pops::Utils.to_n("0")).to eq(0) + end + + it 'should convert "0" to 0 with radix' do + expect(Puppet::Pops::Utils.to_n_with_radix("0")).to eq([0, 10]) + end + + it 'should convert "0.0" to 0.0' do + expect(Puppet::Pops::Utils.to_n("0.0")).to eq(0.0) + end + + it 'should convert "0.0" to 0.0 with radix' do + expect(Puppet::Pops::Utils.to_n_with_radix("0.0")).to eq([0.0, 10]) + end + + it 'should convert "0.01e1" to 0.01e1' do + expect(Puppet::Pops::Utils.to_n("0.01e1")).to eq(0.01e1) + expect(Puppet::Pops::Utils.to_n("0.01E1")).to eq(0.01e1) + end + + it 'should convert "0.01e1" to 0.01e1 with radix' do + expect(Puppet::Pops::Utils.to_n_with_radix("0.01e1")).to eq([0.01e1, 10]) + expect(Puppet::Pops::Utils.to_n_with_radix("0.01E1")).to eq([0.01e1, 10]) + end + + it 'should not convert "0e1" to floating point' do + expect(Puppet::Pops::Utils.to_n("0e1")).to be_nil + expect(Puppet::Pops::Utils.to_n("0E1")).to be_nil + end + + it 'should not convert "0e1" to floating point with radix' do + expect(Puppet::Pops::Utils.to_n_with_radix("0e1")).to be_nil + expect(Puppet::Pops::Utils.to_n_with_radix("0E1")).to be_nil + end + + it 'should not convert "0.0e1" to floating point' do + expect(Puppet::Pops::Utils.to_n("0.0e1")).to be_nil + expect(Puppet::Pops::Utils.to_n("0.0E1")).to be_nil + end + + it 'should not convert "0.0e1" to floating point with radix' do + expect(Puppet::Pops::Utils.to_n_with_radix("0.0e1")).to be_nil + expect(Puppet::Pops::Utils.to_n_with_radix("0.0E1")).to be_nil + end + + it 'should not convert "000000.0000e1" to floating point' do + expect(Puppet::Pops::Utils.to_n("000000.0000e1")).to be_nil + expect(Puppet::Pops::Utils.to_n("000000.0000E1")).to be_nil + end + + it 'should not convert "000000.0000e1" to floating point with radix' do + expect(Puppet::Pops::Utils.to_n_with_radix("000000.0000e1")).to be_nil + expect(Puppet::Pops::Utils.to_n_with_radix("000000.0000E1")).to be_nil + end + + it 'should not convert infinite values to floating point' do + expect(Puppet::Pops::Utils.to_n("4e999")).to be_nil + end + + it 'should not convert infinite values to floating point with_radix' do + expect(Puppet::Pops::Utils.to_n_with_radix("4e999")).to be_nil + end + end +end \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/puppet-3.7.2/spec/unit/type/file/source_spec.rb new/puppet-3.7.3/spec/unit/type/file/source_spec.rb --- old/puppet-3.7.2/spec/unit/type/file/source_spec.rb 2014-10-21 23:52:27.000000000 +0200 +++ new/puppet-3.7.3/spec/unit/type/file/source_spec.rb 2014-11-03 23:23:13.000000000 +0100 @@ -6,10 +6,16 @@ describe Puppet::Type.type(:file).attrclass(:source) do include PuppetSpec::Files + around :each do |example| + Puppet.override(:environments => Puppet::Environments::Static.new) do + example.run + end + end + before do # Wow that's a messy interface to the resource. - @environment = "myenv" - @resource = stub 'resource', :[]= => nil, :property => nil, :catalog => stub("catalog", :dependent_data_expired? => false, :environment => @environment), :line => 0, :file => '' + @environment = Puppet::Node::Environment.remote("myenv") + @resource = stub 'resource', :[]= => nil, :property => nil, :catalog => Puppet::Resource::Catalog.new(nil, @environment), :line => 0, :file => '' @foobar = make_absolute("/foo/bar baz") @feebooz = make_absolute("/fee/booz baz") -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org