puppet 4.10.9-universal-darwin → 4.10.10-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.

Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/lib/puppet/agent.rb +22 -2
  3. data/lib/puppet/application.rb +18 -1
  4. data/lib/puppet/application/agent.rb +9 -2
  5. data/lib/puppet/application/apply.rb +1 -1
  6. data/lib/puppet/application/config.rb +1 -0
  7. data/lib/puppet/application/device.rb +1 -2
  8. data/lib/puppet/application/filebucket.rb +22 -5
  9. data/lib/puppet/application/help.rb +1 -0
  10. data/lib/puppet/application/inspect.rb +2 -0
  11. data/lib/puppet/application/lookup.rb +1 -3
  12. data/lib/puppet/application_support.rb +6 -1
  13. data/lib/puppet/defaults.rb +33 -4
  14. data/lib/puppet/face/config.rb +13 -0
  15. data/lib/puppet/functions/each.rb +10 -4
  16. data/lib/puppet/functions/lookup.rb +2 -2
  17. data/lib/puppet/functions/map.rb +12 -2
  18. data/lib/puppet/functions/reduce.rb +45 -2
  19. data/lib/puppet/interface.rb +1 -0
  20. data/lib/puppet/module_tool/tar/mini.rb +57 -4
  21. data/lib/puppet/network/http/factory.rb +9 -0
  22. data/lib/puppet/network/http/webrick.rb +1 -3
  23. data/lib/puppet/node.rb +10 -0
  24. data/lib/puppet/node/facts.rb +9 -0
  25. data/lib/puppet/parser/functions/sprintf.rb +17 -3
  26. data/lib/puppet/pops/loader/static_loader.rb +2 -2
  27. data/lib/puppet/pops/lookup/hiera_config.rb +2 -2
  28. data/lib/puppet/pops/merge_strategy.rb +16 -1
  29. data/lib/puppet/pops/types/iterable.rb +2 -0
  30. data/lib/puppet/pops/types/type_factory.rb +1 -1
  31. data/lib/puppet/pops/types/type_mismatch_describer.rb +15 -5
  32. data/lib/puppet/pops/types/types.rb +4 -2
  33. data/lib/puppet/provider/service/smf.rb +2 -2
  34. data/lib/puppet/provider/service/systemd.rb +1 -0
  35. data/lib/puppet/provider/service/upstart.rb +1 -1
  36. data/lib/puppet/settings/environment_conf.rb +10 -2
  37. data/lib/puppet/transaction.rb +3 -0
  38. data/lib/puppet/transaction/report.rb +8 -1
  39. data/lib/puppet/type.rb +1 -9
  40. data/lib/puppet/type/user.rb +9 -3
  41. data/lib/puppet/util/http_proxy.rb +14 -6
  42. data/lib/puppet/version.rb +1 -1
  43. data/locales/puppet.pot +29 -13
  44. data/man/man5/puppet.conf.5 +276 -55
  45. data/man/man8/extlookup2hiera.8 +2 -2
  46. data/man/man8/puppet-agent.8 +32 -10
  47. data/man/man8/puppet-apply.8 +21 -6
  48. data/man/man8/puppet-ca.8 +48 -34
  49. data/man/man8/puppet-catalog.8 +4 -4
  50. data/man/man8/puppet-cert.8 +23 -6
  51. data/man/man8/puppet-certificate.8 +44 -28
  52. data/man/man8/puppet-certificate_request.8 +4 -4
  53. data/man/man8/puppet-certificate_revocation_list.8 +4 -4
  54. data/man/man8/puppet-config.8 +5 -5
  55. data/man/man8/puppet-describe.8 +3 -3
  56. data/man/man8/puppet-device.8 +23 -13
  57. data/man/man8/puppet-doc.8 +5 -5
  58. data/man/man8/puppet-epp.8 +16 -10
  59. data/man/man8/puppet-facts.8 +4 -4
  60. data/man/man8/puppet-file.8 +4 -4
  61. data/man/man8/puppet-filebucket.8 +63 -6
  62. data/man/man8/puppet-generate.8 +84 -0
  63. data/man/man8/puppet-help.8 +4 -4
  64. data/man/man8/puppet-inspect.8 +8 -5
  65. data/man/man8/puppet-key.8 +4 -4
  66. data/man/man8/puppet-lookup.8 +87 -0
  67. data/man/man8/puppet-man.8 +5 -5
  68. data/man/man8/puppet-master.8 +5 -5
  69. data/man/man8/puppet-module.8 +22 -13
  70. data/man/man8/puppet-node.8 +4 -4
  71. data/man/man8/puppet-parser.8 +4 -4
  72. data/man/man8/puppet-plugin.8 +4 -4
  73. data/man/man8/puppet-report.8 +4 -4
  74. data/man/man8/puppet-resource.8 +4 -8
  75. data/man/man8/puppet-resource_type.8 +4 -4
  76. data/man/man8/puppet-status.8 +5 -5
  77. data/man/man8/puppet.8 +12 -3
  78. data/spec/fixtures/unit/application/environments/production/data/common.yaml +2 -0
  79. data/spec/integration/agent/logging_spec.rb +2 -0
  80. data/spec/integration/provider/cron/crontab_spec.rb +1 -0
  81. data/spec/unit/agent_spec.rb +33 -0
  82. data/spec/unit/application/config_spec.rb +4 -0
  83. data/spec/unit/application/inspect_spec.rb +11 -0
  84. data/spec/unit/application/lookup_spec.rb +30 -0
  85. data/spec/unit/application_spec.rb +18 -0
  86. data/spec/unit/environments_spec.rb +15 -0
  87. data/spec/unit/face/config_spec.rb +1 -2
  88. data/spec/unit/functions/break_spec.rb +108 -49
  89. data/spec/unit/functions/defined_spec.rb +2 -2
  90. data/spec/unit/functions/lookup_spec.rb +88 -3
  91. data/spec/unit/interface_spec.rb +12 -0
  92. data/spec/unit/module_tool/tar/mini_spec.rb +34 -5
  93. data/spec/unit/network/http/factory_spec.rb +22 -0
  94. data/spec/unit/network/http/webrick_spec.rb +30 -29
  95. data/spec/unit/parser/functions/sprintf_spec.rb +26 -0
  96. data/spec/unit/pops/loaders/static_loader_spec.rb +1 -1
  97. data/spec/unit/pops/types/type_calculator_spec.rb +21 -0
  98. data/spec/unit/pops/types/type_mismatch_describer_spec.rb +9 -0
  99. data/spec/unit/provider/service/smf_spec.rb +2 -4
  100. data/spec/unit/provider/service/systemd_spec.rb +14 -0
  101. data/spec/unit/resource/catalog_spec.rb +10 -0
  102. data/spec/unit/transaction/report_spec.rb +19 -0
  103. data/spec/unit/util/http_proxy_spec.rb +37 -0
  104. metadata +4 -2
@@ -268,11 +268,11 @@ describe "the 'defined' function" do
268
268
  end
269
269
 
270
270
  it 'raises error if referencing undef' do
271
- expect{func.call(@scope, nil)}.to raise_error(ArgumentError, /'defined' parameter 'vals' expects a value of type String or Type, got Undef/)
271
+ expect{func.call(@scope, nil)}.to raise_error(ArgumentError, /'defined' parameter 'vals' expects a value of type String, Type\[CatalogEntry\], or Type\[Type\], got Undef/)
272
272
  end
273
273
 
274
274
  it 'raises error if referencing a number' do
275
- expect{func.call(@scope, 42)}.to raise_error(ArgumentError, /'defined' parameter 'vals' expects a value of type String or Type, got Integer/)
275
+ expect{func.call(@scope, 42)}.to raise_error(ArgumentError, /'defined' parameter 'vals' expects a value of type String, Type\[CatalogEntry\], or Type\[Type\], got Integer/)
276
276
  end
277
277
 
278
278
  it 'is false if referencing empty string' do
@@ -842,6 +842,24 @@ describe "The lookup function" do
842
842
  end
843
843
  end
844
844
  end
845
+
846
+ context 'that contains an array with duplicates' do
847
+ let(:common_yaml) { <<-YAML.unindent }
848
+ a:
849
+ - alpha
850
+ - bravo
851
+ - charlie
852
+ - bravo
853
+ YAML
854
+
855
+ it 'retains the duplicates when using default merge strategy' do
856
+ expect(lookup('a')).to eql(%w(alpha bravo charlie bravo))
857
+ end
858
+
859
+ it 'does deduplification when using merge strategy "unique"' do
860
+ expect(lookup('a', :merge => 'unique')).to eql(%w(alpha bravo charlie))
861
+ end
862
+ end
845
863
  end
846
864
 
847
865
  context 'with lookup_options configured using patterns' do
@@ -1084,14 +1102,81 @@ describe "The lookup function" do
1084
1102
  glob_c: value glob_a
1085
1103
  YAML
1086
1104
  'b.yaml' => <<-YAML.unindent
1087
- glob_b:
1088
- c: value glob_b.c
1089
- d: value glob_b.d
1105
+ glob_d:
1106
+ a: value glob_d.a
1107
+ b: value glob_d.b
1090
1108
  YAML
1091
1109
 
1092
1110
  }
1093
1111
  }
1094
1112
  end
1113
+
1114
+ it 'finds environment data using globs' do
1115
+ expect(lookup('glob_a')).to eql('value glob_a')
1116
+ expect(warnings).to be_empty
1117
+ end
1118
+
1119
+ it 'finds environment data using interpolated globs' do
1120
+ expect(lookup('glob_d.a')).to eql('value glob_d.a')
1121
+ expect(warnings).to be_empty
1122
+ end
1123
+ end
1124
+
1125
+ context 'and an environment Hiera v5 configuration using uris' do
1126
+ let(:env_hiera_yaml) do
1127
+ <<-YAML.unindent
1128
+ ---
1129
+ version: 5
1130
+ hierarchy:
1131
+ - name: Uris
1132
+ uris:
1133
+ - "http://test.example.com"
1134
+ - "/some/arbitrary/path"
1135
+ - "urn:with:opaque:path"
1136
+ - "dothis%20-f%20bar"
1137
+ data_hash: mod::uri_test_func
1138
+ YAML
1139
+ end
1140
+
1141
+ let(:env_modules) do
1142
+ {
1143
+ 'mod' => { 'lib' => { 'puppet' => { 'functions' => { 'mod' => { 'uri_test_func.rb' => <<-RUBY } } } } }
1144
+ Puppet::Functions.create_function(:'mod::uri_test_func') do
1145
+ dispatch :uri_test_func do
1146
+ param 'Hash', :options
1147
+ param 'Puppet::LookupContext', :context
1148
+ end
1149
+
1150
+ def uri_test_func(options, context)
1151
+ { 'uri' => [ options['uri'] ] }
1152
+ end
1153
+ end
1154
+ RUBY
1155
+ }
1156
+ end
1157
+
1158
+ it 'The uris are propagated in the options hash' do
1159
+ expect(lookup('uri', 'merge' => 'unique')).to eql(
1160
+ %w(http://test.example.com /some/arbitrary/path urn:with:opaque:path dothis%20-f%20bar))
1161
+ expect(warnings).to be_empty
1162
+ end
1163
+
1164
+ context 'and a uri uses bad syntax' do
1165
+ let(:env_hiera_yaml) do
1166
+ <<-YAML.unindent
1167
+ ---
1168
+ version: 5
1169
+ hierarchy:
1170
+ - name: Uris
1171
+ uri: "dothis -f bar"
1172
+ data_hash: mod::uri_test_func
1173
+ YAML
1174
+ end
1175
+
1176
+ it 'an attempt to lookup raises InvalidURIError' do
1177
+ expect{ lookup('uri', 'merge' => 'unique') }.to raise_error(/bad URI/)
1178
+ end
1179
+ end
1095
1180
  end
1096
1181
 
1097
1182
  context 'and an environment Hiera v5 configuration using mapped_paths' do
@@ -126,6 +126,18 @@ describe Puppet::Interface do
126
126
  expect { subject[:foo, '0.0.1'] }.to raise_error Puppet::Error
127
127
  end
128
128
 
129
+ describe 'when raising NoMethodErrors' do
130
+ subject { described_class.new(:foo, '1.0.0') }
131
+
132
+ it 'includes the face name in the error message' do
133
+ expect { subject.boombaz }.to raise_error(NoMethodError, /#{subject.name}/)
134
+ end
135
+
136
+ it 'includes the face version in the error message' do
137
+ expect { subject.boombaz }.to raise_error(NoMethodError, /#{subject.version}/)
138
+ end
139
+ end
140
+
129
141
  it_should_behave_like "things that declare options" do
130
142
  def add_options_to(&block)
131
143
  subject.new(:with_options, '0.0.1', &block)
@@ -8,10 +8,17 @@ describe Puppet::ModuleTool::Tar::Mini, :if => (Puppet.features.minitar? and Pup
8
8
  let(:destfile) { '/the/dest/file.tar.gz' }
9
9
  let(:minitar) { described_class.new }
10
10
 
11
- it "unpacks a tar file" do
12
- unpacks_the_entry(:file_start, 'thefile')
11
+ class MockFileStatEntry
12
+ def initialize(mode = 0100)
13
+ @mode = mode
14
+ end
15
+ end
16
+
17
+ it "unpacks a tar file with correct permissions" do
18
+ entry = unpacks_the_entry(:file_start, 'thefile')
13
19
 
14
20
  minitar.unpack(sourcefile, destdir, 'uid')
21
+ expect(entry.instance_variable_get(:@mode)).to eq(0755)
15
22
  end
16
23
 
17
24
  it "does not allow an absolute path" do
@@ -41,20 +48,42 @@ describe Puppet::ModuleTool::Tar::Mini, :if => (Puppet.features.minitar? and Pup
41
48
  "Attempt to install file with an invalid path into \"#{File.expand_path('/the/thedir')}\" under \"#{destdir}\"")
42
49
  end
43
50
 
51
+ it "unpacks on Windows" do
52
+ unpacks_the_entry(:file_start, 'thefile', nil)
53
+
54
+ entry = minitar.unpack(sourcefile, destdir, 'uid')
55
+ # Windows does not use these permissions.
56
+ expect(entry.instance_variable_get(:@mode)).to eq(nil)
57
+ end
58
+
44
59
  it "packs a tar file" do
45
60
  writer = stub('GzipWriter')
46
61
 
47
62
  Zlib::GzipWriter.expects(:open).with(destfile).yields(writer)
48
- Archive::Tar::Minitar.expects(:pack).with(sourcedir, writer)
63
+ stats = {:mode => 0222}
64
+ Archive::Tar::Minitar.expects(:pack).with(sourcedir, writer).yields(:file_start, 'abc', stats)
65
+
66
+ minitar.pack(sourcedir, destfile)
67
+ end
68
+
69
+ it "packs a tar file on Windows" do
70
+ writer = stub('GzipWriter')
71
+
72
+ Zlib::GzipWriter.expects(:open).with(destfile).yields(writer)
73
+ Archive::Tar::Minitar.expects(:pack).with(sourcedir, writer).
74
+ yields(:file_start, 'abc', {:entry => MockFileStatEntry.new(nil)})
49
75
 
50
76
  minitar.pack(sourcedir, destfile)
51
77
  end
52
78
 
53
- def unpacks_the_entry(type, name)
79
+ def unpacks_the_entry(type, name, mode = 0100)
54
80
  reader = stub('GzipReader')
55
81
 
56
82
  Zlib::GzipReader.expects(:open).with(sourcefile).yields(reader)
57
83
  minitar.expects(:find_valid_files).with(reader).returns([name])
58
- Archive::Tar::Minitar.expects(:unpack).with(reader, destdir, [name]).yields(type, name, nil)
84
+ entry = MockFileStatEntry.new(mode)
85
+ Archive::Tar::Minitar.expects(:unpack).with(reader, destdir, [name]).
86
+ yields(type, name, {:entry => entry})
87
+ entry
59
88
  end
60
89
  end
@@ -94,5 +94,27 @@ describe Puppet::Network::HTTP::Factory do
94
94
  expect(conn.read_timeout).to eq(120)
95
95
  end
96
96
  end
97
+
98
+ context 'source address' do
99
+ it 'defaults to system-defined' do
100
+ skip "Requires Ruby >= 2.0" unless RUBY_VERSION.to_i >= 2
101
+ conn = create_connection(site)
102
+
103
+ expect(conn.local_host).to be(nil)
104
+ end
105
+
106
+ it 'sets the local_host address' do
107
+ Puppet[:sourceaddress] = "127.0.0.1"
108
+ if RUBY_VERSION.to_i >= 2
109
+ conn = create_connection(site)
110
+
111
+ expect(conn.local_host).to eq('127.0.0.1')
112
+ else
113
+ expect {
114
+ create_connection(site)
115
+ }.to raise_error(ArgumentError, "Setting 'sourceaddress' is unsupported by this version of Net::HTTP.")
116
+ end
117
+ end
118
+ end
97
119
  end
98
120
  end
@@ -14,31 +14,37 @@ describe Puppet::Network::HTTP::WEBrick do
14
14
 
15
15
  let(:address) { '127.0.0.1' }
16
16
  let(:port) { 31337 }
17
-
18
- let(:server) do
19
- s = Puppet::Network::HTTP::WEBrick.new
20
- s.stubs(:setup_logger).returns(Hash.new)
21
- s.stubs(:setup_ssl).returns(Hash.new)
22
- s
23
- end
17
+ let(:server) { Puppet::Network::HTTP::WEBrick.new }
18
+ let(:localcacert) { make_absolute("/ca/crt") }
19
+ let(:ssl_server_ca_auth) { make_absolute("/ca/ssl_server_auth_file") }
20
+ let(:key) { stub 'key', :content => "mykey" }
21
+ let(:cert) { stub 'cert', :content => "mycert" }
22
+ let(:host) { stub 'host', :key => key, :certificate => cert, :name => "yay", :ssl_store => "mystore" }
24
23
 
25
24
  let(:mock_ssl_context) do
26
25
  stub('ssl_context', :ciphers= => nil)
27
26
  end
28
27
 
28
+ let(:socket) { mock('socket') }
29
29
  let(:mock_webrick) do
30
- stub('webrick',
31
- :[] => {},
32
- :listeners => [],
33
- :status => :Running,
34
- :mount => nil,
35
- :start => nil,
36
- :shutdown => nil,
37
- :ssl_context => mock_ssl_context)
30
+ server = stub('webrick',
31
+ :[] => {},
32
+ :listeners => [],
33
+ :status => :Running,
34
+ :mount => nil,
35
+ :shutdown => nil,
36
+ :ssl_context => mock_ssl_context)
37
+ server.stubs(:start).yields(socket)
38
+ IO.stubs(:select).with([socket], nil, nil, anything).returns(true)
39
+ socket.stubs(:accept)
40
+ server.stubs(:run).with(socket)
41
+ server
38
42
  end
39
43
 
40
44
  before :each do
41
45
  WEBrick::HTTPServer.stubs(:new).returns(mock_webrick)
46
+ Puppet::SSL::Certificate.indirection.stubs(:find).with('ca').returns cert
47
+ Puppet::SSL::Host.stubs(:localhost).returns host
42
48
  end
43
49
 
44
50
  describe "when turning on listening" do
@@ -88,6 +94,13 @@ describe Puppet::Network::HTTP::WEBrick do
88
94
  expect(server).to be_listening
89
95
  end
90
96
 
97
+ it "is passed a yet to be accepted socket" do
98
+ socket.expects(:accept)
99
+
100
+ server.listen(address, port)
101
+ server.unlisten
102
+ end
103
+
91
104
  describe "when the REST protocol is requested" do
92
105
  it "should register the REST handler at /" do
93
106
  # We don't care about the options here.
@@ -192,18 +205,6 @@ describe Puppet::Network::HTTP::WEBrick do
192
205
  end
193
206
 
194
207
  describe "when configuring ssl" do
195
- let(:server) { Puppet::Network::HTTP::WEBrick.new }
196
- let(:localcacert) { make_absolute("/ca/crt") }
197
- let(:ssl_server_ca_auth) { make_absolute("/ca/ssl_server_auth_file") }
198
- let(:key) { stub 'key', :content => "mykey" }
199
- let(:cert) { stub 'cert', :content => "mycert" }
200
- let(:host) { stub 'host', :key => key, :certificate => cert, :name => "yay", :ssl_store => "mystore" }
201
-
202
- before :each do
203
- Puppet::SSL::Certificate.indirection.stubs(:find).with('ca').returns cert
204
- Puppet::SSL::Host.stubs(:localhost).returns host
205
- end
206
-
207
208
  it "should use the key from the localhost SSL::Host instance" do
208
209
  Puppet::SSL::Host.expects(:localhost).returns host
209
210
  host.expects(:key).returns key
@@ -236,8 +237,8 @@ describe Puppet::Network::HTTP::WEBrick do
236
237
  expect(server.setup_ssl[:SSLCACertificateFile]).to eq(ssl_server_ca_auth)
237
238
  end
238
239
 
239
- it "should start ssl immediately" do
240
- expect(server.setup_ssl[:SSLStartImmediately]).to be_truthy
240
+ it "should not start ssl immediately" do
241
+ expect(server.setup_ssl[:SSLStartImmediately]).to eq(false)
241
242
  end
242
243
 
243
244
  it "should enable ssl" do
@@ -44,4 +44,30 @@ describe "the sprintf function" do
44
44
  expect(result).to(eql("<overlong: 027 0XBEEF (foo )>"))
45
45
  end
46
46
 
47
+ it 'does not attempt to mutate its arguments' do
48
+ args = ['%d', 1].freeze
49
+ expect { @scope.function_sprintf(args) }.to_not raise_error
50
+ end
51
+
52
+ it 'support named arguments in a hash with string keys' do
53
+ result = @scope.function_sprintf(["%<foo>d : %<bar>f", {'foo' => 1, 'bar' => 2}])
54
+ expect(result).to eq("1 : 2.000000")
55
+ end
56
+
57
+ it 'raises a key error if a key is not present' do
58
+ expect do
59
+ @scope.function_sprintf(["%<foo>d : %<zanzibar>f", {'foo' => 1, 'bar' => 2}])
60
+ end.to raise_error(KeyError, /key<zanzibar> not found/)
61
+ end
62
+
63
+ it 'a hash with string keys that is output formats as strings' do
64
+ result = @scope.function_sprintf(["%s", {'foo' => 1, 'bar' => 2}])
65
+ expect(result).to eq("{\"foo\"=>1, \"bar\"=>2}")
66
+ end
67
+
68
+ it 'named arguments hash with non string keys are tolerated' do
69
+ result = @scope.function_sprintf(["%<foo>d : %<bar>f", {'foo' => 1, 'bar' => 2, 1 => 2, [1] => 2, false => true, {} => {}}])
70
+ expect(result).to eq("1 : 2.000000")
71
+ end
72
+
47
73
  end
@@ -24,7 +24,7 @@ describe 'the static loader' do
24
24
  let(:loader) { loader = Puppet::Pops::Loader::StaticLoader.new() }
25
25
 
26
26
  %w{
27
- Auegas
27
+ Augeas
28
28
  Component
29
29
  Computer
30
30
  Cron
@@ -116,6 +116,10 @@ describe 'The type calculator' do
116
116
  PUnitType::DEFAULT
117
117
  end
118
118
 
119
+ def iterable_t(t = nil)
120
+ TypeFactory.iterable(t)
121
+ end
122
+
119
123
  def types
120
124
  Types
121
125
  end
@@ -1573,6 +1577,13 @@ describe 'The type calculator' do
1573
1577
  t2 = parser.parse('Type[PositiveIntegerType]', scope)
1574
1578
  expect(calculator.assignable?(t2, t1)).to be_truthy
1575
1579
  end
1580
+
1581
+ it 'An alias for a Type that describes an Iterable instance is assignable to Iterable' do
1582
+ t = type_alias_t('MyType', 'Enum[a,b]').resolve(parser, nil)
1583
+
1584
+ # True because String is iterable and an instance of Enum is a String
1585
+ expect(calculator.assignable?(iterable_t, t)).to be_truthy
1586
+ end
1576
1587
  end
1577
1588
  end
1578
1589
 
@@ -1863,6 +1874,11 @@ describe 'The type calculator' do
1863
1874
  expect(calculator.instance?(t, 15)).to be_truthy
1864
1875
  end
1865
1876
 
1877
+ it 'should consider t an instance of Iterable when aliased type is Iterable' do
1878
+ t = type_alias_t('Alias', 'Enum[a, b]').resolve(parser, nil)
1879
+ expect(calculator.instance?(iterable_t, t)).to be_truthy
1880
+ end
1881
+
1866
1882
  it 'should consider x an instance of the aliased type that uses self recursion' do
1867
1883
  t = type_alias_t('Tree', 'Hash[String,Variant[String,Tree]]')
1868
1884
  loader = Object.new
@@ -2064,6 +2080,11 @@ describe 'The type calculator' do
2064
2080
  expect(calculator.iterable(calculator.type(t))).to eq(nil)
2065
2081
  end
2066
2082
  end
2083
+
2084
+ it 'should produce an iterable for a type alias of an Iterable type' do
2085
+ t = PTypeAliasType.new('MyAlias', nil, PIntegerType.new(1, 10))
2086
+ expect(calculator.iterable(t).respond_to?(:each)).to eq(true)
2087
+ end
2067
2088
  end
2068
2089
 
2069
2090
  context 'when dealing with different types of inference' do
@@ -168,6 +168,15 @@ describe 'the type mismatch describer' do
168
168
  /parameter 'arg' expects a match for Enum\['a', 'b'\], got Sensitive/))
169
169
  end
170
170
 
171
+ it "will report the parameter of Type[<type alias>] using the alias name" do
172
+ code = <<-CODE
173
+ type Custom = String[1]
174
+ Custom.each |$x| { notice($x) }
175
+ CODE
176
+ expect { eval_and_collect_notices(code) }.to(raise_error(Puppet::Error,
177
+ /expects an Iterable value, got Type\[Custom\]/))
178
+ end
179
+
171
180
  context 'when reporting a mismatch between' do
172
181
  let(:parser) { TypeParser.singleton }
173
182
  let(:subject) { TypeMismatchDescriber.singleton }
@@ -18,8 +18,6 @@ describe provider_class, :if => Puppet.features.posix? do
18
18
 
19
19
  FileTest.stubs(:file?).with('/usr/sbin/svcadm').returns true
20
20
  FileTest.stubs(:executable?).with('/usr/sbin/svcadm').returns true
21
- FileTest.stubs(:file?).with('/usr/sbin/svccfg').returns true
22
- FileTest.stubs(:executable?).with('/usr/sbin/svccfg').returns true
23
21
  FileTest.stubs(:file?).with('/usr/bin/svcs').returns true
24
22
  FileTest.stubs(:executable?).with('/usr/bin/svcs').returns true
25
23
  Facter.stubs(:value).with(:operatingsystem).returns('Solaris')
@@ -76,9 +74,9 @@ describe provider_class, :if => Puppet.features.posix? do
76
74
  @provider.expects(:svcs).with('-H', '-o', 'state,nstate', "/system/myservice").returns("online\t-")
77
75
  @provider.status
78
76
  end
79
- it "should return absent if svcs can't find the service" do
77
+ it "should return stopped if svcs can't find the service" do
80
78
  @provider.stubs(:svcs).raises(Puppet::ExecutionFailure.new("no svc found"))
81
- expect(@provider.status).to eq(:absent)
79
+ expect(@provider.status).to eq(:stopped)
82
80
  end
83
81
  it "should return running if online in svcs output" do
84
82
  @provider.stubs(:svcs).returns("online\t-")