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.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -14
- data/Rakefile +3 -1
- data/ext/solaris/smf/svc-puppetd +8 -1
- data/ext/solaris/smf/svc-puppetmasterd +8 -1
- data/lib/puppet/application/device.rb +45 -29
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/forge.rb +4 -1
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +3 -1
- data/lib/puppet/pops/types/p_timespan_type.rb +2 -2
- data/lib/puppet/pops/types/string_converter.rb +11 -2
- data/lib/puppet/provider/cron/crontab.rb +1 -1
- data/lib/puppet/provider/package/windows/exe_package.rb +13 -0
- data/lib/puppet/provider/package/windows/msi_package.rb +8 -0
- data/lib/puppet/provider/package/windows/package.rb +9 -1
- data/lib/puppet/provider/parsedfile.rb +25 -4
- data/lib/puppet/provider/service/smf.rb +54 -0
- data/lib/puppet/transaction.rb +4 -1
- data/lib/puppet/transaction/event_manager.rb +13 -1
- data/lib/puppet/transaction/resource_harness.rb +3 -1
- data/lib/puppet/util/command_line.rb +2 -3
- data/lib/puppet/util/filetype.rb +36 -4
- data/lib/puppet/util/selinux.rb +1 -1
- data/lib/puppet/util/windows/api_types.rb +1 -1
- data/lib/puppet/util/windows/registry.rb +29 -5
- data/lib/puppet/util/windows/service.rb +106 -99
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +97 -69
- data/man/man5/puppet.conf.5 +2 -2
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-ca.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-cert.8 +1 -1
- data/man/man8/puppet-certificate.8 +1 -1
- data/man/man8/puppet-certificate_request.8 +1 -1
- data/man/man8/puppet-certificate_revocation_list.8 +1 -1
- data/man/man8/puppet-config.8 +2 -2
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +23 -19
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-master.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/unit/provider/service/smf/svcs_fmri.out +6 -0
- data/spec/fixtures/unit/provider/service/smf/svcs_multiple_fmris.out +13 -0
- data/spec/integration/ssl/key_spec.rb +0 -4
- data/spec/integration/transaction_spec.rb +1 -1
- data/spec/integration/util/windows/registry_spec.rb +39 -0
- data/spec/unit/application/device_spec.rb +4 -1
- data/spec/unit/application/lookup_spec.rb +10 -9
- data/spec/unit/forge/forge_spec.rb +4 -2
- data/spec/unit/indirector/yaml_spec.rb +1 -1
- data/spec/unit/pops/loaders/loader_spec.rb +6 -7
- data/spec/unit/pops/types/p_timespan_type_spec.rb +22 -0
- data/spec/unit/pops/types/p_timestamp_type_spec.rb +19 -0
- data/spec/unit/pops/types/string_converter_spec.rb +20 -0
- data/spec/unit/provider/cron/parsed_spec.rb +4 -3
- data/spec/unit/provider/group/ldap_spec.rb +22 -25
- data/spec/unit/provider/group/pw_spec.rb +7 -10
- data/spec/unit/provider/host/parsed_spec.rb +3 -17
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +97 -103
- data/spec/unit/provider/package/aix_spec.rb +5 -8
- data/spec/unit/provider/package/apt_spec.rb +3 -6
- data/spec/unit/provider/package/dnf_spec.rb +29 -31
- data/spec/unit/provider/package/dpkg_spec.rb +18 -21
- data/spec/unit/provider/package/freebsd_spec.rb +4 -7
- data/spec/unit/provider/package/gem_spec.rb +41 -41
- data/spec/unit/provider/package/hpux_spec.rb +7 -10
- data/spec/unit/provider/package/macports_spec.rb +13 -15
- data/spec/unit/provider/package/nim_spec.rb +3 -10
- data/spec/unit/provider/package/openbsd_spec.rb +14 -17
- data/spec/unit/provider/package/pip3_spec.rb +3 -6
- data/spec/unit/provider/package/pip_spec.rb +44 -72
- data/spec/unit/provider/package/pkgin_spec.rb +13 -18
- data/spec/unit/provider/package/pkgng_spec.rb +21 -24
- data/spec/unit/provider/package/puppet_gem_spec.rb +6 -9
- data/spec/unit/provider/package/tdnf_spec.rb +9 -12
- data/spec/unit/provider/package/yum_spec.rb +29 -15
- data/spec/unit/provider/package/zypper_spec.rb +17 -19
- data/spec/unit/provider/service/bsd_spec.rb +8 -12
- data/spec/unit/provider/service/daemontools_spec.rb +12 -20
- data/spec/unit/provider/service/debian_spec.rb +8 -16
- data/spec/unit/provider/service/freebsd_spec.rb +2 -5
- data/spec/unit/provider/service/openbsd_spec.rb +12 -18
- data/spec/unit/provider/service/rcng_spec.rb +3 -7
- data/spec/unit/provider/service/redhat_spec.rb +21 -23
- data/spec/unit/provider/service/runit_spec.rb +9 -19
- data/spec/unit/provider/service/smf_spec.rb +82 -21
- data/spec/unit/provider/service/src_spec.rb +14 -23
- data/spec/unit/provider/user/hpux_spec.rb +2 -5
- data/spec/unit/provider/user/ldap_spec.rb +29 -32
- data/spec/unit/provider/user/pw_spec.rb +10 -13
- data/spec/unit/ssl/key_spec.rb +2 -4
- data/spec/unit/transaction/event_manager_spec.rb +12 -1
- data/spec/unit/transaction/resource_harness_spec.rb +18 -0
- data/spec/unit/transaction_spec.rb +25 -0
- data/spec/unit/util/filetype_spec.rb +13 -5
- data/spec/unit/util/logging_spec.rb +0 -41
- data/spec/unit/util/monkey_patches_spec.rb +18 -5
- data/spec/unit/util/selinux_spec.rb +4 -0
- 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
|
-
|
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 =
|
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
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
-
|
58
|
-
|
59
|
-
|
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
|
-
|
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
|
-
|
72
|
-
|
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
|
-
|
75
|
-
|
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
|
-
|
78
|
-
'
|
79
|
-
end
|
72
|
+
# The below is a salted-SHA512 password hash in hex.
|
73
|
+
let (:sha512_hash) { 'dd067bfc346740ff7a84d20dda7411d80a03a64b93ee1c2150b1c5741de6ea7086036ea74d4d41c8c15a3cf6a6130e315733e0ef00cf5409c1c92b84a64c37bef8d02aa5' }
|
80
74
|
|
81
|
-
|
82
|
-
|
83
|
-
|
75
|
+
let :plist_path do
|
76
|
+
'/var/db/dslocal/nodes/Default/users/jeff.plist'
|
77
|
+
end
|
84
78
|
|
85
|
-
|
86
|
-
|
87
|
-
|
79
|
+
let :ds_provider do
|
80
|
+
described_class
|
81
|
+
end
|
88
82
|
|
89
|
-
|
90
|
-
|
91
|
-
|
83
|
+
let :shadow_hash_data do
|
84
|
+
{'ShadowHashData' => [binary_plist]}
|
85
|
+
end
|
92
86
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
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
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
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
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
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
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
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
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
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
|
-
|
130
|
-
|
131
|
-
|
123
|
+
let :group_members do
|
124
|
+
['root','jeff']
|
125
|
+
end
|
132
126
|
|
133
|
-
|
134
|
-
|
135
|
-
|
127
|
+
let :user_account do
|
128
|
+
['root']
|
129
|
+
end
|
136
130
|
|
137
|
-
|
138
|
-
|
139
|
-
|
131
|
+
let :stub_resource do
|
132
|
+
stub('resource')
|
133
|
+
end
|
140
134
|
|
141
|
-
|
142
|
-
|
143
|
-
|
135
|
+
subject do
|
136
|
+
provider_class.new(stub_resource)
|
137
|
+
end
|
144
138
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
139
|
+
before :each do
|
140
|
+
@resource = stub("resource")
|
141
|
+
@resource.stubs(:[]).with(:name)
|
142
|
+
@provider = provider_class.new(@resource)
|
143
|
+
end
|
150
144
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
130
|
-
|
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
|
-
|
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 =
|
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(
|
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
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
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
|
-
|
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) {
|
16
|
+
let(:provider) { described_class.new(resource) }
|
20
17
|
|
21
18
|
it "has documentation" do
|
22
|
-
expect(
|
19
|
+
expect(described_class.doc).to be_instance_of(String)
|
23
20
|
end
|
24
21
|
|
25
|
-
|
22
|
+
context "when listing all instances" do
|
26
23
|
let(:execpipe_args) { args.unshift('myquery') }
|
27
24
|
|
28
25
|
before do
|
29
|
-
|
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
|
-
|
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(
|
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
|
-
|
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
|
-
|
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(
|
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
|
-
|
54
|
+
described_class.expects(:new).twice.returns(bash, vim)
|
58
55
|
|
59
|
-
expect(
|
56
|
+
expect(described_class.instances).to eq([bash, vim])
|
60
57
|
end
|
61
58
|
end
|
62
59
|
|
63
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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 =
|
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
|