puppet 5.5.8-universal-darwin → 5.5.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 (117) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +14 -14
  3. data/Rakefile +3 -1
  4. data/ext/solaris/smf/svc-puppetd +8 -1
  5. data/ext/solaris/smf/svc-puppetmasterd +8 -1
  6. data/lib/puppet/application/device.rb +45 -29
  7. data/lib/puppet/face/config.rb +1 -1
  8. data/lib/puppet/forge.rb +4 -1
  9. data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +3 -1
  10. data/lib/puppet/pops/types/p_timespan_type.rb +2 -2
  11. data/lib/puppet/pops/types/string_converter.rb +11 -2
  12. data/lib/puppet/provider/cron/crontab.rb +1 -1
  13. data/lib/puppet/provider/package/windows/exe_package.rb +13 -0
  14. data/lib/puppet/provider/package/windows/msi_package.rb +8 -0
  15. data/lib/puppet/provider/package/windows/package.rb +9 -1
  16. data/lib/puppet/provider/parsedfile.rb +25 -4
  17. data/lib/puppet/provider/service/smf.rb +54 -0
  18. data/lib/puppet/transaction.rb +4 -1
  19. data/lib/puppet/transaction/event_manager.rb +13 -1
  20. data/lib/puppet/transaction/resource_harness.rb +3 -1
  21. data/lib/puppet/util/command_line.rb +2 -3
  22. data/lib/puppet/util/filetype.rb +36 -4
  23. data/lib/puppet/util/selinux.rb +1 -1
  24. data/lib/puppet/util/windows/api_types.rb +1 -1
  25. data/lib/puppet/util/windows/registry.rb +29 -5
  26. data/lib/puppet/util/windows/service.rb +106 -99
  27. data/lib/puppet/version.rb +1 -1
  28. data/locales/puppet.pot +97 -69
  29. data/man/man5/puppet.conf.5 +2 -2
  30. data/man/man8/puppet-agent.8 +1 -1
  31. data/man/man8/puppet-apply.8 +1 -1
  32. data/man/man8/puppet-ca.8 +1 -1
  33. data/man/man8/puppet-catalog.8 +1 -1
  34. data/man/man8/puppet-cert.8 +1 -1
  35. data/man/man8/puppet-certificate.8 +1 -1
  36. data/man/man8/puppet-certificate_request.8 +1 -1
  37. data/man/man8/puppet-certificate_revocation_list.8 +1 -1
  38. data/man/man8/puppet-config.8 +2 -2
  39. data/man/man8/puppet-describe.8 +1 -1
  40. data/man/man8/puppet-device.8 +23 -19
  41. data/man/man8/puppet-doc.8 +1 -1
  42. data/man/man8/puppet-epp.8 +1 -1
  43. data/man/man8/puppet-facts.8 +1 -1
  44. data/man/man8/puppet-filebucket.8 +1 -1
  45. data/man/man8/puppet-generate.8 +1 -1
  46. data/man/man8/puppet-help.8 +1 -1
  47. data/man/man8/puppet-key.8 +1 -1
  48. data/man/man8/puppet-lookup.8 +1 -1
  49. data/man/man8/puppet-man.8 +1 -1
  50. data/man/man8/puppet-master.8 +1 -1
  51. data/man/man8/puppet-module.8 +1 -1
  52. data/man/man8/puppet-node.8 +1 -1
  53. data/man/man8/puppet-parser.8 +1 -1
  54. data/man/man8/puppet-plugin.8 +1 -1
  55. data/man/man8/puppet-report.8 +1 -1
  56. data/man/man8/puppet-resource.8 +1 -1
  57. data/man/man8/puppet-script.8 +1 -1
  58. data/man/man8/puppet-status.8 +1 -1
  59. data/man/man8/puppet.8 +2 -2
  60. data/spec/fixtures/unit/provider/service/smf/svcs_fmri.out +6 -0
  61. data/spec/fixtures/unit/provider/service/smf/svcs_multiple_fmris.out +13 -0
  62. data/spec/integration/ssl/key_spec.rb +0 -4
  63. data/spec/integration/transaction_spec.rb +1 -1
  64. data/spec/integration/util/windows/registry_spec.rb +39 -0
  65. data/spec/unit/application/device_spec.rb +4 -1
  66. data/spec/unit/application/lookup_spec.rb +10 -9
  67. data/spec/unit/forge/forge_spec.rb +4 -2
  68. data/spec/unit/indirector/yaml_spec.rb +1 -1
  69. data/spec/unit/pops/loaders/loader_spec.rb +6 -7
  70. data/spec/unit/pops/types/p_timespan_type_spec.rb +22 -0
  71. data/spec/unit/pops/types/p_timestamp_type_spec.rb +19 -0
  72. data/spec/unit/pops/types/string_converter_spec.rb +20 -0
  73. data/spec/unit/provider/cron/parsed_spec.rb +4 -3
  74. data/spec/unit/provider/group/ldap_spec.rb +22 -25
  75. data/spec/unit/provider/group/pw_spec.rb +7 -10
  76. data/spec/unit/provider/host/parsed_spec.rb +3 -17
  77. data/spec/unit/provider/nameservice/directoryservice_spec.rb +97 -103
  78. data/spec/unit/provider/package/aix_spec.rb +5 -8
  79. data/spec/unit/provider/package/apt_spec.rb +3 -6
  80. data/spec/unit/provider/package/dnf_spec.rb +29 -31
  81. data/spec/unit/provider/package/dpkg_spec.rb +18 -21
  82. data/spec/unit/provider/package/freebsd_spec.rb +4 -7
  83. data/spec/unit/provider/package/gem_spec.rb +41 -41
  84. data/spec/unit/provider/package/hpux_spec.rb +7 -10
  85. data/spec/unit/provider/package/macports_spec.rb +13 -15
  86. data/spec/unit/provider/package/nim_spec.rb +3 -10
  87. data/spec/unit/provider/package/openbsd_spec.rb +14 -17
  88. data/spec/unit/provider/package/pip3_spec.rb +3 -6
  89. data/spec/unit/provider/package/pip_spec.rb +44 -72
  90. data/spec/unit/provider/package/pkgin_spec.rb +13 -18
  91. data/spec/unit/provider/package/pkgng_spec.rb +21 -24
  92. data/spec/unit/provider/package/puppet_gem_spec.rb +6 -9
  93. data/spec/unit/provider/package/tdnf_spec.rb +9 -12
  94. data/spec/unit/provider/package/yum_spec.rb +29 -15
  95. data/spec/unit/provider/package/zypper_spec.rb +17 -19
  96. data/spec/unit/provider/service/bsd_spec.rb +8 -12
  97. data/spec/unit/provider/service/daemontools_spec.rb +12 -20
  98. data/spec/unit/provider/service/debian_spec.rb +8 -16
  99. data/spec/unit/provider/service/freebsd_spec.rb +2 -5
  100. data/spec/unit/provider/service/openbsd_spec.rb +12 -18
  101. data/spec/unit/provider/service/rcng_spec.rb +3 -7
  102. data/spec/unit/provider/service/redhat_spec.rb +21 -23
  103. data/spec/unit/provider/service/runit_spec.rb +9 -19
  104. data/spec/unit/provider/service/smf_spec.rb +82 -21
  105. data/spec/unit/provider/service/src_spec.rb +14 -23
  106. data/spec/unit/provider/user/hpux_spec.rb +2 -5
  107. data/spec/unit/provider/user/ldap_spec.rb +29 -32
  108. data/spec/unit/provider/user/pw_spec.rb +10 -13
  109. data/spec/unit/ssl/key_spec.rb +2 -4
  110. data/spec/unit/transaction/event_manager_spec.rb +12 -1
  111. data/spec/unit/transaction/resource_harness_spec.rb +18 -0
  112. data/spec/unit/transaction_spec.rb +25 -0
  113. data/spec/unit/util/filetype_spec.rb +13 -5
  114. data/spec/unit/util/logging_spec.rb +0 -41
  115. data/spec/unit/util/monkey_patches_spec.rb +18 -5
  116. data/spec/unit/util/selinux_spec.rb +4 -0
  117. metadata +6 -2
@@ -1,4 +1,3 @@
1
- #! /usr/bin/env ruby
2
1
  require 'spec_helper'
3
2
 
4
3
  module Puppet::Util::Plist
@@ -6,13 +5,11 @@ end
6
5
 
7
6
  # We use this as a reasonable way to obtain all the support infrastructure.
8
7
  [:group].each do |type_for_this_round|
9
- provider_class = Puppet::Type.type(type_for_this_round).provider(:directoryservice)
10
-
11
- describe provider_class do
8
+ describe Puppet::Type.type(type_for_this_round).provider(:directoryservice) do
12
9
  before do
13
10
  @resource = stub("resource")
14
11
  @resource.stubs(:[]).with(:name)
15
- @provider = provider_class.new(@resource)
12
+ @provider = described_class.new(@resource)
16
13
  end
17
14
 
18
15
  it "[#6009] should handle nested arrays of members" do
@@ -40,125 +37,122 @@ end
40
37
  end
41
38
  end
42
39
 
43
- describe 'DirectoryService.single_report' do
44
- it 'should use plist data' do
45
- Puppet::Provider::NameService::DirectoryService.stubs(:get_ds_path).returns('Users')
46
- Puppet::Provider::NameService::DirectoryService.stubs(:list_all_present).returns(
47
- ['root', 'user1', 'user2', 'resource_name']
48
- )
49
- Puppet::Provider::NameService::DirectoryService.stubs(:generate_attribute_hash)
50
- Puppet::Provider::NameService::DirectoryService.stubs(:execute)
51
- Puppet::Provider::NameService::DirectoryService.expects(:parse_dscl_plist_data)
52
-
53
- Puppet::Provider::NameService::DirectoryService.single_report('resource_name')
40
+ describe Puppet::Provider::NameService::DirectoryService do
41
+ context '.single_report' do
42
+ it 'should use plist data' do
43
+ Puppet::Provider::NameService::DirectoryService.stubs(:get_ds_path).returns('Users')
44
+ Puppet::Provider::NameService::DirectoryService.stubs(:list_all_present).returns(
45
+ ['root', 'user1', 'user2', 'resource_name']
46
+ )
47
+ Puppet::Provider::NameService::DirectoryService.stubs(:generate_attribute_hash)
48
+ Puppet::Provider::NameService::DirectoryService.stubs(:execute)
49
+ Puppet::Provider::NameService::DirectoryService.expects(:parse_dscl_plist_data)
50
+
51
+ Puppet::Provider::NameService::DirectoryService.single_report('resource_name')
52
+ end
54
53
  end
55
- end
56
54
 
57
- describe 'DirectoryService.get_exec_preamble' do
58
- it 'should use plist data' do
59
- Puppet::Provider::NameService::DirectoryService.stubs(:get_ds_path).returns('Users')
55
+ context '.get_exec_preamble' do
56
+ it 'should use plist data' do
57
+ Puppet::Provider::NameService::DirectoryService.stubs(:get_ds_path).returns('Users')
60
58
 
61
- expect(Puppet::Provider::NameService::DirectoryService.get_exec_preamble('-list')).to include("-plist")
59
+ expect(Puppet::Provider::NameService::DirectoryService.get_exec_preamble('-list')).to include("-plist")
60
+ end
62
61
  end
63
- end
64
-
65
- describe 'DirectoryService password behavior' do
66
- # The below is a binary plist containing a ShadowHashData key which CONTAINS
67
- # another binary plist. The nested binary plist contains a 'SALTED-SHA512'
68
- # key that contains a base64 encoded salted-SHA512 password hash...
69
- let (:binary_plist) { "bplist00\324\001\002\003\004\005\006\a\bXCRAM-MD5RNT]SALTED-SHA512[RECOVERABLEO\020 \231k2\3360\200GI\201\355J\216\202\215y\243\001\206J\300\363\032\031\022\006\2359\024\257\217<\361O\020\020F\353\at\377\277\226\276c\306\254\031\037J(\235O\020D\335\006{\3744g@\377z\204\322\r\332t\021\330\n\003\246K\223\356\034!P\261\305t\035\346\352p\206\003n\247MMA\310\301Z<\366\246\023\0161W3\340\357\000\317T\t\301\311+\204\246L7\276\370\320*\245O\021\002\000k\024\221\270x\353\001\237\346D}\377?\265]\356+\243\v[\350\316a\340h\376<\322\266\327\016\306n\272r\t\212A\253L\216\214\205\016\241 [\360/\335\002#\\A\372\241a\261\346\346\\\251\330\312\365\016\n\341\017\016\225&;\322\\\004*\ru\316\372\a \362?8\031\247\231\030\030\267\315\023\v\343{@\227\301s\372h\212\000a\244&\231\366\nt\277\2036,\027bZ+\223W\212g\333`\264\331N\306\307\362\257(^~ b\262\247&\231\261t\341\231%\244\247\203eOt\365\271\201\273\330\350\363C^A\327F\214!\217hgf\e\320k\260n\315u~\336\371M\t\235k\230S\375\311\303\240\351\037d\273\321y\335=K\016`_\317\230\2612_\023K\036\350\v\232\323Y\310\317_\035\227%\237\v\340\023\016\243\233\025\306:\227\351\370\364x\234\231\266\367\016w\275\333-\351\210}\375x\034\262\272kRuHa\362T/F!\347B\231O`K\304\037'k$$\245h)e\363\365mT\b\317\\2\361\026\351\254\375Jl1~\r\371\267\352\2322I\341\272\376\243^Un\266E7\230[VocUJ\220N\2116D/\025f=\213\314\325\vG}\311\360\377DT\307m\261&\263\340\272\243_\020\271rG^BW\210\030l\344\0324\335\233\300\023\272\225Im\330\n\227*Yv[\006\315\330y'\a\321\373\273A\240\305F{S\246I#/\355\2425\031\031GGF\270y\n\331\004\023G@\331\000\361\343\350\264$\032\355_\210y\000\205\342\375\212q\024\004\026W:\205 \363v?\035\270L-\270=\022\323\2003\v\336\277\t\237\356\374\n\267n\003\367\342\330;\371S\326\016`B6@Njm>\240\021%\336\345\002(P\204Yn\3279l\0228\264\254\304\2528t\372h\217\347sA\314\345\245\337)]\000\b\000\021\000\032\000\035\000+\0007\000Z\000m\000\264\000\000\000\000\000\000\002\001\000\000\000\000\000\000\000\t\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\270" }
70
62
 
71
- # The below is a base64 encoded salted-SHA512 password hash.
72
- let (:pw_string) { "\335\006{\3744g@\377z\204\322\r\332t\021\330\n\003\246K\223\356\034!P\261\305t\035\346\352p\206\003n\247MMA\310\301Z<\366\246\023\0161W3\340\357\000\317T\t\301\311+\204\246L7\276\370\320*\245" }
63
+ context 'password behavior' do
64
+ # The below is a binary plist containing a ShadowHashData key which CONTAINS
65
+ # another binary plist. The nested binary plist contains a 'SALTED-SHA512'
66
+ # key that contains a base64 encoded salted-SHA512 password hash...
67
+ let (:binary_plist) { "bplist00\324\001\002\003\004\005\006\a\bXCRAM-MD5RNT]SALTED-SHA512[RECOVERABLEO\020 \231k2\3360\200GI\201\355J\216\202\215y\243\001\206J\300\363\032\031\022\006\2359\024\257\217<\361O\020\020F\353\at\377\277\226\276c\306\254\031\037J(\235O\020D\335\006{\3744g@\377z\204\322\r\332t\021\330\n\003\246K\223\356\034!P\261\305t\035\346\352p\206\003n\247MMA\310\301Z<\366\246\023\0161W3\340\357\000\317T\t\301\311+\204\246L7\276\370\320*\245O\021\002\000k\024\221\270x\353\001\237\346D}\377?\265]\356+\243\v[\350\316a\340h\376<\322\266\327\016\306n\272r\t\212A\253L\216\214\205\016\241 [\360/\335\002#\\A\372\241a\261\346\346\\\251\330\312\365\016\n\341\017\016\225&;\322\\\004*\ru\316\372\a \362?8\031\247\231\030\030\267\315\023\v\343{@\227\301s\372h\212\000a\244&\231\366\nt\277\2036,\027bZ+\223W\212g\333`\264\331N\306\307\362\257(^~ b\262\247&\231\261t\341\231%\244\247\203eOt\365\271\201\273\330\350\363C^A\327F\214!\217hgf\e\320k\260n\315u~\336\371M\t\235k\230S\375\311\303\240\351\037d\273\321y\335=K\016`_\317\230\2612_\023K\036\350\v\232\323Y\310\317_\035\227%\237\v\340\023\016\243\233\025\306:\227\351\370\364x\234\231\266\367\016w\275\333-\351\210}\375x\034\262\272kRuHa\362T/F!\347B\231O`K\304\037'k$$\245h)e\363\365mT\b\317\\2\361\026\351\254\375Jl1~\r\371\267\352\2322I\341\272\376\243^Un\266E7\230[VocUJ\220N\2116D/\025f=\213\314\325\vG}\311\360\377DT\307m\261&\263\340\272\243_\020\271rG^BW\210\030l\344\0324\335\233\300\023\272\225Im\330\n\227*Yv[\006\315\330y'\a\321\373\273A\240\305F{S\246I#/\355\2425\031\031GGF\270y\n\331\004\023G@\331\000\361\343\350\264$\032\355_\210y\000\205\342\375\212q\024\004\026W:\205 \363v?\035\270L-\270=\022\323\2003\v\336\277\t\237\356\374\n\267n\003\367\342\330;\371S\326\016`B6@Njm>\240\021%\336\345\002(P\204Yn\3279l\0228\264\254\304\2528t\372h\217\347sA\314\345\245\337)]\000\b\000\021\000\032\000\035\000+\0007\000Z\000m\000\264\000\000\000\000\000\000\002\001\000\000\000\000\000\000\000\t\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\270" }
73
68
 
74
- # The below is a salted-SHA512 password hash in hex.
75
- let (:sha512_hash) { 'dd067bfc346740ff7a84d20dda7411d80a03a64b93ee1c2150b1c5741de6ea7086036ea74d4d41c8c15a3cf6a6130e315733e0ef00cf5409c1c92b84a64c37bef8d02aa5' }
69
+ # The below is a base64 encoded salted-SHA512 password hash.
70
+ let (:pw_string) { "\335\006{\3744g@\377z\204\322\r\332t\021\330\n\003\246K\223\356\034!P\261\305t\035\346\352p\206\003n\247MMA\310\301Z<\366\246\023\0161W3\340\357\000\317T\t\301\311+\204\246L7\276\370\320*\245" }
76
71
 
77
- let :plist_path do
78
- '/var/db/dslocal/nodes/Default/users/jeff.plist'
79
- end
72
+ # The below is a salted-SHA512 password hash in hex.
73
+ let (:sha512_hash) { 'dd067bfc346740ff7a84d20dda7411d80a03a64b93ee1c2150b1c5741de6ea7086036ea74d4d41c8c15a3cf6a6130e315733e0ef00cf5409c1c92b84a64c37bef8d02aa5' }
80
74
 
81
- let :ds_provider do
82
- Puppet::Provider::NameService::DirectoryService
83
- end
75
+ let :plist_path do
76
+ '/var/db/dslocal/nodes/Default/users/jeff.plist'
77
+ end
84
78
 
85
- let :shadow_hash_data do
86
- {'ShadowHashData' => [binary_plist]}
87
- end
79
+ let :ds_provider do
80
+ described_class
81
+ end
88
82
 
89
- subject do
90
- Puppet::Provider::NameService::DirectoryService
91
- end
83
+ let :shadow_hash_data do
84
+ {'ShadowHashData' => [binary_plist]}
85
+ end
92
86
 
93
- it 'should execute convert_binary_to_hash once when getting the password' do
94
- subject.expects(:convert_binary_to_hash).returns({'SALTED-SHA512' => pw_string})
95
- Puppet::FileSystem.expects(:exist?).with(plist_path).once.returns(true)
96
- Puppet::Util::Plist.expects(:read_plist_file).returns(shadow_hash_data)
97
- subject.get_password('uid', 'jeff')
98
- end
87
+ it 'should execute convert_binary_to_hash once when getting the password' do
88
+ described_class.expects(:convert_binary_to_hash).returns({'SALTED-SHA512' => pw_string})
89
+ Puppet::FileSystem.expects(:exist?).with(plist_path).once.returns(true)
90
+ Puppet::Util::Plist.expects(:read_plist_file).returns(shadow_hash_data)
91
+ described_class.get_password('uid', 'jeff')
92
+ end
99
93
 
100
- it 'should fail if a salted-SHA512 password hash is not passed in' do
101
- expect {
102
- subject.set_password('jeff', 'uid', 'badpassword')
103
- }.to raise_error(RuntimeError, /OS X 10.7 requires a Salted SHA512 hash password of 136 characters./)
104
- end
94
+ it 'should fail if a salted-SHA512 password hash is not passed in' do
95
+ expect {
96
+ described_class.set_password('jeff', 'uid', 'badpassword')
97
+ }.to raise_error(RuntimeError, /OS X 10.7 requires a Salted SHA512 hash password of 136 characters./)
98
+ end
105
99
 
106
- it 'should convert xml-to-binary and binary-to-xml when setting the pw on >= 10.7' do
107
- subject.expects(:convert_binary_to_hash).returns({'SALTED-SHA512' => pw_string})
108
- subject.expects(:convert_hash_to_binary).returns(binary_plist)
109
- Puppet::FileSystem.expects(:exist?).with(plist_path).once.returns(true)
110
- Puppet::Util::Plist.expects(:read_plist_file).returns(shadow_hash_data)
111
- Puppet::Util::Plist.expects(:write_plist_file).with(shadow_hash_data, plist_path, :binary)
112
- subject.set_password('jeff', 'uid', sha512_hash)
113
- end
100
+ it 'should convert xml-to-binary and binary-to-xml when setting the pw on >= 10.7' do
101
+ described_class.expects(:convert_binary_to_hash).returns({'SALTED-SHA512' => pw_string})
102
+ described_class.expects(:convert_hash_to_binary).returns(binary_plist)
103
+ Puppet::FileSystem.expects(:exist?).with(plist_path).once.returns(true)
104
+ Puppet::Util::Plist.expects(:read_plist_file).returns(shadow_hash_data)
105
+ Puppet::Util::Plist.expects(:write_plist_file).with(shadow_hash_data, plist_path, :binary)
106
+ described_class.set_password('jeff', 'uid', sha512_hash)
107
+ end
114
108
 
115
- it '[#13686] should handle an empty ShadowHashData field in the users plist' do
116
- subject.expects(:convert_hash_to_binary).returns(binary_plist)
117
- Puppet::FileSystem.expects(:exist?).with(plist_path).once.returns(true)
118
- Puppet::Util::Plist.expects(:read_plist_file).returns({'ShadowHashData' => nil})
119
- Puppet::Util::Plist.expects(:write_plist_file)
120
- subject.set_password('jeff', 'uid', sha512_hash)
109
+ it '[#13686] should handle an empty ShadowHashData field in the users plist' do
110
+ described_class.expects(:convert_hash_to_binary).returns(binary_plist)
111
+ Puppet::FileSystem.expects(:exist?).with(plist_path).once.returns(true)
112
+ Puppet::Util::Plist.expects(:read_plist_file).returns({'ShadowHashData' => nil})
113
+ Puppet::Util::Plist.expects(:write_plist_file)
114
+ described_class.set_password('jeff', 'uid', sha512_hash)
115
+ end
121
116
  end
122
- end
123
117
 
124
- describe '(#4855) directoryservice group resource failure' do
125
- let :provider_class do
126
- Puppet::Type.type(:group).provider(:directoryservice)
127
- end
118
+ context '(#4855) directoryservice group resource failure' do
119
+ let :provider_class do
120
+ Puppet::Type.type(:group).provider(:directoryservice)
121
+ end
128
122
 
129
- let :group_members do
130
- ['root','jeff']
131
- end
123
+ let :group_members do
124
+ ['root','jeff']
125
+ end
132
126
 
133
- let :user_account do
134
- ['root']
135
- end
127
+ let :user_account do
128
+ ['root']
129
+ end
136
130
 
137
- let :stub_resource do
138
- stub('resource')
139
- end
131
+ let :stub_resource do
132
+ stub('resource')
133
+ end
140
134
 
141
- subject do
142
- provider_class.new(stub_resource)
143
- end
135
+ subject do
136
+ provider_class.new(stub_resource)
137
+ end
144
138
 
145
- before :each do
146
- @resource = stub("resource")
147
- @resource.stubs(:[]).with(:name)
148
- @provider = provider_class.new(@resource)
149
- end
139
+ before :each do
140
+ @resource = stub("resource")
141
+ @resource.stubs(:[]).with(:name)
142
+ @provider = provider_class.new(@resource)
143
+ end
150
144
 
151
- it 'should delete a group member if the user does not exist' do
152
- stub_resource.stubs(:[]).with(:name).returns('fake_group')
153
- stub_resource.stubs(:name).returns('fake_group')
154
- subject.expects(:execute).with([:dseditgroup, '-o', 'edit', '-n', '.',
155
- '-d', 'jeff',
156
- 'fake_group']).raises(Puppet::ExecutionFailure,
157
- 'it broke')
158
- subject.expects(:execute).with([:dscl, '.', '-delete',
159
- '/Groups/fake_group', 'GroupMembership',
160
- 'jeff'])
161
- subject.remove_unwanted_members(group_members, user_account)
145
+ it 'should delete a group member if the user does not exist' do
146
+ stub_resource.stubs(:[]).with(:name).returns('fake_group')
147
+ stub_resource.stubs(:name).returns('fake_group')
148
+ subject.expects(:execute).with([:dseditgroup, '-o', 'edit', '-n', '.',
149
+ '-d', 'jeff',
150
+ 'fake_group']).raises(Puppet::ExecutionFailure,
151
+ 'it broke')
152
+ subject.expects(:execute).with([:dscl, '.', '-delete',
153
+ '/Groups/fake_group', 'GroupMembership',
154
+ 'jeff'])
155
+ subject.remove_unwanted_members(group_members, user_account)
156
+ end
162
157
  end
163
158
  end
164
-
@@ -1,9 +1,6 @@
1
- #! /usr/bin/env ruby
2
1
  require 'spec_helper'
3
2
 
4
- provider_class = Puppet::Type.type(:package).provider(:aix)
5
-
6
- describe provider_class do
3
+ describe Puppet::Type.type(:package).provider(:aix) do
7
4
  before(:each) do
8
5
  # Create a mock resource
9
6
  @resource = Puppet::Type.type(:package).new(:name => 'mypackage', :ensure => :installed, :source => 'mysource', :provider => :aix)
@@ -23,7 +20,7 @@ describe provider_class do
23
20
  @provider.uninstall
24
21
  end
25
22
 
26
- describe "when installing" do
23
+ context "when installing" do
27
24
  it "should install a package" do
28
25
  @provider.expects(:installp).with('-acgwXY', '-d', 'mysource', 'mypackage')
29
26
  @provider.install
@@ -86,7 +83,7 @@ mypackage 1.2.3.3 Already superseded by 1.2.3.4
86
83
  end
87
84
  end
88
85
 
89
- describe "when finding the latest version" do
86
+ context "when finding the latest version" do
90
87
  it "should return the current version when no later version is present" do
91
88
  @provider.stubs(:latest_info).returns(nil)
92
89
  @provider.stubs(:properties).returns( { :ensure => "1.2.3.4" } )
@@ -126,7 +123,7 @@ END
126
123
  latest = Puppet::Type.type(:package).new(:name => 'mypackage', :ensure => :latest, :source => 'mysource', :provider => :aix)
127
124
  absent = Puppet::Type.type(:package).new(:name => 'otherpackage', :ensure => :absent, :provider => :aix)
128
125
  Process.stubs(:euid).returns(0)
129
- provider_class.expects(:execute).returns 'mypackage:mypackage.rte:1.8.6.4::I:T:::::N:A Super Cool Package::::0::\n'
130
- provider_class.prefetch({ 'mypackage' => latest, 'otherpackage' => absent })
126
+ described_class.expects(:execute).returns 'mypackage:mypackage.rte:1.8.6.4::I:T:::::N:A Super Cool Package::::0::\n'
127
+ described_class.prefetch({ 'mypackage' => latest, 'otherpackage' => absent })
131
128
  end
132
129
  end
@@ -1,9 +1,6 @@
1
- #! /usr/bin/env ruby
2
1
  require 'spec_helper'
3
2
 
4
- provider_class = Puppet::Type.type(:package).provider(:apt)
5
-
6
- describe provider_class do
3
+ describe Puppet::Type.type(:package).provider(:apt) do
7
4
  let(:name) { 'asdf' }
8
5
 
9
6
  let(:resource) do
@@ -14,7 +11,7 @@ describe provider_class do
14
11
  end
15
12
 
16
13
  let(:provider) do
17
- provider = provider_class.new
14
+ provider = subject()
18
15
  provider.resource = resource
19
16
  provider
20
17
  end
@@ -25,7 +22,7 @@ describe provider_class do
25
22
  end
26
23
 
27
24
  it "should be versionable" do
28
- expect(provider_class).to be_versionable
25
+ expect(described_class).to be_versionable
29
26
  end
30
27
 
31
28
  it "should use :install to update" do
@@ -3,43 +3,41 @@ require 'spec_helper'
3
3
  # Note that much of the functionality of the dnf provider is already tested with yum provider tests,
4
4
  # as yum is the parent provider.
5
5
 
6
- provider_class = Puppet::Type.type(:package).provider(:dnf)
6
+ describe Puppet::Type.type(:package).provider(:dnf) do
7
+ context 'default' do
8
+ (19..21).each do |ver|
9
+ it "should not be the default provider on fedora#{ver}" do
10
+ Facter.stubs(:value).with(:osfamily).returns(:redhat)
11
+ Facter.stubs(:value).with(:operatingsystem).returns(:fedora)
12
+ Facter.stubs(:value).with(:operatingsystemmajrelease).returns("#{ver}")
13
+ expect(described_class).to_not be_default
14
+ end
15
+ end
7
16
 
8
- context 'default' do
9
- (19..21).each do |ver|
10
- it "should not be the default provider on fedora#{ver}" do
11
- Facter.stubs(:value).with(:osfamily).returns(:redhat)
12
- Facter.stubs(:value).with(:operatingsystem).returns(:fedora)
13
- Facter.stubs(:value).with(:operatingsystemmajrelease).returns("#{ver}")
14
- expect(provider_class).to_not be_default
17
+ (22..26).each do |ver|
18
+ it "should be the default provider on fedora#{ver}" do
19
+ Facter.stubs(:value).with(:osfamily).returns(:redhat)
20
+ Facter.stubs(:value).with(:operatingsystem).returns(:fedora)
21
+ Facter.stubs(:value).with(:operatingsystemmajrelease).returns("#{ver}")
22
+ expect(described_class).to be_default
23
+ end
15
24
  end
16
- end
17
25
 
18
- (22..26).each do |ver|
19
- it "should be the default provider on fedora#{ver}" do
20
- Facter.stubs(:value).with(:osfamily).returns(:redhat)
21
- Facter.stubs(:value).with(:operatingsystem).returns(:fedora)
22
- Facter.stubs(:value).with(:operatingsystemmajrelease).returns("#{ver}")
23
- expect(provider_class).to be_default
26
+ it "should not be the default provider on rhel7" do
27
+ Facter.stubs(:value).with(:osfamily).returns(:redhat)
28
+ Facter.stubs(:value).with(:operatingsystem).returns(:redhat)
29
+ Facter.stubs(:value).with(:operatingsystemmajrelease).returns("7")
30
+ expect(described_class).to_not be_default
24
31
  end
25
- end
26
32
 
27
- it "should not be the default provider on rhel7" do
28
- Facter.stubs(:value).with(:osfamily).returns(:redhat)
29
- Facter.stubs(:value).with(:operatingsystem).returns(:redhat)
30
- Facter.stubs(:value).with(:operatingsystemmajrelease).returns("7")
31
- expect(provider_class).to_not be_default
32
- end
33
+ it "should be the default provider on rhel8" do
34
+ Facter.stubs(:value).with(:osfamily).returns(:redhat)
35
+ Facter.stubs(:value).with(:operatingsystem).returns(:redhat)
36
+ Facter.stubs(:value).with(:operatingsystemmajrelease).returns("8")
37
+ expect(described_class).to be_default
38
+ end
33
39
 
34
- it "should be the default provider on rhel8" do
35
- Facter.stubs(:value).with(:osfamily).returns(:redhat)
36
- Facter.stubs(:value).with(:operatingsystem).returns(:redhat)
37
- Facter.stubs(:value).with(:operatingsystemmajrelease).returns("8")
38
- expect(provider_class).to be_default
39
40
  end
40
41
 
41
- end
42
-
43
- describe provider_class do
44
- it_behaves_like 'RHEL package provider', provider_class, 'dnf'
42
+ it_behaves_like 'RHEL package provider', described_class, 'dnf'
45
43
  end
@@ -1,10 +1,7 @@
1
- #! /usr/bin/env ruby
2
1
  require 'spec_helper'
3
2
  require 'stringio'
4
3
 
5
- provider_class = Puppet::Type.type(:package).provider(:dpkg)
6
-
7
- describe provider_class do
4
+ describe Puppet::Type.type(:package).provider(:dpkg) do
8
5
  let(:bash_version) { '4.2-5ubuntu3' }
9
6
  let(:bash_installed_output) { "install ok installed bash #{bash_version}\n" }
10
7
  let(:bash_installed_io) { StringIO.new(bash_installed_output) }
@@ -16,37 +13,37 @@ describe provider_class do
16
13
  end
17
14
  let(:resource_name) { 'package' }
18
15
  let(:resource) { stub 'resource', :[] => resource_name }
19
- let(:provider) { provider_class.new(resource) }
16
+ let(:provider) { described_class.new(resource) }
20
17
 
21
18
  it "has documentation" do
22
- expect(provider_class.doc).to be_instance_of(String)
19
+ expect(described_class.doc).to be_instance_of(String)
23
20
  end
24
21
 
25
- describe "when listing all instances" do
22
+ context "when listing all instances" do
26
23
  let(:execpipe_args) { args.unshift('myquery') }
27
24
 
28
25
  before do
29
- provider_class.stubs(:command).with(:dpkgquery).returns 'myquery'
26
+ described_class.stubs(:command).with(:dpkgquery).returns 'myquery'
30
27
  end
31
28
 
32
29
  it "creates and return an instance for a single dpkg-query entry" do
33
30
  Puppet::Util::Execution.expects(:execpipe).with(execpipe_args).yields bash_installed_io
34
31
 
35
32
  installed = mock 'bash'
36
- provider_class.expects(:new).with(:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :provider => :dpkg).returns installed
33
+ described_class.expects(:new).with(:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :provider => :dpkg).returns installed
37
34
 
38
- expect(provider_class.instances).to eq([installed])
35
+ expect(described_class.instances).to eq([installed])
39
36
  end
40
37
 
41
38
  it "parses multiple dpkg-query multi-line entries in the output" do
42
39
  Puppet::Util::Execution.expects(:execpipe).with(execpipe_args).yields all_installed_io
43
40
 
44
41
  bash = mock 'bash'
45
- provider_class.expects(:new).with(:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :provider => :dpkg).returns bash
42
+ described_class.expects(:new).with(:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :provider => :dpkg).returns bash
46
43
  vim = mock 'vim'
47
- provider_class.expects(:new).with(:ensure => "2:7.3.547-6ubuntu5", :error => "ok", :desired => "install", :name => "vim", :status => "installed", :provider => :dpkg).returns vim
44
+ described_class.expects(:new).with(:ensure => "2:7.3.547-6ubuntu5", :error => "ok", :desired => "install", :name => "vim", :status => "installed", :provider => :dpkg).returns vim
48
45
 
49
- expect(provider_class.instances).to eq([bash, vim])
46
+ expect(described_class.instances).to eq([bash, vim])
50
47
  end
51
48
 
52
49
  it "continues without failing if it encounters bad lines between good entries" do
@@ -54,13 +51,13 @@ describe provider_class do
54
51
 
55
52
  bash = mock 'bash'
56
53
  vim = mock 'vim'
57
- provider_class.expects(:new).twice.returns(bash, vim)
54
+ described_class.expects(:new).twice.returns(bash, vim)
58
55
 
59
- expect(provider_class.instances).to eq([bash, vim])
56
+ expect(described_class.instances).to eq([bash, vim])
60
57
  end
61
58
  end
62
59
 
63
- describe "when querying the current state" do
60
+ context "when querying the current state" do
64
61
  let(:dpkgquery_path) { '/bin/dpkg-query' }
65
62
  let(:query_args) do
66
63
  args.unshift(dpkgquery_path)
@@ -132,7 +129,7 @@ describe provider_class do
132
129
  expect(provider.query[:ensure]).to eq(:held)
133
130
  end
134
131
 
135
- describe "parsing tests" do
132
+ context "parsing tests" do
136
133
  let(:resource_name) { 'name' }
137
134
  let(:package_hash) do
138
135
  {
@@ -174,7 +171,7 @@ describe provider_class do
174
171
  end
175
172
  end
176
173
 
177
- describe "when installing" do
174
+ context "when installing" do
178
175
  before do
179
176
  resource.stubs(:[]).with(:source).returns "mypkg"
180
177
  end
@@ -216,7 +213,7 @@ describe provider_class do
216
213
  end
217
214
  end
218
215
 
219
- describe "when holding or unholding" do
216
+ context "when holding or unholding" do
220
217
  let(:tempfile) { stub 'tempfile', :print => nil, :close => nil, :flush => nil, :path => "/other/file" }
221
218
 
222
219
  before do
@@ -248,7 +245,7 @@ describe provider_class do
248
245
  provider.update
249
246
  end
250
247
 
251
- describe "when determining latest available version" do
248
+ context "when determining latest available version" do
252
249
  it "returns the version found by dpkg-deb" do
253
250
  resource.expects(:[]).with(:source).returns "myfile"
254
251
  provider.expects(:dpkg_deb).with { |*command| command[-1] == "myfile" }.returns "package\t1.0"
@@ -263,7 +260,7 @@ describe provider_class do
263
260
 
264
261
  it "copes with names containing ++" do
265
262
  resource = stub 'resource', :[] => "package++"
266
- provider = provider_class.new(resource)
263
+ provider = described_class.new(resource)
267
264
  provider.expects(:dpkg_deb).returns "package++\t1.0"
268
265
  expect(provider.latest).to eq("1.0")
269
266
  end