puppet 4.10.0-universal-darwin → 4.10.1-universal-darwin
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.
- data/Gemfile +11 -35
- data/lib/puppet.rb +2 -2
- data/lib/puppet/defaults.rb +44 -12
- data/lib/puppet/indirector/catalog/compiler.rb +4 -2
- data/lib/puppet/module_tool/tar.rb +3 -3
- data/lib/puppet/parser/functions/new.rb +14 -1
- data/lib/puppet/pops/lookup.rb +3 -3
- data/lib/puppet/pops/lookup/global_data_provider.rb +6 -9
- data/lib/puppet/pops/lookup/interpolation.rb +6 -7
- data/lib/puppet/pops/lookup/invocation.rb +12 -2
- data/lib/puppet/pops/lookup/lookup_adapter.rb +11 -7
- data/lib/puppet/pops/serialization/object.rb +1 -1
- data/lib/puppet/pops/serialization/serializer.rb +9 -2
- data/lib/puppet/pops/types/string_converter.rb +24 -21
- data/lib/puppet/pops/types/types.rb +16 -0
- data/lib/puppet/resource.rb +58 -20
- data/lib/puppet/resource/catalog.rb +3 -10
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +58 -3
- data/spec/integration/application/apply_spec.rb +1 -0
- data/spec/shared_contexts/types_setup.rb +28 -10
- data/spec/unit/functions/lookup_spec.rb +71 -0
- data/spec/unit/indirector/catalog/compiler_spec.rb +32 -4
- data/spec/unit/module_tool/tar_spec.rb +16 -10
- data/spec/unit/pops/lookup/interpolation_spec.rb +2 -2
- data/spec/unit/pops/serialization/serialization_spec.rb +30 -4
- data/spec/unit/pops/types/p_sem_ver_type_spec.rb +12 -17
- data/spec/unit/pops/types/p_type_set_type_spec.rb +2 -2
- data/spec/unit/pops/types/string_converter_spec.rb +21 -9
- data/spec/unit/pops/types/type_calculator_spec.rb +2 -2
- data/spec/unit/pops/types/types_spec.rb +11 -0
- data/spec/unit/resource/catalog_spec.rb +14 -15
- metadata +27 -13
- checksums.yaml +0 -7
@@ -255,10 +255,10 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
255
255
|
@facts = Puppet::Node::Facts.new('hostname', "fact" => "value", "architecture" => "i386")
|
256
256
|
end
|
257
257
|
|
258
|
-
def a_request_that_contains(facts)
|
258
|
+
def a_request_that_contains(facts, format = :pson)
|
259
259
|
request = Puppet::Indirector::Request.new(:catalog, :find, "hostname", nil)
|
260
|
-
request.options[:facts_format] =
|
261
|
-
request.options[:facts] = CGI.escape(facts.render(
|
260
|
+
request.options[:facts_format] = format.to_s
|
261
|
+
request.options[:facts] = CGI.escape(facts.render(format))
|
262
262
|
request
|
263
263
|
end
|
264
264
|
|
@@ -277,7 +277,7 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
277
277
|
expect(facts.timestamp).to eq(time)
|
278
278
|
end
|
279
279
|
|
280
|
-
it "
|
280
|
+
it "accepts PSON facts" do
|
281
281
|
request = a_request_that_contains(@facts)
|
282
282
|
|
283
283
|
options = {
|
@@ -289,6 +289,34 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
289
289
|
|
290
290
|
@compiler.extract_facts_from_request(request)
|
291
291
|
end
|
292
|
+
|
293
|
+
it "rejects YAML facts" do
|
294
|
+
request = a_request_that_contains(@facts, :yaml)
|
295
|
+
|
296
|
+
options = {
|
297
|
+
:environment => request.environment,
|
298
|
+
:transaction_uuid => request.options[:transaction_uuid],
|
299
|
+
}
|
300
|
+
|
301
|
+
expect {
|
302
|
+
@compiler.extract_facts_from_request(request)
|
303
|
+
}.to raise_error(ArgumentError, /Unsupported facts format/)
|
304
|
+
end
|
305
|
+
|
306
|
+
it "rejects unknown fact formats" do
|
307
|
+
request = a_request_that_contains(@facts)
|
308
|
+
request.options[:facts_format] = 'unknown-format'
|
309
|
+
|
310
|
+
options = {
|
311
|
+
:environment => request.environment,
|
312
|
+
:transaction_uuid => request.options[:transaction_uuid],
|
313
|
+
}
|
314
|
+
|
315
|
+
expect {
|
316
|
+
@compiler.extract_facts_from_request(request)
|
317
|
+
}.to raise_error(ArgumentError, /Unsupported facts format/)
|
318
|
+
end
|
319
|
+
|
292
320
|
end
|
293
321
|
|
294
322
|
describe "when finding nodes" do
|
@@ -3,23 +3,29 @@ require 'puppet/module_tool/tar'
|
|
3
3
|
|
4
4
|
describe Puppet::ModuleTool::Tar do
|
5
5
|
|
6
|
-
|
6
|
+
[
|
7
|
+
{ :name => 'ObscureLinuxDistro', :win => false },
|
8
|
+
{ :name => 'Windows', :win => true }
|
9
|
+
].each do |os|
|
10
|
+
it "always prefers minitar if it and zlib are present, even with tar available" do
|
11
|
+
Facter.stubs(:value).with('osfamily').returns os[:name]
|
12
|
+
Puppet::Util.stubs(:which).with('tar').returns '/usr/bin/tar'
|
13
|
+
Puppet::Util::Platform.stubs(:windows?).returns os[:win]
|
14
|
+
Puppet.stubs(:features).returns(stub(:minitar? => true, :zlib? => true))
|
15
|
+
|
16
|
+
expect(described_class.instance).to be_a_kind_of Puppet::ModuleTool::Tar::Mini
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it "falls back to tar when minitar not present and not on Windows" do
|
7
21
|
Facter.stubs(:value).with('osfamily').returns 'ObscureLinuxDistro'
|
8
22
|
Puppet::Util.stubs(:which).with('tar').returns '/usr/bin/tar'
|
9
23
|
Puppet::Util::Platform.stubs(:windows?).returns false
|
24
|
+
Puppet.stubs(:features).returns(stub(:minitar? => false))
|
10
25
|
|
11
26
|
expect(described_class.instance).to be_a_kind_of Puppet::ModuleTool::Tar::Gnu
|
12
27
|
end
|
13
28
|
|
14
|
-
it "falls back to minitar when it and zlib are present" do
|
15
|
-
Facter.stubs(:value).with('osfamily').returns 'Windows'
|
16
|
-
Puppet::Util.stubs(:which).with('tar')
|
17
|
-
Puppet::Util::Platform.stubs(:windows?).returns true
|
18
|
-
Puppet.stubs(:features).returns(stub(:minitar? => true, :zlib? => true))
|
19
|
-
|
20
|
-
expect(described_class.instance).to be_a_kind_of Puppet::ModuleTool::Tar::Mini
|
21
|
-
end
|
22
|
-
|
23
29
|
it "fails when there is no possible implementation" do
|
24
30
|
Facter.stubs(:value).with('osfamily').returns 'Windows'
|
25
31
|
Puppet::Util.stubs(:which).with('tar')
|
@@ -16,7 +16,7 @@ describe 'Puppet::Pops::Lookup::Interpolation' do
|
|
16
16
|
root_key = segments.shift
|
17
17
|
found = data[root_key]
|
18
18
|
found = sub_lookup(key, lookup_invocation, segments, found) unless segments.empty?
|
19
|
-
Lookup.expects(:lookup).with(key, nil, '', true, nil,
|
19
|
+
Lookup.expects(:lookup).with(key, nil, '', true, nil, is_a(Lookup::Invocation)).returns(found)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -330,4 +330,4 @@ describe 'Puppet::Pops::Lookup::Interpolation' do
|
|
330
330
|
end
|
331
331
|
end
|
332
332
|
end
|
333
|
-
end
|
333
|
+
end
|
@@ -13,6 +13,8 @@ module Serialization
|
|
13
13
|
let(:loader) { loaders.find_loader(nil) }
|
14
14
|
let(:reader_class) { packer_module::Reader }
|
15
15
|
let(:writer_class) { packer_module::Writer }
|
16
|
+
let(:serializer) { Serializer.new(writer_class.new(io)) }
|
17
|
+
let(:deserializer) { Deserializer.new(reader_class.new(io), loaders.find_loader(nil)) }
|
16
18
|
|
17
19
|
around :each do |example|
|
18
20
|
Puppet.override(:loaders => loaders, :current_environment => env) do
|
@@ -22,14 +24,12 @@ module Serialization
|
|
22
24
|
|
23
25
|
def write(*values)
|
24
26
|
io.reopen
|
25
|
-
serializer = Serializer.new(writer_class.new(io))
|
26
27
|
values.each { |val| serializer.write(val) }
|
27
28
|
serializer.finish
|
28
29
|
io.rewind
|
29
30
|
end
|
30
31
|
|
31
32
|
def read
|
32
|
-
deserializer = Deserializer.new(reader_class.new(io), loaders.find_loader(nil))
|
33
33
|
deserializer.read
|
34
34
|
end
|
35
35
|
|
@@ -159,8 +159,8 @@ module Serialization
|
|
159
159
|
context 'can write and read' do
|
160
160
|
include_context 'types_setup'
|
161
161
|
|
162
|
-
|
163
|
-
|
162
|
+
all_types.each do |t|
|
163
|
+
it "the default for type #{t.name}" do
|
164
164
|
val = t::DEFAULT
|
165
165
|
write(val)
|
166
166
|
val2 = read
|
@@ -285,6 +285,32 @@ module Serialization
|
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
288
|
+
context 'deserializing an instance whose Object type was serialized by reference' do
|
289
|
+
let(:serializer) { Serializer.new(writer_class.new(io), :type_by_reference => true) }
|
290
|
+
let(:type) do
|
291
|
+
Types::PObjectType.new({
|
292
|
+
'name' => 'MyType',
|
293
|
+
'attributes' => {
|
294
|
+
'x' => Types::PIntegerType::DEFAULT
|
295
|
+
}
|
296
|
+
})
|
297
|
+
end
|
298
|
+
|
299
|
+
it 'fails when deserializer is unaware of the referenced type' do
|
300
|
+
write(type.create(32))
|
301
|
+
|
302
|
+
# Should fail since no loader knows about 'MyType'
|
303
|
+
expect{ read }.to raise_error(Puppet::Error, 'No implementation mapping found for Puppet Type MyType')
|
304
|
+
end
|
305
|
+
|
306
|
+
it 'succeeds when deserializer is aware of the referenced type' do
|
307
|
+
obj = type.create(32)
|
308
|
+
write(obj)
|
309
|
+
loaders.find_loader(nil).expects(:load).with(:type, 'mytype').returns(type)
|
310
|
+
expect(read).to eql(obj)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
288
314
|
context 'When debugging' do
|
289
315
|
let(:debug_io) { StringIO.new }
|
290
316
|
let(:writer) { reader_class.new(io, { :debug_io => debug_io, :tabulate => false, :verbose => true }) }
|
@@ -275,24 +275,19 @@ describe 'Semantic Versions' do
|
|
275
275
|
[ '1.2.x', '1.2.2' ] => true,
|
276
276
|
[ '1.x', '1.2.2' ] => true,
|
277
277
|
|
278
|
-
[ '1.2.3',
|
279
|
-
[ '>=1.2.3',
|
280
|
-
[ '<=1.2.3',
|
281
|
-
[ '
|
282
|
-
[ '
|
283
|
-
[ '1.2.3
|
284
|
-
[ '1.2.3
|
278
|
+
[ '1.2.3-alpha', '1.2.3-alpha' ] => true,
|
279
|
+
[ '>=1.2.3-alpha', '1.2.3-alpha' ] => true,
|
280
|
+
[ '<=1.2.3-alpha', '1.2.3-alpha' ] => true,
|
281
|
+
[ '<=1.2.3-alpha', '1.2.3-a' ] => true,
|
282
|
+
[ '>1.2.3-alpha', '1.2.3-alpha' ] => false,
|
283
|
+
[ '>1.2.3-a', '1.2.3-alpha' ] => true,
|
284
|
+
[ '<1.2.3-alpha', '1.2.3-alpha' ] => false,
|
285
|
+
[ '<1.2.3-alpha', '1.2.3-a' ] => true,
|
286
|
+
[ '1.2.3-alpha - 1.2.4', '1.2.3-alpha' ] => true,
|
287
|
+
[ '1.2.3 - 1.2.4-alpha', '1.2.4-alpha' ] => true,
|
285
288
|
[ '1.2.3 - 1.2.4', '1.2.5-alpha' ] => false,
|
286
|
-
[ '~1.2.3', '1.2.3-alpha' ] => true,
|
287
|
-
[ '~1.2.3', '1.3.0-alpha' ] => false,
|
288
|
-
[ '~1.2', '1.2.3-alpha' ] => true,
|
289
|
-
[ '~1.2', '2.0.0-alpha' ] => false,
|
290
|
-
[ '~1', '1.2.3-alpha' ] => true,
|
291
|
-
[ '~1', '2.0.0-alpha' ] => false,
|
292
|
-
[ '1.2.x', '1.2.3-alpha' ] => true,
|
293
|
-
[ '1.2.x', '1.3.0-alpha' ] => false,
|
294
|
-
[ '1.x', '1.2.3-alpha' ] => true,
|
295
|
-
[ '1.x', '2.0.0-alpha' ] => false,
|
289
|
+
[ '~1.2.3-alhpa', '1.2.3-alpha' ] => true,
|
290
|
+
[ '~1.2.3-alpha', '1.3.0-alpha' ] => false,
|
296
291
|
|
297
292
|
[ '1.2.3', '1.2.3' ] => true,
|
298
293
|
[ '>=1.2.3', '1.2.3' ] => true,
|
@@ -293,10 +293,10 @@ module Puppet::Pops
|
|
293
293
|
ts = <<-OBJECT
|
294
294
|
pcore_version => '1.0.0',
|
295
295
|
version => '1.0.0',
|
296
|
-
references => { Ref => { name => 'Cars', version_range => '
|
296
|
+
references => { Ref => { name => 'Cars', version_range => 'N' } }
|
297
297
|
OBJECT
|
298
298
|
expect { parse_type_set('MySet', ts) }.to raise_error(ArgumentError,
|
299
|
-
/Unparsable version range: "
|
299
|
+
/Unparsable version range: "N"/)
|
300
300
|
end
|
301
301
|
|
302
302
|
it 'has an alias that is not a SimpleName' do
|
@@ -875,20 +875,20 @@ describe 'The string converter' do
|
|
875
875
|
end
|
876
876
|
|
877
877
|
context 'when converting regexp' do
|
878
|
-
it 'the default string representation is
|
879
|
-
expect(converter.convert(/.*/, :default)).to eq('
|
878
|
+
it 'the default string representation is "regexp"' do
|
879
|
+
expect(converter.convert(/.*/, :default)).to eq('.*')
|
880
880
|
end
|
881
881
|
|
882
|
-
{ "%s" => '
|
883
|
-
"%6s" => '
|
884
|
-
"%.
|
885
|
-
"%-6s" => '
|
882
|
+
{ "%s" => '.*',
|
883
|
+
"%6s" => ' .*',
|
884
|
+
"%.1s" => '.',
|
885
|
+
"%-6s" => '.* ',
|
886
886
|
"%p" => '/.*/',
|
887
887
|
"%6p" => ' /.*/',
|
888
888
|
"%-6p" => '/.*/ ',
|
889
889
|
"%.2p" => '/.',
|
890
|
-
"%#s" => '
|
891
|
-
"%#p" => '/.*/'
|
890
|
+
"%#s" => "'.*'",
|
891
|
+
"%#p" => '/.*/'
|
892
892
|
}.each do |fmt, result |
|
893
893
|
it "the format #{fmt} produces #{result}" do
|
894
894
|
string_formats = { Puppet::Pops::Types::PRegexpType::DEFAULT => fmt}
|
@@ -896,11 +896,23 @@ describe 'The string converter' do
|
|
896
896
|
end
|
897
897
|
end
|
898
898
|
|
899
|
+
context 'that contains flags' do
|
900
|
+
it 'the format %s produces \'(?m-ix:[a-z]\s*)\' for expression /[a-z]\s*/m' do
|
901
|
+
string_formats = { Puppet::Pops::Types::PRegexpType::DEFAULT => '%s'}
|
902
|
+
expect(converter.convert(/[a-z]\s*/m, string_formats)).to eq('(?m-ix:[a-z]\s*)')
|
903
|
+
end
|
904
|
+
|
905
|
+
it 'the format %p produces \'/(?m-ix:[a-z]\s*)/\' for expression /[a-z]\s*/m' do
|
906
|
+
string_formats = { Puppet::Pops::Types::PRegexpType::DEFAULT => '%p'}
|
907
|
+
expect(converter.convert(/[a-z]\s*/m, string_formats)).to eq('/(?m-ix:[a-z]\s*)/')
|
908
|
+
end
|
909
|
+
end
|
910
|
+
|
899
911
|
it 'errors when format is not recognized' do
|
900
912
|
expect do
|
901
913
|
string_formats = { Puppet::Pops::Types::PRegexpType::DEFAULT => "%k"}
|
902
914
|
converter.convert(/.*/, string_formats)
|
903
|
-
end.to raise_error(/Illegal format 'k' specified for value of Regexp type - expected one of the characters '
|
915
|
+
end.to raise_error(/Illegal format 'k' specified for value of Regexp type - expected one of the characters 'sp'/)
|
904
916
|
end
|
905
917
|
end
|
906
918
|
|
@@ -234,8 +234,8 @@ describe 'The type calculator' do
|
|
234
234
|
t = calculator.infer_set(v)
|
235
235
|
expect(t.class).to eq(PSemVerType)
|
236
236
|
expect(t.ranges.size).to eq(1)
|
237
|
-
expect(t.ranges[0].
|
238
|
-
expect(t.ranges[0].
|
237
|
+
expect(t.ranges[0].begin).to eq(v)
|
238
|
+
expect(t.ranges[0].end).to eq(v)
|
239
239
|
end
|
240
240
|
end
|
241
241
|
|
@@ -558,6 +558,12 @@ describe 'Puppet Type System' do
|
|
558
558
|
expect(func_class).to be_a(Class)
|
559
559
|
expect(func_class.superclass).to be(Puppet::Functions::Function)
|
560
560
|
end
|
561
|
+
|
562
|
+
it 'Regexp' do
|
563
|
+
func_class = tf.regexp.new_function(loader)
|
564
|
+
expect(func_class).to be_a(Class)
|
565
|
+
expect(func_class.superclass).to be(Puppet::Functions::Function)
|
566
|
+
end
|
561
567
|
end
|
562
568
|
|
563
569
|
context 'instantiation via new_function is not supported by' do
|
@@ -583,6 +589,11 @@ describe 'Puppet Type System' do
|
|
583
589
|
expect(int).to eq(32)
|
584
590
|
end
|
585
591
|
|
592
|
+
it 'is supported by Regexp' do
|
593
|
+
rx = tf.regexp.create('[a-z]+')
|
594
|
+
expect(rx).to eq(/[a-z]+/)
|
595
|
+
end
|
596
|
+
|
586
597
|
it 'is supported by Optional[Integer]' do
|
587
598
|
int = tf.optional(tf.integer).create('32')
|
588
599
|
expect(int).to eq(32)
|
@@ -848,32 +848,31 @@ describe Puppet::Resource::Catalog, "when converting a resource catalog to pson"
|
|
848
848
|
context 'when dealing with parameters that have non-Data values' do
|
849
849
|
context 'and rich_data is enabled' do
|
850
850
|
before(:each) do
|
851
|
+
Puppet.push_context(:loaders => Puppet::Pops::Loaders.new(Puppet.lookup(:environments).get(Puppet[:environment])))
|
851
852
|
Puppet[:rich_data] = true
|
852
853
|
end
|
853
854
|
|
854
855
|
after(:each) do
|
855
856
|
Puppet[:rich_data] = false
|
857
|
+
Puppet.pop_context
|
856
858
|
end
|
857
859
|
|
858
860
|
|
859
861
|
let(:catalog_w_regexp) { compile_to_catalog("notify {'foo': message => /[a-z]+/ }") }
|
860
862
|
|
861
|
-
it 'should generate
|
862
|
-
|
863
|
+
it 'should generate rich value hash for parameter values that are not Data' do
|
864
|
+
s = catalog_w_regexp.to_json
|
865
|
+
expect(s).to include('"parameters":{"message":{"__pcore_type__":"Regexp","value":"[a-z]+"}}')
|
863
866
|
end
|
864
867
|
|
865
|
-
it 'should
|
866
|
-
expect(catalog_w_regexp.to_json).to validate_against('api/schemas/catalog.json')
|
867
|
-
end
|
868
|
-
|
869
|
-
it 'should read and convert ext_parameters containing Regexp from json' do
|
868
|
+
it 'should read and convert rich value hash containing Regexp from json' do
|
870
869
|
catalog2 = Puppet::Resource::Catalog.from_data_hash(JSON.parse(catalog_w_regexp.to_json))
|
871
870
|
message = catalog2.resource('notify', 'foo')['message']
|
872
871
|
expect(message).to be_a(Regexp)
|
873
872
|
expect(message).to eql(/[a-z]+/)
|
874
873
|
end
|
875
874
|
|
876
|
-
it 'should read and convert
|
875
|
+
it 'should read and convert rich value hash containing Version from json' do
|
877
876
|
catalog = compile_to_catalog("notify {'foo': message => SemVer('1.0.0') }")
|
878
877
|
catalog2 = Puppet::Resource::Catalog.from_data_hash(JSON.parse(catalog.to_json))
|
879
878
|
message = catalog2.resource('notify', 'foo')['message']
|
@@ -881,7 +880,7 @@ describe Puppet::Resource::Catalog, "when converting a resource catalog to pson"
|
|
881
880
|
expect(message).to eql(SemanticPuppet::Version.parse('1.0.0'))
|
882
881
|
end
|
883
882
|
|
884
|
-
it 'should read and convert
|
883
|
+
it 'should read and convert rich value hash containing VersionRange from json' do
|
885
884
|
catalog = compile_to_catalog("notify {'foo': message => SemVerRange('>=1.0.0') }")
|
886
885
|
catalog2 = Puppet::Resource::Catalog.from_data_hash(JSON.parse(catalog.to_json))
|
887
886
|
message = catalog2.resource('notify', 'foo')['message']
|
@@ -889,7 +888,7 @@ describe Puppet::Resource::Catalog, "when converting a resource catalog to pson"
|
|
889
888
|
expect(message).to eql(SemanticPuppet::VersionRange.parse('>=1.0.0'))
|
890
889
|
end
|
891
890
|
|
892
|
-
it 'should read and convert
|
891
|
+
it 'should read and convert rich value hash containing Timespan from json' do
|
893
892
|
catalog = compile_to_catalog("notify {'foo': message => Timespan(1234) }")
|
894
893
|
catalog2 = Puppet::Resource::Catalog.from_data_hash(JSON.parse(catalog.to_json))
|
895
894
|
message = catalog2.resource('notify', 'foo')['message']
|
@@ -897,7 +896,7 @@ describe Puppet::Resource::Catalog, "when converting a resource catalog to pson"
|
|
897
896
|
expect(message).to eql(Puppet::Pops::Time::Timespan.parse('1234', '%S'))
|
898
897
|
end
|
899
898
|
|
900
|
-
it 'should read and convert
|
899
|
+
it 'should read and convert rich value hash containing Timestamp from json' do
|
901
900
|
catalog = compile_to_catalog("notify {'foo': message => Timestamp('2016-09-15T08:32:16.123 UTC') }")
|
902
901
|
catalog2 = Puppet::Resource::Catalog.from_data_hash(JSON.parse(catalog.to_json))
|
903
902
|
message = catalog2.resource('notify', 'foo')['message']
|
@@ -905,7 +904,7 @@ describe Puppet::Resource::Catalog, "when converting a resource catalog to pson"
|
|
905
904
|
expect(message).to eql(Puppet::Pops::Time::Timestamp.parse('2016-09-15T08:32:16.123 UTC'))
|
906
905
|
end
|
907
906
|
|
908
|
-
it 'should read and convert
|
907
|
+
it 'should read and convert rich value hash containing hash with rich data from json' do
|
909
908
|
catalog = compile_to_catalog("notify {'foo': message => { 'version' => SemVer('1.0.0'), 'time' => Timestamp('2016-09-15T08:32:16.123 UTC') }}")
|
910
909
|
catalog2 = Puppet::Resource::Catalog.from_data_hash(JSON.parse(catalog.to_json))
|
911
910
|
message = catalog2.resource('notify', 'foo')['message']
|
@@ -914,7 +913,7 @@ describe Puppet::Resource::Catalog, "when converting a resource catalog to pson"
|
|
914
913
|
expect(message['time']).to eql(Puppet::Pops::Time::Timestamp.parse('2016-09-15T08:32:16.123 UTC'))
|
915
914
|
end
|
916
915
|
|
917
|
-
it 'should read and convert
|
916
|
+
it 'should read and convert rich value hash containing an array with rich data from json' do
|
918
917
|
catalog = compile_to_catalog("notify {'foo': message => [ SemVer('1.0.0'), Timestamp('2016-09-15T08:32:16.123 UTC') ] }")
|
919
918
|
catalog2 = Puppet::Resource::Catalog.from_data_hash(JSON.parse(catalog.to_json))
|
920
919
|
message = catalog2.resource('notify', 'foo')['message']
|
@@ -931,8 +930,8 @@ describe Puppet::Resource::Catalog, "when converting a resource catalog to pson"
|
|
931
930
|
|
932
931
|
let(:catalog_w_regexp) { compile_to_catalog("notify {'foo': message => /[a-z]+/ }") }
|
933
932
|
|
934
|
-
it 'should not generate
|
935
|
-
expect(catalog_w_regexp.to_json).not_to include('"
|
933
|
+
it 'should not generate rich value hash for parameter values that are not Data' do
|
934
|
+
expect(catalog_w_regexp.to_json).not_to include('"__pcore_type__"')
|
936
935
|
end
|
937
936
|
|
938
937
|
it 'should convert parameter containing Regexp into strings' do
|
metadata
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.10.
|
4
|
+
version: 4.10.1
|
5
|
+
prerelease:
|
5
6
|
platform: universal-darwin
|
6
7
|
authors:
|
7
8
|
- Puppet Labs
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2017-
|
12
|
+
date: 2017-05-01 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: facter
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>'
|
19
|
+
- - ! '>'
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '2.0'
|
20
22
|
- - <
|
@@ -23,8 +25,9 @@ dependencies:
|
|
23
25
|
type: :runtime
|
24
26
|
prerelease: false
|
25
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
26
29
|
requirements:
|
27
|
-
- - '>'
|
30
|
+
- - ! '>'
|
28
31
|
- !ruby/object:Gem::Version
|
29
32
|
version: '2.0'
|
30
33
|
- - <
|
@@ -33,8 +36,9 @@ dependencies:
|
|
33
36
|
- !ruby/object:Gem::Dependency
|
34
37
|
name: hiera
|
35
38
|
requirement: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
36
40
|
requirements:
|
37
|
-
- - '>='
|
41
|
+
- - ! '>='
|
38
42
|
- !ruby/object:Gem::Version
|
39
43
|
version: '2.0'
|
40
44
|
- - <
|
@@ -43,8 +47,9 @@ dependencies:
|
|
43
47
|
type: :runtime
|
44
48
|
prerelease: false
|
45
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
46
51
|
requirements:
|
47
|
-
- - '>='
|
52
|
+
- - ! '>='
|
48
53
|
- !ruby/object:Gem::Version
|
49
54
|
version: '2.0'
|
50
55
|
- - <
|
@@ -53,6 +58,7 @@ dependencies:
|
|
53
58
|
- !ruby/object:Gem::Dependency
|
54
59
|
name: json_pure
|
55
60
|
requirement: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
56
62
|
requirements:
|
57
63
|
- - ~>
|
58
64
|
- !ruby/object:Gem::Version
|
@@ -60,6 +66,7 @@ dependencies:
|
|
60
66
|
type: :runtime
|
61
67
|
prerelease: false
|
62
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
63
70
|
requirements:
|
64
71
|
- - ~>
|
65
72
|
- !ruby/object:Gem::Version
|
@@ -67,8 +74,9 @@ dependencies:
|
|
67
74
|
- !ruby/object:Gem::Dependency
|
68
75
|
name: gettext-setup
|
69
76
|
requirement: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
70
78
|
requirements:
|
71
|
-
- - '>='
|
79
|
+
- - ! '>='
|
72
80
|
- !ruby/object:Gem::Version
|
73
81
|
version: '0.10'
|
74
82
|
- - <
|
@@ -77,8 +85,9 @@ dependencies:
|
|
77
85
|
type: :runtime
|
78
86
|
prerelease: false
|
79
87
|
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
80
89
|
requirements:
|
81
|
-
- - '>='
|
90
|
+
- - ! '>='
|
82
91
|
- !ruby/object:Gem::Version
|
83
92
|
version: '0.10'
|
84
93
|
- - <
|
@@ -87,6 +96,7 @@ dependencies:
|
|
87
96
|
- !ruby/object:Gem::Dependency
|
88
97
|
name: locale
|
89
98
|
requirement: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
90
100
|
requirements:
|
91
101
|
- - ~>
|
92
102
|
- !ruby/object:Gem::Version
|
@@ -94,6 +104,7 @@ dependencies:
|
|
94
104
|
type: :runtime
|
95
105
|
prerelease: false
|
96
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
97
108
|
requirements:
|
98
109
|
- - ~>
|
99
110
|
- !ruby/object:Gem::Version
|
@@ -101,6 +112,7 @@ dependencies:
|
|
101
112
|
- !ruby/object:Gem::Dependency
|
102
113
|
name: CFPropertyList
|
103
114
|
requirement: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
104
116
|
requirements:
|
105
117
|
- - ~>
|
106
118
|
- !ruby/object:Gem::Version
|
@@ -108,6 +120,7 @@ dependencies:
|
|
108
120
|
type: :runtime
|
109
121
|
prerelease: false
|
110
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
111
124
|
requirements:
|
112
125
|
- - ~>
|
113
126
|
- !ruby/object:Gem::Version
|
@@ -2838,7 +2851,6 @@ files:
|
|
2838
2851
|
- locales/puppet.pot
|
2839
2852
|
homepage: https://github.com/puppetlabs/puppet
|
2840
2853
|
licenses: []
|
2841
|
-
metadata: {}
|
2842
2854
|
post_install_message:
|
2843
2855
|
rdoc_options:
|
2844
2856
|
- --title
|
@@ -2849,20 +2861,22 @@ rdoc_options:
|
|
2849
2861
|
require_paths:
|
2850
2862
|
- lib
|
2851
2863
|
required_ruby_version: !ruby/object:Gem::Requirement
|
2864
|
+
none: false
|
2852
2865
|
requirements:
|
2853
|
-
- - '>='
|
2866
|
+
- - ! '>='
|
2854
2867
|
- !ruby/object:Gem::Version
|
2855
2868
|
version: 1.9.3
|
2856
2869
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2870
|
+
none: false
|
2857
2871
|
requirements:
|
2858
|
-
- - '>'
|
2872
|
+
- - ! '>'
|
2859
2873
|
- !ruby/object:Gem::Version
|
2860
2874
|
version: 1.3.1
|
2861
2875
|
requirements: []
|
2862
2876
|
rubyforge_project: puppet
|
2863
|
-
rubygems_version:
|
2877
|
+
rubygems_version: 1.8.23
|
2864
2878
|
signing_key:
|
2865
|
-
specification_version:
|
2879
|
+
specification_version: 3
|
2866
2880
|
summary: Puppet, an automated configuration management tool
|
2867
2881
|
test_files:
|
2868
2882
|
- spec/fixtures/faulty_face/puppet/face/syntax.rb
|