puppet 4.0.0-x64-mingw32 → 4.1.0-x64-mingw32

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 (219) hide show
  1. checksums.yaml +4 -4
  2. data/ext/build_defaults.yaml +8 -35
  3. data/ext/debian/puppet.default +0 -5
  4. data/ext/debian/puppet.init +1 -15
  5. data/lib/hiera/puppet_function.rb +15 -4
  6. data/lib/puppet/application/agent.rb +5 -0
  7. data/lib/puppet/application/apply.rb +23 -2
  8. data/lib/puppet/application/device.rb +8 -3
  9. data/lib/puppet/application/master.rb +16 -5
  10. data/lib/puppet/configurer.rb +7 -5
  11. data/lib/puppet/defaults.rb +18 -0
  12. data/lib/puppet/environments.rb +1 -1
  13. data/lib/puppet/error.rb +27 -1
  14. data/lib/puppet/file_serving/metadata.rb +13 -8
  15. data/lib/puppet/file_serving/terminus_helper.rb +7 -8
  16. data/lib/puppet/file_system.rb +13 -0
  17. data/lib/puppet/file_system/file_impl.rb +4 -0
  18. data/lib/puppet/file_system/memory_impl.rb +4 -0
  19. data/lib/puppet/file_system/windows.rb +8 -0
  20. data/lib/puppet/functions.rb +33 -3
  21. data/lib/puppet/functions/defined.rb +130 -0
  22. data/lib/puppet/functions/regsubst.rb +1 -1
  23. data/lib/puppet/functions/split.rb +1 -1
  24. data/lib/puppet/indirector/catalog/compiler.rb +1 -1
  25. data/lib/puppet/indirector/facts/facter.rb +11 -0
  26. data/lib/puppet/loaders.rb +1 -0
  27. data/lib/puppet/node.rb +17 -1
  28. data/lib/puppet/node/environment.rb +4 -0
  29. data/lib/puppet/parser/ast/pops_bridge.rb +4 -0
  30. data/lib/puppet/parser/compiler.rb +9 -0
  31. data/lib/puppet/parser/functions/defined.rb +25 -1
  32. data/lib/puppet/parser/functions/file.rb +3 -1
  33. data/lib/puppet/parser/scope.rb +11 -2
  34. data/lib/puppet/parser/templatewrapper.rb +2 -1
  35. data/lib/puppet/pops.rb +4 -0
  36. data/lib/puppet/pops/evaluator/access_operator.rb +25 -5
  37. data/lib/puppet/pops/evaluator/closure.rb +28 -2
  38. data/lib/puppet/pops/evaluator/collector_transformer.rb +1 -11
  39. data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +4 -0
  40. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +4 -0
  41. data/lib/puppet/pops/evaluator/compare_operator.rb +43 -0
  42. data/lib/puppet/pops/evaluator/epp_evaluator.rb +7 -2
  43. data/lib/puppet/pops/evaluator/evaluator_impl.rb +48 -14
  44. data/lib/puppet/pops/evaluator/runtime3_support.rb +10 -5
  45. data/lib/puppet/pops/functions/dispatch.rb +6 -1
  46. data/lib/puppet/pops/functions/dispatcher.rb +7 -1
  47. data/lib/puppet/pops/issue_reporter.rb +42 -16
  48. data/lib/puppet/pops/issues.rb +116 -2
  49. data/lib/puppet/pops/loader/loader.rb +11 -0
  50. data/lib/puppet/pops/loader/loader_paths.rb +67 -6
  51. data/lib/puppet/pops/loader/module_loaders.rb +19 -8
  52. data/lib/puppet/pops/loader/puppet_function_instantiator.rb +78 -0
  53. data/lib/puppet/pops/loaders.rb +6 -4
  54. data/lib/puppet/pops/migration/migration_checker.rb +54 -0
  55. data/lib/puppet/pops/model/factory.rb +5 -1
  56. data/lib/puppet/pops/model/model_label_provider.rb +2 -0
  57. data/lib/puppet/pops/model/model_meta.rb +5 -1
  58. data/lib/puppet/pops/parser/egrammar.ra +9 -10
  59. data/lib/puppet/pops/parser/eparser.rb +1061 -1047
  60. data/lib/puppet/pops/parser/epp_support.rb +18 -9
  61. data/lib/puppet/pops/parser/evaluating_parser.rb +7 -1
  62. data/lib/puppet/pops/parser/heredoc_support.rb +12 -11
  63. data/lib/puppet/pops/parser/interpolation_support.rb +7 -1
  64. data/lib/puppet/pops/parser/lexer2.rb +29 -12
  65. data/lib/puppet/pops/parser/lexer_support.rb +52 -23
  66. data/lib/puppet/pops/parser/parser_support.rb +11 -14
  67. data/lib/puppet/pops/parser/slurp_support.rb +22 -6
  68. data/lib/puppet/pops/types/type_calculator.rb +156 -55
  69. data/lib/puppet/pops/types/type_factory.rb +66 -13
  70. data/lib/puppet/pops/types/type_parser.rb +22 -13
  71. data/lib/puppet/pops/types/types.rb +23 -4
  72. data/lib/puppet/pops/types/types_meta.rb +13 -2
  73. data/lib/puppet/pops/validation.rb +25 -2
  74. data/lib/puppet/pops/validation/checker4_0.rb +63 -31
  75. data/lib/puppet/provider/group/windows_adsi.rb +8 -4
  76. data/lib/puppet/provider/mount/parsed.rb +145 -2
  77. data/lib/puppet/provider/package/apt.rb +1 -1
  78. data/lib/puppet/provider/package/pip.rb +11 -2
  79. data/lib/puppet/provider/package/pkgng.rb +134 -0
  80. data/lib/puppet/provider/package/portage.rb +1 -1
  81. data/lib/puppet/provider/package/ports.rb +0 -3
  82. data/lib/puppet/provider/package/windows/exe_package.rb +0 -1
  83. data/lib/puppet/provider/package/windows/msi_package.rb +0 -1
  84. data/lib/puppet/provider/package/zypper.rb +50 -15
  85. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +32 -7
  86. data/lib/puppet/provider/service/debian.rb +1 -1
  87. data/lib/puppet/provider/service/init.rb +7 -0
  88. data/lib/puppet/provider/user/openbsd.rb +1 -0
  89. data/lib/puppet/provider/user/windows_adsi.rb +45 -2
  90. data/lib/puppet/reference/indirection.rb +1 -1
  91. data/lib/puppet/resource.rb +1 -1
  92. data/lib/puppet/resource/catalog.rb +0 -4
  93. data/lib/puppet/settings.rb +19 -0
  94. data/lib/puppet/type/file.rb +1 -0
  95. data/lib/puppet/type/file/ensure.rb +1 -1
  96. data/lib/puppet/type/mount.rb +9 -1
  97. data/lib/puppet/type/scheduled_task.rb +13 -0
  98. data/lib/puppet/type/tidy.rb +3 -1
  99. data/lib/puppet/type/user.rb +32 -0
  100. data/lib/puppet/type/yumrepo.rb +5 -5
  101. data/lib/puppet/util/log.rb +50 -8
  102. data/lib/puppet/util/log/destinations.rb +23 -2
  103. data/lib/puppet/util/logging.rb +37 -1
  104. data/lib/puppet/util/run_mode.rb +1 -14
  105. data/lib/puppet/util/windows/adsi.rb +130 -58
  106. data/lib/puppet/version.rb +1 -1
  107. data/man/man5/puppet.conf.5 +48 -6
  108. data/man/man8/extlookup2hiera.8 +1 -1
  109. data/man/man8/puppet-agent.8 +4 -1
  110. data/man/man8/puppet-apply.8 +4 -1
  111. data/man/man8/puppet-ca.8 +1 -1
  112. data/man/man8/puppet-catalog.8 +1 -1
  113. data/man/man8/puppet-cert.8 +1 -1
  114. data/man/man8/puppet-certificate.8 +1 -1
  115. data/man/man8/puppet-certificate_request.8 +1 -1
  116. data/man/man8/puppet-certificate_revocation_list.8 +1 -1
  117. data/man/man8/puppet-config.8 +1 -1
  118. data/man/man8/puppet-describe.8 +1 -1
  119. data/man/man8/puppet-device.8 +6 -3
  120. data/man/man8/puppet-doc.8 +1 -1
  121. data/man/man8/puppet-epp.8 +1 -1
  122. data/man/man8/puppet-facts.8 +1 -1
  123. data/man/man8/puppet-file.8 +1 -1
  124. data/man/man8/puppet-filebucket.8 +1 -1
  125. data/man/man8/puppet-help.8 +1 -1
  126. data/man/man8/puppet-inspect.8 +1 -1
  127. data/man/man8/puppet-key.8 +1 -1
  128. data/man/man8/puppet-man.8 +1 -1
  129. data/man/man8/puppet-master.8 +4 -1
  130. data/man/man8/puppet-module.8 +1 -1
  131. data/man/man8/puppet-node.8 +1 -1
  132. data/man/man8/puppet-parser.8 +1 -1
  133. data/man/man8/puppet-plugin.8 +1 -1
  134. data/man/man8/puppet-report.8 +1 -1
  135. data/man/man8/puppet-resource.8 +1 -1
  136. data/man/man8/puppet-resource_type.8 +1 -1
  137. data/man/man8/puppet-status.8 +1 -1
  138. data/man/man8/puppet.8 +1 -1
  139. data/spec/fixtures/unit/data_providers/environments/production/lib/puppet/functions/environment/data.rb +3 -1
  140. data/spec/fixtures/unit/data_providers/environments/production/modules/xyz/functions/data.pp +6 -0
  141. data/spec/fixtures/unit/data_providers/environments/production/modules/xyz/lib/puppet/bindings/xyz/default.rb +9 -0
  142. data/spec/fixtures/unit/data_providers/environments/production/modules/xyz/manifests/init.pp +9 -0
  143. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcalled.pp +3 -0
  144. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcaller.pp +3 -0
  145. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcaller4.pp +3 -0
  146. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/lib/puppet/functions/user/callingpuppet.rb +5 -0
  147. data/spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/functions/hello.pp +3 -0
  148. data/spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/manifests/init.pp +3 -0
  149. data/spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/metadata.json +10 -0
  150. data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/functions/hello.pp +3 -0
  151. data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/functions/subspace/hello.pp +3 -0
  152. data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/metadata.json +1 -10
  153. data/spec/fixtures/unit/provider/mount/parsed/aix.filesystems +93 -85
  154. data/spec/fixtures/unit/provider/mount/parsed/aix.mount +11 -7
  155. data/spec/fixtures/unit/provider/package/pkgng/pkg.info +8 -0
  156. data/spec/fixtures/unit/provider/package/pkgng/pkg.query +1 -0
  157. data/spec/fixtures/unit/provider/package/pkgng/pkg.query_absent +1 -0
  158. data/spec/fixtures/unit/provider/package/pkgng/pkg.version +3 -0
  159. data/spec/fixtures/unit/provider/package/zypper/zypper-list-updates-empty.out +3 -0
  160. data/spec/integration/application/apply_spec.rb +49 -0
  161. data/spec/integration/faces/plugin_spec.rb +0 -4
  162. data/spec/integration/indirector/facts/facter_spec.rb +59 -0
  163. data/spec/integration/parser/compiler_spec.rb +850 -0
  164. data/spec/integration/parser/resource_expressions_spec.rb +3 -0
  165. data/spec/integration/parser/scope_spec.rb +26 -5
  166. data/spec/integration/transaction_spec.rb +1 -1
  167. data/spec/integration/type/file_spec.rb +318 -41
  168. data/spec/integration/util/windows/security_spec.rb +14 -5
  169. data/spec/lib/matchers/resource.rb +22 -1
  170. data/spec/lib/puppet_spec/matchers.rb +6 -4
  171. data/spec/unit/application/master_spec.rb +33 -7
  172. data/spec/unit/data_providers/function_data_provider_spec.rb +10 -1
  173. data/spec/unit/file_serving/metadata_spec.rb +1 -1
  174. data/spec/unit/file_serving/terminus_helper_spec.rb +2 -3
  175. data/spec/unit/file_system_spec.rb +38 -0
  176. data/spec/unit/functions/defined_spec.rb +289 -0
  177. data/spec/unit/functions/hiera_spec.rb +8 -6
  178. data/spec/unit/functions/regsubst_spec.rb +4 -0
  179. data/spec/unit/functions/split_spec.rb +8 -0
  180. data/spec/unit/functions4_spec.rb +97 -2
  181. data/spec/unit/indirector/facts/facter_spec.rb +7 -0
  182. data/spec/unit/node_spec.rb +6 -0
  183. data/spec/unit/parser/functions/file_spec.rb +7 -1
  184. data/spec/unit/parser/functions/template_spec.rb +1 -1
  185. data/spec/unit/parser/scope_spec.rb +2 -2
  186. data/spec/unit/parser/templatewrapper_spec.rb +1 -1
  187. data/spec/unit/pops/evaluator/access_ops_spec.rb +19 -0
  188. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +84 -18
  189. data/spec/unit/pops/evaluator/variables_spec.rb +1 -1
  190. data/spec/unit/pops/issues_spec.rb +16 -16
  191. data/spec/unit/pops/loaders/loaders_spec.rb +106 -48
  192. data/spec/unit/pops/migration_spec.rb +53 -0
  193. data/spec/unit/pops/parser/lexer2_spec.rb +142 -1
  194. data/spec/unit/pops/parser/parse_heredoc_spec.rb +26 -0
  195. data/spec/unit/pops/types/type_calculator_spec.rb +205 -12
  196. data/spec/unit/pops/validation_spec.rb +66 -0
  197. data/spec/unit/pops/validator/validator_spec.rb +1 -1
  198. data/spec/unit/provider/group/windows_adsi_spec.rb +57 -9
  199. data/spec/unit/provider/mount/parsed_spec.rb +31 -5
  200. data/spec/unit/provider/package/apt_spec.rb +5 -0
  201. data/spec/unit/provider/package/pip_spec.rb +9 -0
  202. data/spec/unit/provider/package/pkgng_spec.rb +172 -0
  203. data/spec/unit/provider/package/windows/exe_package_spec.rb +0 -1
  204. data/spec/unit/provider/package/windows/msi_package_spec.rb +0 -1
  205. data/spec/unit/provider/package/zypper_spec.rb +50 -19
  206. data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +312 -70
  207. data/spec/unit/provider/service/base_spec.rb +38 -27
  208. data/spec/unit/provider/service/debian_spec.rb +8 -0
  209. data/spec/unit/provider/service/freebsd_spec.rb +1 -0
  210. data/spec/unit/provider/service/gentoo_spec.rb +1 -0
  211. data/spec/unit/provider/service/init_spec.rb +18 -0
  212. data/spec/unit/provider/service/openbsd_spec.rb +1 -0
  213. data/spec/unit/provider/service/redhat_spec.rb +1 -0
  214. data/spec/unit/provider/user/windows_adsi_spec.rb +134 -5
  215. data/spec/unit/settings_spec.rb +11 -0
  216. data/spec/unit/util/log_spec.rb +113 -0
  217. data/spec/unit/util/windows/adsi_spec.rb +135 -41
  218. data/spec/unit/util/windows/sid_spec.rb +0 -10
  219. metadata +48 -2
@@ -189,39 +189,50 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
189
189
  end
190
190
 
191
191
  describe "when given a set of groups to which to add the user" do
192
+ let(:existing_groups) { ['group2','group3'] }
193
+ let(:group_sids) { existing_groups.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i])} }
194
+
192
195
  let(:groups_to_set) { 'group1,group2' }
196
+ let(:desired_sids) { groups_to_set.split(',').each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i-1])} }
193
197
 
194
198
  before(:each) do
195
- Puppet::Util::Windows::SID.stubs(:octet_string_to_sid_object).returns(sid)
196
- user.expects(:groups).returns ['group2', 'group3']
199
+ user.expects(:group_sids).returns(group_sids.map {|s| s.objectSID})
197
200
  end
198
201
 
199
202
  describe "if membership is specified as inclusive" do
200
203
  it "should add the user to those groups, and remove it from groups not in the list" do
201
- group1 = stub 'group1'
202
- group1.expects(:Add).with("WinNT://testcomputername/#{username},user")
204
+ Puppet::Util::Windows::ADSI::User.expects(:name_sid_hash).returns(Hash[ desired_sids.map { |s| [s.objectSID.to_s, s.objectSID] }])
205
+ user.expects(:add_group_sids).with([-1])
206
+ user.expects(:remove_group_sids).with([1])
203
207
 
204
- group3 = stub 'group1'
205
- group3.expects(:Remove).with("WinNT://testcomputername/#{username},user")
208
+ user.set_groups(groups_to_set, false)
209
+ end
206
210
 
207
- Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sid).returns("WinNT://testcomputername/#{username},user").twice
208
- Puppet::Util::Windows::ADSI.expects(:connect).with('WinNT://./group1,group').returns group1
209
- Puppet::Util::Windows::ADSI.expects(:connect).with('WinNT://./group3,group').returns group3
211
+ it "should remove all users from a group if desired is empty" do
212
+ Puppet::Util::Windows::ADSI::User.expects(:name_sid_hash).returns({})
213
+ user.expects(:add_group_sids).never
214
+ user.expects(:remove_group_sids).with([0], [1])
210
215
 
211
- user.set_groups(groups_to_set, false)
216
+ user.set_groups('', false)
212
217
  end
213
218
  end
214
219
 
215
220
  describe "if membership is specified as minimum" do
216
221
  it "should add the user to the specified groups without affecting its other memberships" do
217
- group1 = stub 'group1'
218
- group1.expects(:Add).with("WinNT://testcomputername/#{username},user")
219
-
220
- Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sid).returns("WinNT://testcomputername/#{username},user")
221
- Puppet::Util::Windows::ADSI.expects(:connect).with('WinNT://./group1,group').returns group1
222
+ Puppet::Util::Windows::ADSI::User.expects(:name_sid_hash).returns(Hash[ desired_sids.map { |s| [s.objectSID.to_s, s.objectSID] }])
223
+ user.expects(:add_group_sids).with([-1])
224
+ user.expects(:remove_group_sids).never
222
225
 
223
226
  user.set_groups(groups_to_set, true)
224
227
  end
228
+
229
+ it "should do nothing if desired is empty" do
230
+ Puppet::Util::Windows::ADSI::User.expects(:name_sid_hash).returns({})
231
+ user.expects(:remove_group_sids).never
232
+ user.expects(:add_group_sids).never
233
+
234
+ user.set_groups('', true)
235
+ end
225
236
  end
226
237
  end
227
238
  end
@@ -270,42 +281,125 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
270
281
  expect(group.members).to match(names)
271
282
  end
272
283
 
273
- it "should be able to add a list of users to a group" do
274
- names = ['DOMAIN\user1', 'user2']
275
- sids = [
276
- stub(:account => 'user1', :domain => 'DOMAIN'),
277
- stub(:account => 'user2', :domain => 'testcomputername'),
278
- stub(:account => 'user3', :domain => 'DOMAIN2'),
279
- ]
284
+ context "calling .set_members" do
285
+ it "should set the members of a group to only desired_members when inclusive" do
286
+ names = ['DOMAIN\user1', 'user2']
287
+ sids = [
288
+ stub(:account => 'user1', :domain => 'DOMAIN'),
289
+ stub(:account => 'user2', :domain => 'testcomputername'),
290
+ stub(:account => 'user3', :domain => 'DOMAIN2'),
291
+ ]
280
292
 
281
- # use stubbed objectSid on member to return stubbed SID
282
- Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([0]).returns(sids[0])
283
- Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([1]).returns(sids[1])
293
+ # use stubbed objectSid on member to return stubbed SID
294
+ Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([0]).returns(sids[0])
295
+ Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([1]).returns(sids[1])
284
296
 
285
- Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('user2').returns(sids[1])
286
- Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('DOMAIN2\user3').returns(sids[2])
297
+ Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('user2').returns(sids[1])
298
+ Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('DOMAIN2\user3').returns(sids[2])
287
299
 
288
- Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[0]).returns("WinNT://DOMAIN/user1,user")
289
- Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[2]).returns("WinNT://DOMAIN2/user3,user")
300
+ Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[0]).returns("WinNT://DOMAIN/user1,user")
301
+ Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[2]).returns("WinNT://DOMAIN2/user3,user")
290
302
 
291
- members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i])}
292
- adsi_group.expects(:Members).returns members
303
+ members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i])}
304
+ adsi_group.expects(:Members).returns members
293
305
 
294
- adsi_group.expects(:Remove).with('WinNT://DOMAIN/user1,user')
295
- adsi_group.expects(:Add).with('WinNT://DOMAIN2/user3,user')
306
+ adsi_group.expects(:Remove).with('WinNT://DOMAIN/user1,user')
307
+ adsi_group.expects(:Add).with('WinNT://DOMAIN2/user3,user')
296
308
 
297
- group.set_members(['user2', 'DOMAIN2\user3'])
298
- end
309
+ group.set_members(['user2', 'DOMAIN2\user3'])
310
+ end
299
311
 
300
- it "should raise an error when a username does not resolve to a SID" do
301
- expect {
302
- adsi_group.expects(:Members).returns []
303
- group.set_members(['foobar'])
304
- }.to raise_error(Puppet::Error, /Could not resolve username: foobar/)
312
+ it "should add the desired_members to an existing group when not inclusive" do
313
+ names = ['DOMAIN\user1', 'user2']
314
+ sids = [
315
+ stub(:account => 'user1', :domain => 'DOMAIN'),
316
+ stub(:account => 'user2', :domain => 'testcomputername'),
317
+ stub(:account => 'user3', :domain => 'DOMAIN2'),
318
+ ]
319
+
320
+ # use stubbed objectSid on member to return stubbed SID
321
+ Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([0]).returns(sids[0])
322
+ Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([1]).returns(sids[1])
323
+
324
+ Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('user2').returns(sids[1])
325
+ Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('DOMAIN2\user3').returns(sids[2])
326
+
327
+ Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[2]).returns("WinNT://DOMAIN2/user3,user")
328
+
329
+ members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i])}
330
+ adsi_group.expects(:Members).returns members
331
+
332
+ adsi_group.expects(:Remove).with('WinNT://DOMAIN/user1,user').never
333
+
334
+ adsi_group.expects(:Add).with('WinNT://DOMAIN2/user3,user')
335
+
336
+ group.set_members(['user2', 'DOMAIN2\user3'],false)
337
+ end
338
+
339
+ it "should return immediately when desired_members is nil" do
340
+ adsi_group.expects(:Members).never
341
+
342
+ adsi_group.expects(:Remove).never
343
+ adsi_group.expects(:Add).never
344
+
345
+ group.set_members(nil)
346
+ end
347
+
348
+ it "should remove all members when desired_members is empty and inclusive" do
349
+ names = ['DOMAIN\user1', 'user2']
350
+ sids = [
351
+ stub(:account => 'user1', :domain => 'DOMAIN'),
352
+ stub(:account => 'user2', :domain => 'testcomputername')
353
+ ]
354
+
355
+ # use stubbed objectSid on member to return stubbed SID
356
+ Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([0]).returns(sids[0])
357
+ Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([1]).returns(sids[1])
358
+
359
+ Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[0]).returns("WinNT://DOMAIN/user1,user")
360
+ Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[1]).returns("WinNT://testcomputername/user2,user")
361
+
362
+ members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i])}
363
+ adsi_group.expects(:Members).returns members
364
+
365
+ adsi_group.expects(:Remove).with('WinNT://DOMAIN/user1,user')
366
+ adsi_group.expects(:Remove).with('WinNT://testcomputername/user2,user')
367
+
368
+ group.set_members([])
369
+ end
370
+
371
+ it "should do nothing when desired_members is empty and not inclusive" do
372
+ names = ['DOMAIN\user1', 'user2']
373
+ sids = [
374
+ stub(:account => 'user1', :domain => 'DOMAIN'),
375
+ stub(:account => 'user2', :domain => 'testcomputername')
376
+ ]
377
+ # use stubbed objectSid on member to return stubbed SID
378
+ Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([0]).returns(sids[0])
379
+ Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([1]).returns(sids[1])
380
+
381
+ members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i])}
382
+ adsi_group.expects(:Members).returns members
383
+
384
+ adsi_group.expects(:Remove).never
385
+ adsi_group.expects(:Add).never
386
+
387
+ group.set_members([],false)
388
+ end
389
+
390
+ it "should raise an error when a username does not resolve to a SID" do
391
+ expect {
392
+ adsi_group.expects(:Members).returns []
393
+ group.set_members(['foobar'])
394
+ }.to raise_error(Puppet::Error, /Could not resolve name: foobar/)
395
+ end
305
396
  end
306
397
 
307
398
  it "should generate the correct URI" do
308
399
  Puppet::Util::Windows::ADSI.stubs(:sid_uri_safe).returns(nil)
400
+ adsi_group.expects(:objectSID).returns([0])
401
+ Socket.expects(:gethostname).returns('testcomputername')
402
+ Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([0]).returns(stub(:account => groupname,:domain => 'testcomputername'))
309
403
  expect(group.uri).to eq("WinNT://./#{groupname},group")
310
404
  end
311
405
  end
@@ -381,7 +475,7 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
381
475
  end
382
476
 
383
477
  it "should warn on 2003" do
384
- connection.expects(:Delete).raises(RuntimeError,
478
+ connection.expects(:Delete).raises(WIN32OLERuntimeError,
385
479
  "Delete (WIN32OLERuntimeError)
386
480
  OLE error code:80041010 in SWbemServicesEx
387
481
  Invalid class
@@ -13,16 +13,6 @@ describe "Puppet::Util::Windows::SID", :if => Puppet.features.microsoft_windows?
13
13
  let(:unknown_name) { 'chewbacca' }
14
14
 
15
15
  context "#octet_string_to_sid_object" do
16
- it "should properly convert an array of bytes for the local Administrator SID" do
17
- host = '.'
18
- username = 'Administrator'
19
- admin = WIN32OLE.connect("WinNT://#{host}/#{username},user")
20
- converted = subject.octet_string_to_sid_object(admin.objectSID)
21
-
22
- expect(converted).to eq(Win32::Security::SID.new(username, host))
23
- expect(converted).to be_an_instance_of Win32::Security::SID
24
- end
25
-
26
16
  it "should properly convert an array of bytes for a well-known SID" do
27
17
  bytes = [1, 1, 0, 0, 0, 0, 0, 5, 18, 0, 0, 0]
28
18
  converted = subject.octet_string_to_sid_object(bytes)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-08 00:00:00.000000000 Z
11
+ date: 2015-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter
@@ -336,6 +336,7 @@ files:
336
336
  - lib/puppet/forge/repository.rb
337
337
  - lib/puppet/functions.rb
338
338
  - lib/puppet/functions/assert_type.rb
339
+ - lib/puppet/functions/defined.rb
339
340
  - lib/puppet/functions/each.rb
340
341
  - lib/puppet/functions/epp.rb
341
342
  - lib/puppet/functions/filter.rb
@@ -677,6 +678,7 @@ files:
677
678
  - lib/puppet/pops/loader/loader_paths.rb
678
679
  - lib/puppet/pops/loader/module_loaders.rb
679
680
  - lib/puppet/pops/loader/null_loader.rb
681
+ - lib/puppet/pops/loader/puppet_function_instantiator.rb
680
682
  - lib/puppet/pops/loader/ruby_function_instantiator.rb
681
683
  - lib/puppet/pops/loader/simple_environment_loader.rb
682
684
  - lib/puppet/pops/loader/static_loader.rb
@@ -684,6 +686,7 @@ files:
684
686
  - lib/puppet/pops/loaders.rb
685
687
  - lib/puppet/pops/lookup.rb
686
688
  - lib/puppet/pops/merge_strategy.rb
689
+ - lib/puppet/pops/migration/migration_checker.rb
687
690
  - lib/puppet/pops/model/ast_transformer.rb
688
691
  - lib/puppet/pops/model/factory.rb
689
692
  - lib/puppet/pops/model/model.rb
@@ -785,6 +788,7 @@ files:
785
788
  - lib/puppet/provider/package/pkg.rb
786
789
  - lib/puppet/provider/package/pkgdmg.rb
787
790
  - lib/puppet/provider/package/pkgin.rb
791
+ - lib/puppet/provider/package/pkgng.rb
788
792
  - lib/puppet/provider/package/pkgutil.rb
789
793
  - lib/puppet/provider/package/portage.rb
790
794
  - lib/puppet/provider/package/ports.rb
@@ -1550,6 +1554,9 @@ files:
1550
1554
  - spec/fixtures/unit/data_providers/environments/production/modules/abc/lib/puppet/bindings/abc/default.rb
1551
1555
  - spec/fixtures/unit/data_providers/environments/production/modules/abc/lib/puppet/functions/abc/data.rb
1552
1556
  - spec/fixtures/unit/data_providers/environments/production/modules/abc/manifests/init.pp
1557
+ - spec/fixtures/unit/data_providers/environments/production/modules/xyz/functions/data.pp
1558
+ - spec/fixtures/unit/data_providers/environments/production/modules/xyz/lib/puppet/bindings/xyz/default.rb
1559
+ - spec/fixtures/unit/data_providers/environments/production/modules/xyz/manifests/init.pp
1553
1560
  - spec/fixtures/unit/data_providers/environments/sample/environment.conf
1554
1561
  - spec/fixtures/unit/data_providers/environments/sample/manifests/site.pp
1555
1562
  - spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet/bindings/dataprovider/default.rb
@@ -1632,9 +1639,18 @@ files:
1632
1639
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/callee.rb
1633
1640
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/callee_ws.rb
1634
1641
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/metadata.json
1642
+ - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcalled.pp
1643
+ - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcaller.pp
1644
+ - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcaller4.pp
1635
1645
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/lib/puppet/functions/user/caller.rb
1636
1646
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/lib/puppet/functions/user/caller_ws.rb
1647
+ - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/lib/puppet/functions/user/callingpuppet.rb
1637
1648
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/metadata.json
1649
+ - spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/functions/hello.pp
1650
+ - spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/manifests/init.pp
1651
+ - spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/metadata.json
1652
+ - spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/functions/hello.pp
1653
+ - spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/functions/subspace/hello.pp
1638
1654
  - spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/modulea/rb_func_a.rb
1639
1655
  - spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/rb_func_a.rb
1640
1656
  - spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/manifests/init.pp
@@ -1726,11 +1742,16 @@ files:
1726
1742
  - spec/fixtures/unit/provider/package/pkg/incomplete
1727
1743
  - spec/fixtures/unit/provider/package/pkg/solaris11
1728
1744
  - spec/fixtures/unit/provider/package/pkg/unknown_status
1745
+ - spec/fixtures/unit/provider/package/pkgng/pkg.info
1746
+ - spec/fixtures/unit/provider/package/pkgng/pkg.query
1747
+ - spec/fixtures/unit/provider/package/pkgng/pkg.query_absent
1748
+ - spec/fixtures/unit/provider/package/pkgng/pkg.version
1729
1749
  - spec/fixtures/unit/provider/package/sun/dummy.server
1730
1750
  - spec/fixtures/unit/provider/package/sun/simple
1731
1751
  - spec/fixtures/unit/provider/package/yum/yum-check-update-multiline.txt
1732
1752
  - spec/fixtures/unit/provider/package/yum/yum-check-update-simple.txt
1733
1753
  - spec/fixtures/unit/provider/package/zypper/zypper-list-updates-SLES11sp1.out
1754
+ - spec/fixtures/unit/provider/package/zypper/zypper-list-updates-empty.out
1734
1755
  - spec/fixtures/unit/provider/parsedfile/simple.txt
1735
1756
  - spec/fixtures/unit/provider/service/gentoo/rc_update_show
1736
1757
  - spec/fixtures/unit/provider/service/openbsd/rcctl_getall
@@ -1964,6 +1985,7 @@ files:
1964
1985
  - spec/unit/forge/repository_spec.rb
1965
1986
  - spec/unit/forge_spec.rb
1966
1987
  - spec/unit/functions/assert_type_spec.rb
1988
+ - spec/unit/functions/defined_spec.rb
1967
1989
  - spec/unit/functions/each_spec.rb
1968
1990
  - spec/unit/functions/epp_spec.rb
1969
1991
  - spec/unit/functions/filter_spec.rb
@@ -2201,6 +2223,7 @@ files:
2201
2223
  - spec/unit/pops/loaders/loaders_spec.rb
2202
2224
  - spec/unit/pops/loaders/module_loaders_spec.rb
2203
2225
  - spec/unit/pops/loaders/static_loader_spec.rb
2226
+ - spec/unit/pops/migration_spec.rb
2204
2227
  - spec/unit/pops/model/model_spec.rb
2205
2228
  - spec/unit/pops/parser/epp_parser_spec.rb
2206
2229
  - spec/unit/pops/parser/evaluating_parser_spec.rb
@@ -2221,6 +2244,7 @@ files:
2221
2244
  - spec/unit/pops/types/type_factory_spec.rb
2222
2245
  - spec/unit/pops/types/type_parser_spec.rb
2223
2246
  - spec/unit/pops/utils_spec.rb
2247
+ - spec/unit/pops/validation_spec.rb
2224
2248
  - spec/unit/pops/validator/validator_spec.rb
2225
2249
  - spec/unit/pops/visitor_spec.rb
2226
2250
  - spec/unit/property/boolean_spec.rb
@@ -2275,6 +2299,7 @@ files:
2275
2299
  - spec/unit/provider/package/pkg_spec.rb
2276
2300
  - spec/unit/provider/package/pkgdmg_spec.rb
2277
2301
  - spec/unit/provider/package/pkgin_spec.rb
2302
+ - spec/unit/provider/package/pkgng_spec.rb
2278
2303
  - spec/unit/provider/package/pkgutil_spec.rb
2279
2304
  - spec/unit/provider/package/portage_spec.rb
2280
2305
  - spec/unit/provider/package/puppet_gem_spec.rb
@@ -2586,6 +2611,9 @@ test_files:
2586
2611
  - spec/fixtures/unit/data_providers/environments/production/modules/abc/lib/puppet/bindings/abc/default.rb
2587
2612
  - spec/fixtures/unit/data_providers/environments/production/modules/abc/lib/puppet/functions/abc/data.rb
2588
2613
  - spec/fixtures/unit/data_providers/environments/production/modules/abc/manifests/init.pp
2614
+ - spec/fixtures/unit/data_providers/environments/production/modules/xyz/functions/data.pp
2615
+ - spec/fixtures/unit/data_providers/environments/production/modules/xyz/lib/puppet/bindings/xyz/default.rb
2616
+ - spec/fixtures/unit/data_providers/environments/production/modules/xyz/manifests/init.pp
2589
2617
  - spec/fixtures/unit/data_providers/environments/sample/environment.conf
2590
2618
  - spec/fixtures/unit/data_providers/environments/sample/manifests/site.pp
2591
2619
  - spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet/bindings/dataprovider/default.rb
@@ -2668,9 +2696,18 @@ test_files:
2668
2696
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/callee.rb
2669
2697
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/callee_ws.rb
2670
2698
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/metadata.json
2699
+ - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcalled.pp
2700
+ - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcaller.pp
2701
+ - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcaller4.pp
2671
2702
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/lib/puppet/functions/user/caller.rb
2672
2703
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/lib/puppet/functions/user/caller_ws.rb
2704
+ - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/lib/puppet/functions/user/callingpuppet.rb
2673
2705
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/metadata.json
2706
+ - spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/functions/hello.pp
2707
+ - spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/manifests/init.pp
2708
+ - spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/metadata.json
2709
+ - spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/functions/hello.pp
2710
+ - spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/functions/subspace/hello.pp
2674
2711
  - spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/modulea/rb_func_a.rb
2675
2712
  - spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/rb_func_a.rb
2676
2713
  - spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/manifests/init.pp
@@ -2762,11 +2799,16 @@ test_files:
2762
2799
  - spec/fixtures/unit/provider/package/pkg/incomplete
2763
2800
  - spec/fixtures/unit/provider/package/pkg/solaris11
2764
2801
  - spec/fixtures/unit/provider/package/pkg/unknown_status
2802
+ - spec/fixtures/unit/provider/package/pkgng/pkg.info
2803
+ - spec/fixtures/unit/provider/package/pkgng/pkg.query
2804
+ - spec/fixtures/unit/provider/package/pkgng/pkg.query_absent
2805
+ - spec/fixtures/unit/provider/package/pkgng/pkg.version
2765
2806
  - spec/fixtures/unit/provider/package/sun/dummy.server
2766
2807
  - spec/fixtures/unit/provider/package/sun/simple
2767
2808
  - spec/fixtures/unit/provider/package/yum/yum-check-update-multiline.txt
2768
2809
  - spec/fixtures/unit/provider/package/yum/yum-check-update-simple.txt
2769
2810
  - spec/fixtures/unit/provider/package/zypper/zypper-list-updates-SLES11sp1.out
2811
+ - spec/fixtures/unit/provider/package/zypper/zypper-list-updates-empty.out
2770
2812
  - spec/fixtures/unit/provider/parsedfile/simple.txt
2771
2813
  - spec/fixtures/unit/provider/service/gentoo/rc_update_show
2772
2814
  - spec/fixtures/unit/provider/service/openbsd/rcctl_getall
@@ -3000,6 +3042,7 @@ test_files:
3000
3042
  - spec/unit/forge/repository_spec.rb
3001
3043
  - spec/unit/forge_spec.rb
3002
3044
  - spec/unit/functions/assert_type_spec.rb
3045
+ - spec/unit/functions/defined_spec.rb
3003
3046
  - spec/unit/functions/each_spec.rb
3004
3047
  - spec/unit/functions/epp_spec.rb
3005
3048
  - spec/unit/functions/filter_spec.rb
@@ -3237,6 +3280,7 @@ test_files:
3237
3280
  - spec/unit/pops/loaders/loaders_spec.rb
3238
3281
  - spec/unit/pops/loaders/module_loaders_spec.rb
3239
3282
  - spec/unit/pops/loaders/static_loader_spec.rb
3283
+ - spec/unit/pops/migration_spec.rb
3240
3284
  - spec/unit/pops/model/model_spec.rb
3241
3285
  - spec/unit/pops/parser/epp_parser_spec.rb
3242
3286
  - spec/unit/pops/parser/evaluating_parser_spec.rb
@@ -3257,6 +3301,7 @@ test_files:
3257
3301
  - spec/unit/pops/types/type_factory_spec.rb
3258
3302
  - spec/unit/pops/types/type_parser_spec.rb
3259
3303
  - spec/unit/pops/utils_spec.rb
3304
+ - spec/unit/pops/validation_spec.rb
3260
3305
  - spec/unit/pops/validator/validator_spec.rb
3261
3306
  - spec/unit/pops/visitor_spec.rb
3262
3307
  - spec/unit/property/boolean_spec.rb
@@ -3311,6 +3356,7 @@ test_files:
3311
3356
  - spec/unit/provider/package/pkg_spec.rb
3312
3357
  - spec/unit/provider/package/pkgdmg_spec.rb
3313
3358
  - spec/unit/provider/package/pkgin_spec.rb
3359
+ - spec/unit/provider/package/pkgng_spec.rb
3314
3360
  - spec/unit/provider/package/pkgutil_spec.rb
3315
3361
  - spec/unit/provider/package/portage_spec.rb
3316
3362
  - spec/unit/provider/package/puppet_gem_spec.rb