puppet 3.7.2 → 3.7.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

@@ -16,10 +16,10 @@ build_gem: TRUE
16
16
  build_dmg: TRUE
17
17
  build_msi:
18
18
  puppet_for_the_win:
19
- ref: 'f4f74b1c8d8792089d1d3328b01f5ff075771eb0'
19
+ ref: '4eb71b5b063f611eb447d561d51481831a66b5dd'
20
20
  repo: 'git://github.com/puppetlabs/puppet_for_the_win.git'
21
21
  facter:
22
- ref: 'refs/tags/2.2.0'
22
+ ref: 'refs/tags/2.3.0'
23
23
  repo: 'git://github.com/puppetlabs/facter.git'
24
24
  hiera:
25
25
  ref: 'refs/tags/1.3.4'
@@ -359,10 +359,10 @@ class Application
359
359
  # has not been made from the command line.
360
360
  #
361
361
  configured_environment_name = Puppet[:environment]
362
- if self.class.run_mode.name != :agent
363
- configured_environment = Puppet.lookup(:environments).get!(configured_environment_name)
364
- else
362
+ if self.class.run_mode.name == :agent
365
363
  configured_environment = Puppet::Node::Environment.remote(configured_environment_name)
364
+ else
365
+ configured_environment = Puppet.lookup(:environments).get!(configured_environment_name)
366
366
  end
367
367
  configured_environment = configured_environment.override_from_commandline(Puppet.settings)
368
368
 
@@ -316,9 +316,30 @@ module Puppet::Environments
316
316
  class Cached < Combined
317
317
  INFINITY = 1.0 / 0.0
318
318
 
319
+ class DefaultCacheExpirationService
320
+ def created(env)
321
+ end
322
+
323
+ def expired?(env_name)
324
+ false
325
+ end
326
+
327
+ def evicted(env_name)
328
+ end
329
+ end
330
+
331
+ def self.cache_expiration_service=(service)
332
+ @cache_expiration_service = service
333
+ end
334
+
335
+ def self.cache_expiration_service
336
+ @cache_expiration_service || DefaultCacheExpirationService.new
337
+ end
338
+
319
339
  def initialize(*loaders)
320
340
  super
321
341
  @cache = {}
342
+ @cache_expiration_service = Puppet::Environments::Cached.cache_expiration_service
322
343
  end
323
344
 
324
345
  def get(name)
@@ -355,6 +376,7 @@ module Puppet::Environments
355
376
  # Creates a suitable cache entry given the time to live for one environment
356
377
  #
357
378
  def entry(env)
379
+ @cache_expiration_service.created(env)
358
380
  ttl = (conf = get_conf(env.name)) ? conf.environment_timeout : Puppet.settings.value(:environment_timeout)
359
381
  case ttl
360
382
  when 0
@@ -369,8 +391,9 @@ module Puppet::Environments
369
391
  # Evicts the entry if it has expired
370
392
  # Also clears caches in Settings that may prevent the entry from being updated
371
393
  def evict_if_expired(name)
372
- if (result = @cache[name]) && result.expired?
394
+ if (result = @cache[name]) && (result.expired? || @cache_expiration_service.expired?(name))
373
395
  @cache.delete(name)
396
+ @cache_expiration_service.evicted(name)
374
397
 
375
398
  Puppet.settings.clear_environment_settings(name)
376
399
  end
@@ -36,7 +36,7 @@ class Puppet::Resource::Ral < Puppet::Indirector::Code
36
36
  res = request.instance
37
37
  ral_res = res.to_ral
38
38
 
39
- catalog = Puppet::Resource::Catalog.new
39
+ catalog = Puppet::Resource::Catalog.new(nil, request.environment)
40
40
  catalog.add_resource ral_res
41
41
  transaction = catalog.apply
42
42
 
@@ -329,7 +329,7 @@ class Puppet::Pops::Parser::Lexer2
329
329
  emit(TOKEN_COMMA, before)
330
330
 
331
331
  when '['
332
- if (before == 0 || scn.string[before-1,1] =~ /[[:blank:]\r\n]+/)
332
+ if (before == 0 || scn.string[locator.char_offset(before)-1,1] =~ /[[:blank:]\r\n]+/)
333
333
  emit(TOKEN_LISTSTART, before)
334
334
  else
335
335
  emit(TOKEN_LBRACK, before)
@@ -46,13 +46,25 @@ class Puppet::Pops::Parser::Parser
46
46
  [namespace, name].join('::').sub(/^::/, '')
47
47
  end
48
48
 
49
- # Raises a Parse error.
50
- def error(value, message, options = {})
49
+ # Raises a Parse error with location information. Information about file is always obtained from the
50
+ # lexer. Line and position is produced if the given semantic is a Positioned object and have been given an offset.
51
+ #
52
+ def error(semantic, message)
53
+ semantic = semantic.current() if semantic.is_a?(Puppet::Pops::Model::Factory)
54
+ # Adapt the model so it is possible to get location information.
55
+ # The model may not have been added to the source tree, so give it the lexer's locator
56
+ # directly instead of searching for the root Program where the locator is normally stored.
57
+ #
58
+ if semantic.is_a?(Puppet::Pops::Model::Positioned)
59
+ adapter = Puppet::Pops::Adapters::SourcePosAdapter.adapt(semantic)
60
+ adapter.locator = @lexer.locator
61
+ else
62
+ adapter = nil
63
+ end
51
64
  except = Puppet::ParseError.new(message)
52
- except.line = options[:line] || value[:line]
53
- except.file = options[:file] || value[:file]
54
- except.pos = options[:pos] || value[:pos]
55
-
65
+ except.file = @lexer.locator.file
66
+ except.line = adapter.line if adapter
67
+ except.pos = adapter.pos if adapter
56
68
  raise except
57
69
  end
58
70
 
@@ -114,10 +126,9 @@ class Puppet::Pops::Parser::Parser
114
126
  end
115
127
 
116
128
  # Parses a String of pp DSL code.
117
- # @todo make it possible to pass a given origin
118
129
  #
119
- def parse_string(code)
120
- @lexer.string = code
130
+ def parse_string(code, path = '')
131
+ @lexer.lex_string(code, path)
121
132
  _parse()
122
133
  end
123
134
 
@@ -14,6 +14,26 @@ module Puppet::Pops::Utils
14
14
  end
15
15
  end
16
16
 
17
+ # Convert a match from Puppet::Pops::Patterns::NUMERIC to floating point value if
18
+ # possible
19
+ def self.match_to_fp(match)
20
+ if match[5].to_s.length > 0
21
+ # Use default radix (default is decimal == 10) for floats
22
+ # Do not convert a value that is 0 raised to 10^somevalue to float - the value is always 0
23
+ # i.e. 0000.0e1, 0e1, 0.0000e1
24
+ if Integer(match[4]) == 0 && match[5] =~ /\A\.?0*[eE].*\z/
25
+ nil
26
+ else
27
+ fp_value = Float(match[2])
28
+ if fp_value != Puppet::Pops::Types::TypeCalculator::TheInfinity
29
+ match[1] == '-' ? -fp_value : fp_value
30
+ else
31
+ nil
32
+ end
33
+ end
34
+ end
35
+ end
36
+
17
37
  # To Numeric with radix, or nil if not a number.
18
38
  # If the value is already Numeric it is returned verbatim with a radix of 10.
19
39
  # @param o [String, Number] a string containing a number in octal, hex, integer (decimal) or floating point form
@@ -29,8 +49,8 @@ module Puppet::Pops::Utils
29
49
  if !match
30
50
  nil
31
51
  elsif match[5].to_s.length > 0
32
- # Use default radix (default is decimal == 10) for floats
33
- match[1] == '-' ? [-Float(match[2]), 10] : [Float(match[2]), 10]
52
+ fp_value = match_to_fp(match)
53
+ fp_value.nil? ? nil : [fp_value, 10]
34
54
  else
35
55
  # Set radix (default is decimal == 10)
36
56
  radix = 10
@@ -68,7 +88,7 @@ module Puppet::Pops::Utils
68
88
  if !match
69
89
  nil
70
90
  elsif match[5].to_s.length > 0
71
- match[1] == '-' ? -Float(match[2]) : Float(match[2])
91
+ match_to_fp(match)
72
92
  else
73
93
  match[1] == '-' ? -Integer(match[2]) : Integer(match[2])
74
94
  end
@@ -357,8 +357,8 @@ class Puppet::Resource
357
357
 
358
358
  def missing_arguments
359
359
  resource_type.arguments.select do |param, default|
360
- param = param.to_sym
361
- parameters[param].nil? || parameters[param].value == :undef
360
+ the_param = parameters[param.to_sym]
361
+ the_param.nil? || the_param.value.nil? || the_param.value == :undef
362
362
  end
363
363
  end
364
364
  private :missing_arguments
@@ -576,8 +576,9 @@ class Puppet::Settings
576
576
  end
577
577
 
578
578
  # Call any hooks we should be calling.
579
+ value_sets = value_sets_for(env, preferred_run_mode)
579
580
  @config.values.select(&:has_hook?).each do |setting|
580
- value_sets_for(env, self.preferred_run_mode).each do |source|
581
+ value_sets.each do |source|
581
582
  if source.include?(setting.name)
582
583
  # We still have to use value to retrieve the value, since
583
584
  # we want the fully interpolated value, not $vardir/lib or whatever.
@@ -587,7 +588,11 @@ class Puppet::Settings
587
588
  if setting.call_hook_on_initialize?
588
589
  @hooks_to_call_on_application_initialization << setting
589
590
  else
590
- setting.handle(self.value(setting.name, env))
591
+ setting.handle(ChainedValues.new(
592
+ preferred_run_mode,
593
+ env,
594
+ value_sets,
595
+ @config).interpolate(setting.name))
591
596
  end
592
597
  break
593
598
  end
@@ -671,7 +671,7 @@ Puppet::Type.newtype(:file) do
671
671
  :recurselimit => self[:recurselimit],
672
672
  :ignore => self[:ignore],
673
673
  :checksum_type => (self[:source] || self[:content]) ? self[:checksum] : :none,
674
- :environment => catalog.environment
674
+ :environment => catalog.environment_instance
675
675
  )
676
676
  end
677
677
 
@@ -95,7 +95,7 @@ module Puppet
95
95
  metadata && metadata.checksum
96
96
  end
97
97
 
98
- # Look up (if necessary) and return remote content.
98
+ # Look up (if necessary) and return local content.
99
99
  def content
100
100
  return @content if @content
101
101
  raise Puppet::DevError, "No source for content was stored with the metadata" unless metadata.source
@@ -170,7 +170,7 @@ module Puppet
170
170
  value.each do |source|
171
171
  begin
172
172
  options = {
173
- :environment => resource.catalog.environment,
173
+ :environment => resource.catalog.environment_instance,
174
174
  :links => resource[:links],
175
175
  :source_permissions => resource[:source_permissions]
176
176
  }
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  module Puppet
10
- PUPPETVERSION = '3.7.2'
10
+ PUPPETVERSION = '3.7.3'
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe "setting hooks" do
4
+ let(:confdir) { Puppet[:confdir] }
5
+ let(:environmentpath) { File.expand_path("envdir", confdir) }
6
+
7
+ describe "reproducing PUP-3500" do
8
+ let(:productiondir) { File.join(environmentpath, "production") }
9
+
10
+ before(:each) do
11
+ FileUtils.mkdir_p(productiondir)
12
+ end
13
+
14
+ it "accesses correct directory environment settings after intializing a setting with an on_write hook" do
15
+ expect(Puppet.settings.setting(:certname).call_hook).to eq(:on_write_only)
16
+
17
+ File.open(File.join(confdir, "puppet.conf"), "w") do |f|
18
+ f.puts("environmentpath=#{environmentpath}")
19
+ f.puts("certname=something")
20
+ end
21
+
22
+ Puppet.initialize_settings
23
+ production_env = Puppet.lookup(:environments).get(:production)
24
+ expect(Puppet.settings.value(:manifest, production_env)).to eq("#{productiondir}/manifests")
25
+ end
26
+ end
27
+ end
@@ -206,6 +206,19 @@ describe "Puppet resource expressions" do
206
206
  "@@notify { example: } realize(Notify[example])" => "defined(Notify[example])",
207
207
  "@@notify { exported: message => set } notify { real: message => Notify[exported][message] }" => "Notify[real][message] == 'set'")
208
208
  end
209
+
210
+ context "explicit undefs" do
211
+ # PUP-3505
212
+ produces("
213
+ $x = 10
214
+ define foo($x = undef) {
215
+ notify { example:
216
+ message => \"'$x'\"
217
+ }
218
+ }
219
+ foo {'blah': x => undef }
220
+ " => "Notify[example][message] == \"''\"")
221
+ end
209
222
  end
210
223
 
211
224
  describe "current parser" do
@@ -70,6 +70,12 @@ describe Puppet::Type.type(:file), :uses_checksums => true do
70
70
  end
71
71
  end
72
72
 
73
+ around :each do |example|
74
+ Puppet.override(:environments => Puppet::Environments::Static.new) do
75
+ example.run
76
+ end
77
+ end
78
+
73
79
  before do
74
80
  # stub this to not try to create state.yaml
75
81
  Puppet::Util::Storage.stubs(:store)
@@ -360,6 +360,59 @@ config_version=$vardir/random/scripts
360
360
  end
361
361
  end
362
362
  end
363
+
364
+ context "custom cache expiration service" do
365
+ let(:envs_created) { Set.new }
366
+ let(:envs_expired) { Set.new }
367
+ let(:envs_evicted) { Set.new }
368
+
369
+ it "should support registering a custom cache expiration service" do
370
+
371
+ class CustomExpirationService
372
+ def initialize(envs_created, envs_expired, envs_evicted)
373
+ @envs_created = envs_created
374
+ @envs_expired = envs_expired
375
+ @envs_evicted = envs_evicted
376
+ end
377
+
378
+ def created(env)
379
+ @envs_created << env.name
380
+ end
381
+ def expired?(env_name)
382
+ @envs_expired << env_name
383
+ true
384
+ end
385
+ def evicted(env_name)
386
+ @envs_evicted << env_name
387
+ end
388
+ end
389
+
390
+ Puppet[:environment_timeout] = "unlimited"
391
+ directory_tree = FS::MemoryFile.a_directory(File.expand_path("envdir"), [
392
+ FS::MemoryFile.a_directory("static1", [
393
+ FS::MemoryFile.a_missing_file("environment.conf"),
394
+ ]),
395
+ ])
396
+
397
+ loader_from(:filesystem => [directory_tree],
398
+ :directory => directory_tree) do |loader|
399
+ begin
400
+ orig_svc = Puppet::Environments::Cached.cache_expiration_service
401
+ Puppet::Environments::Cached.cache_expiration_service =
402
+ CustomExpirationService.new(envs_created, envs_expired, envs_evicted)
403
+ cached = Puppet::Environments::Cached.new(loader)
404
+ cached.get(:static1)
405
+ cached.get(:static1)
406
+
407
+ expect(envs_created.include?(:static1)).to eq(true)
408
+ expect(envs_expired.include?(:static1)).to eq(true)
409
+ expect(envs_evicted.include?(:static1)).to eq(true)
410
+ ensure
411
+ Puppet::Environments::Cached.cache_expiration_service = orig_svc
412
+ end
413
+ end
414
+ end
415
+ end
363
416
  end
364
417
  end
365
418
 
@@ -139,7 +139,8 @@ describe Puppet::Resource::Catalog::StaticCompiler do
139
139
  options[:request] ||= request
140
140
 
141
141
  # Build a catalog suitable for the static compiler to operate on
142
- catalog = Puppet::Resource::Catalog.new("#{options[:request].key}", Puppet::Node::Environment.remote(:testing))
142
+ environment = Puppet::Node::Environment.remote(:testing)
143
+ catalog = Puppet::Resource::Catalog.new("#{options[:request].key}", environment)
143
144
 
144
145
  # Mock out the fileserver, otherwise converting the catalog to a
145
146
  fake_fileserver_metadata = fileserver_metadata(options)
@@ -150,7 +151,7 @@ describe Puppet::Resource::Catalog::StaticCompiler do
150
151
  indirection.stubs(:find).with do |uri, opts|
151
152
  expect(uri).to eq options[:source].sub('puppet:///','')
152
153
  expect(opts[:links]).to eq :manage
153
- expect(opts[:environment]).to eq "testing"
154
+ expect(opts[:environment]).to eq environment
154
155
  end.returns(fake_fileserver_metadata)
155
156
 
156
157
  # I want a resource that all the file resources require and another
@@ -119,29 +119,15 @@ describe "Puppet::Resource::Ral" do
119
119
  end
120
120
 
121
121
  describe "save" do
122
- before do
123
- @rebuilt_res = stub 'rebuilt instance'
124
- @ral_res = stub 'ral resource', :to_resource => @rebuilt_res
125
- @instance = stub 'instance', :to_ral => @ral_res
126
- @request = stub 'request', :key => "user/", :instance => @instance
127
- @catalog = stub 'catalog'
128
- @report = stub 'report'
129
- @transaction = stub 'transaction', :report => @report
130
-
131
- Puppet::Resource::Catalog.stubs(:new).returns(@catalog)
132
- @catalog.stubs(:apply).returns(@transaction)
133
- @catalog.stubs(:add_resource)
134
- end
122
+ it "returns a report covering the application of the given resource to the system" do
123
+ resource = Puppet::Resource.new(:notify, "the title")
124
+ ral = Puppet::Resource::Ral.new
135
125
 
136
- it "should apply a new catalog with a ral object in it" do
137
- Puppet::Resource::Catalog.expects(:new).returns(@catalog)
138
- @catalog.expects(:add_resource).with(@ral_res)
139
- @catalog.expects(:apply).returns(@transaction)
140
- Puppet::Resource::Ral.new.save(@request).should
141
- end
126
+ applied_resource, report = ral.save(Puppet::Indirector::Request.new(:ral, :save, 'testing', resource, :environment => Puppet::Node::Environment.remote(:testing)))
142
127
 
143
- it "should return a regular resource that used to be the ral resource" do
144
- Puppet::Resource::Ral.new.save(@request).should == [@rebuilt_res, @report]
128
+ expect(applied_resource.title).to eq("the title")
129
+ expect(report.environment).to eq("testing")
130
+ expect(report.resource_statuses["Notify[the title]"].changed).to eq(true)
145
131
  end
146
132
  end
147
133
  end
@@ -351,16 +351,32 @@ describe 'Lexer2' do
351
351
  end
352
352
  end
353
353
 
354
- it 'should support unicode characters' do
355
- code = <<-CODE
356
- "x\\u2713y"
357
- CODE
358
- if Puppet::Pops::Parser::Locator::RUBYVER < Puppet::Pops::Parser::Locator::RUBY_1_9_3
359
- # Ruby 1.8.7 reports the multibyte char as several octal characters
360
- tokens_scanned_from(code).should match_tokens2([:STRING, "x\342\234\223y"])
361
- else
362
- # >= Ruby 1.9.3 reports \u
363
- tokens_scanned_from(code).should match_tokens2([:STRING, "x\u2713y"])
354
+ context 'when dealing with multi byte characters' do
355
+ it 'should support unicode characters' do
356
+ code = <<-CODE
357
+ "x\\u2713y"
358
+ CODE
359
+ if Puppet::Pops::Parser::Locator::RUBYVER < Puppet::Pops::Parser::Locator::RUBY_1_9_3
360
+ # Ruby 1.8.7 reports the multibyte char as several octal characters
361
+ tokens_scanned_from(code).should match_tokens2([:STRING, "x\342\234\223y"])
362
+ else
363
+ # >= Ruby 1.9.3 reports \u
364
+ tokens_scanned_from(code).should match_tokens2([:STRING, "x\u2713y"])
365
+ end
366
+ end
367
+
368
+ it 'should not select LISTSTART token when preceded by multibyte chars' do
369
+ # This test is sensitive to the number of multibyte characters and position of the expressions
370
+ # within the string - it is designed to fail if the position is calculated on the byte offset of the '['
371
+ # instead of the char offset.
372
+ #
373
+ code = "$a = '\u00f6\u00fc\u00fc\u00fc\u00fc\u00e4\u00e4\u00f6\u00e4'\nnotify {'x': message => B['dkda'] }\n"
374
+ tokens_scanned_from(code).should match_tokens2(
375
+ :VARIABLE, :EQUALS, :STRING,
376
+ [:NAME, 'notify'], :LBRACE,
377
+ [:STRING, 'x'], :COLON,
378
+ :NAME, :FARROW, :CLASSREF, :LBRACK, :STRING, :RBRACK,
379
+ :RBRACE)
364
380
  end
365
381
  end
366
382
 
@@ -30,4 +30,18 @@ describe Puppet::Pops::Parser::Parser do
30
30
  expect(adapter.offset).to eq(10)
31
31
  expect(adapter.length).to eq(0)
32
32
  end
33
+
34
+ it "should raise an error with position information when error is raised from within parser" do
35
+ parser = Puppet::Pops::Parser::Parser.new()
36
+ the_error = nil
37
+ begin
38
+ parser.parse_string("File [1] { }", 'fakefile.pp')
39
+ rescue Puppet::ParseError => e
40
+ the_error = e
41
+ end
42
+ expect(the_error).to be_a(Puppet::ParseError)
43
+ expect(the_error.file).to eq('fakefile.pp')
44
+ expect(the_error.line).to eq(1)
45
+ expect(the_error.pos).to eq(6)
46
+ end
33
47
  end
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+ require 'puppet/pops'
3
+
4
+ describe 'pops utils' do
5
+ context 'when converting strings to numbers' do
6
+ it 'should convert "0" to 0' do
7
+ expect(Puppet::Pops::Utils.to_n("0")).to eq(0)
8
+ end
9
+
10
+ it 'should convert "0" to 0 with radix' do
11
+ expect(Puppet::Pops::Utils.to_n_with_radix("0")).to eq([0, 10])
12
+ end
13
+
14
+ it 'should convert "0.0" to 0.0' do
15
+ expect(Puppet::Pops::Utils.to_n("0.0")).to eq(0.0)
16
+ end
17
+
18
+ it 'should convert "0.0" to 0.0 with radix' do
19
+ expect(Puppet::Pops::Utils.to_n_with_radix("0.0")).to eq([0.0, 10])
20
+ end
21
+
22
+ it 'should convert "0.01e1" to 0.01e1' do
23
+ expect(Puppet::Pops::Utils.to_n("0.01e1")).to eq(0.01e1)
24
+ expect(Puppet::Pops::Utils.to_n("0.01E1")).to eq(0.01e1)
25
+ end
26
+
27
+ it 'should convert "0.01e1" to 0.01e1 with radix' do
28
+ expect(Puppet::Pops::Utils.to_n_with_radix("0.01e1")).to eq([0.01e1, 10])
29
+ expect(Puppet::Pops::Utils.to_n_with_radix("0.01E1")).to eq([0.01e1, 10])
30
+ end
31
+
32
+ it 'should not convert "0e1" to floating point' do
33
+ expect(Puppet::Pops::Utils.to_n("0e1")).to be_nil
34
+ expect(Puppet::Pops::Utils.to_n("0E1")).to be_nil
35
+ end
36
+
37
+ it 'should not convert "0e1" to floating point with radix' do
38
+ expect(Puppet::Pops::Utils.to_n_with_radix("0e1")).to be_nil
39
+ expect(Puppet::Pops::Utils.to_n_with_radix("0E1")).to be_nil
40
+ end
41
+
42
+ it 'should not convert "0.0e1" to floating point' do
43
+ expect(Puppet::Pops::Utils.to_n("0.0e1")).to be_nil
44
+ expect(Puppet::Pops::Utils.to_n("0.0E1")).to be_nil
45
+ end
46
+
47
+ it 'should not convert "0.0e1" to floating point with radix' do
48
+ expect(Puppet::Pops::Utils.to_n_with_radix("0.0e1")).to be_nil
49
+ expect(Puppet::Pops::Utils.to_n_with_radix("0.0E1")).to be_nil
50
+ end
51
+
52
+ it 'should not convert "000000.0000e1" to floating point' do
53
+ expect(Puppet::Pops::Utils.to_n("000000.0000e1")).to be_nil
54
+ expect(Puppet::Pops::Utils.to_n("000000.0000E1")).to be_nil
55
+ end
56
+
57
+ it 'should not convert "000000.0000e1" to floating point with radix' do
58
+ expect(Puppet::Pops::Utils.to_n_with_radix("000000.0000e1")).to be_nil
59
+ expect(Puppet::Pops::Utils.to_n_with_radix("000000.0000E1")).to be_nil
60
+ end
61
+
62
+ it 'should not convert infinite values to floating point' do
63
+ expect(Puppet::Pops::Utils.to_n("4e999")).to be_nil
64
+ end
65
+
66
+ it 'should not convert infinite values to floating point with_radix' do
67
+ expect(Puppet::Pops::Utils.to_n_with_radix("4e999")).to be_nil
68
+ end
69
+ end
70
+ end
@@ -6,10 +6,16 @@ source = Puppet::Type.type(:file).attrclass(:source)
6
6
  describe Puppet::Type.type(:file).attrclass(:source) do
7
7
  include PuppetSpec::Files
8
8
 
9
+ around :each do |example|
10
+ Puppet.override(:environments => Puppet::Environments::Static.new) do
11
+ example.run
12
+ end
13
+ end
14
+
9
15
  before do
10
16
  # Wow that's a messy interface to the resource.
11
- @environment = "myenv"
12
- @resource = stub 'resource', :[]= => nil, :property => nil, :catalog => stub("catalog", :dependent_data_expired? => false, :environment => @environment), :line => 0, :file => ''
17
+ @environment = Puppet::Node::Environment.remote("myenv")
18
+ @resource = stub 'resource', :[]= => nil, :property => nil, :catalog => Puppet::Resource::Catalog.new(nil, @environment), :line => 0, :file => ''
13
19
  @foobar = make_absolute("/foo/bar baz")
14
20
  @feebooz = make_absolute("/fee/booz baz")
15
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.2
4
+ version: 3.7.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-21 00:00:00.000000000 Z
12
+ date: 2014-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: facter
@@ -1765,6 +1765,7 @@ files:
1765
1765
  - spec/fixtures/java.tgz
1766
1766
  - spec/integration/environments/default_manifest_spec.rb
1767
1767
  - spec/integration/environments/settings_interpolation_spec.rb
1768
+ - spec/integration/environments/setting_hooks_spec.rb
1768
1769
  - spec/integration/file_bucket/file_spec.rb
1769
1770
  - spec/integration/node/environment_spec.rb
1770
1771
  - spec/integration/node/facts_spec.rb
@@ -2352,6 +2353,7 @@ files:
2352
2353
  - spec/unit/pops/parser/parse_resource_spec.rb
2353
2354
  - spec/unit/pops/parser/parse_calls_spec.rb
2354
2355
  - spec/unit/pops/parser/lexer2_spec.rb
2356
+ - spec/unit/pops/utils_spec.rb
2355
2357
  - spec/unit/pops/binder/bindings_checker_spec.rb
2356
2358
  - spec/unit/pops/binder/bindings_composer_spec.rb
2357
2359
  - spec/unit/pops/binder/injector_spec.rb
@@ -2846,6 +2848,7 @@ test_files:
2846
2848
  - spec/fixtures/java.tgz
2847
2849
  - spec/integration/environments/default_manifest_spec.rb
2848
2850
  - spec/integration/environments/settings_interpolation_spec.rb
2851
+ - spec/integration/environments/setting_hooks_spec.rb
2849
2852
  - spec/integration/file_bucket/file_spec.rb
2850
2853
  - spec/integration/node/environment_spec.rb
2851
2854
  - spec/integration/node/facts_spec.rb
@@ -3433,6 +3436,7 @@ test_files:
3433
3436
  - spec/unit/pops/parser/parse_resource_spec.rb
3434
3437
  - spec/unit/pops/parser/parse_calls_spec.rb
3435
3438
  - spec/unit/pops/parser/lexer2_spec.rb
3439
+ - spec/unit/pops/utils_spec.rb
3436
3440
  - spec/unit/pops/binder/bindings_checker_spec.rb
3437
3441
  - spec/unit/pops/binder/bindings_composer_spec.rb
3438
3442
  - spec/unit/pops/binder/injector_spec.rb