puppet 5.5.7-universal-darwin → 5.5.8-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 +2 -2
- data/Rakefile +2 -1
- data/lib/puppet/defaults.rb +4 -2
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/file_bucket/dipper.rb +1 -1
- data/lib/puppet/functions.rb +0 -123
- data/lib/puppet/loaders.rb +0 -1
- data/lib/puppet/parser/functions.rb +1 -3
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +0 -16
- data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -3
- data/lib/puppet/pops/loader/loader.rb +1 -1
- data/lib/puppet/pops/loader/loader_paths.rb +1 -3
- data/lib/puppet/pops/loader/module_loaders.rb +1 -1
- data/lib/puppet/pops/loaders.rb +21 -5
- data/lib/puppet/provider/group/aix.rb +31 -1
- data/lib/puppet/provider/group/pw.rb +8 -4
- data/lib/puppet/provider/group/windows_adsi.rb +4 -3
- data/lib/puppet/provider/nameservice/directoryservice.rb +3 -5
- data/lib/puppet/provider/package/dnf.rb +1 -0
- data/lib/puppet/provider/user/useradd.rb +2 -10
- data/lib/puppet/type/group.rb +41 -57
- data/lib/puppet/util/filetype.rb +21 -5
- data/lib/puppet/util/log/destinations.rb +3 -2
- data/lib/puppet/util/windows/adsi.rb +0 -2
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +76 -92
- data/man/man5/puppet.conf.5 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet.8 +1 -1
- data/spec/integration/util/windows/adsi_spec.rb +1 -2
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +6 -6
- data/spec/unit/pops/loaders/loaders_spec.rb +7 -39
- data/spec/unit/provider/cron/parsed_spec.rb +7 -9
- data/spec/unit/provider/group/aix_spec.rb +33 -0
- data/spec/unit/provider/group/pw_spec.rb +6 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +33 -23
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +2 -2
- data/spec/unit/provider/package/dnf_spec.rb +15 -0
- data/spec/unit/provider/user/useradd_spec.rb +2 -2
- data/spec/unit/type/group_spec.rb +18 -108
- data/spec/unit/util/log/destinations_spec.rb +10 -0
- data/spec/unit/util/suidmanager_spec.rb +1 -3
- data/spec/unit/util/windows/adsi_spec.rb +5 -5
- metadata +2 -3
- data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +0 -62
data/man/man5/puppet.conf.5
CHANGED
@@ -938,7 +938,7 @@ The time to wait for one block to be read from an HTTP connection\. If nothing i
|
|
938
938
|
The HTTP User\-Agent string to send when making network requests\.
|
939
939
|
.
|
940
940
|
.IP "\(bu" 4
|
941
|
-
\fIDefault\fR: Puppet/5\.5\.
|
941
|
+
\fIDefault\fR: Puppet/5\.5\.8 Ruby/2\.4\.1\-p111 (x86_64\-linux)
|
942
942
|
.
|
943
943
|
.IP "" 0
|
944
944
|
.
|
data/man/man8/puppet-config.8
CHANGED
@@ -47,7 +47,7 @@ Less commonly used is the \'user\' section, which affects puppet apply\. Any oth
|
|
47
47
|
\fBSYNOPSIS\fR
|
48
48
|
.
|
49
49
|
.IP
|
50
|
-
puppet config delete [\-\-section SECTION_NAME]
|
50
|
+
puppet config delete [\-\-section SECTION_NAME] \fIsetting\fR
|
51
51
|
.
|
52
52
|
.IP
|
53
53
|
\fBDESCRIPTION\fR
|
data/man/man8/puppet.8
CHANGED
@@ -16,4 +16,4 @@ Available subcommands:
|
|
16
16
|
agent The puppet agent daemon apply Apply Puppet manifests locally ca Local Puppet Certificate Authority management\. (Deprecated) catalog Compile, save, view, and convert catalogs\. cert Manage certificates and requests (Deprecated) certificate Provide access to the CA for certificate management\. (Deprecated) certificate_request Manage certificate requests\. (Deprecated) certificate_revocation_list Manage the list of revoked certificates\. (Deprecated) config Interact with Puppet\'s settings\. describe Display help about resource types device Manage remote network devices doc Generate Puppet references epp Interact directly with the EPP template parser/renderer\. facts Retrieve and store facts\. filebucket Store and retrieve files in a filebucket generate Generates Puppet code from Ruby definitions\. help Display Puppet help\. key Create, save, and remove certificate keys\. (Deprecated) lookup Interactive Hiera lookup man Display Puppet manual pages\. (Deprecated) master The puppet master daemon module Creates, installs and searches for modules on the Puppet Forge\. node View and manage node definitions\. parser Interact directly with the parser\. plugin Interact with the Puppet plugin system\. report Create, display, and submit reports\. resource The resource abstraction layer shell script Run a puppet manifests as a script without compiling a catalog status View puppet server status\. (Deprecated)
|
17
17
|
.
|
18
18
|
.P
|
19
|
-
See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v5\.5\.
|
19
|
+
See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v5\.5\.8
|
@@ -118,8 +118,7 @@ describe Puppet::Util::Windows::ADSI::Group,
|
|
118
118
|
# create a test group and add above 5 members by SID
|
119
119
|
group = described_class.create(temp_groupname)
|
120
120
|
group.commit()
|
121
|
-
|
122
|
-
group.set_members(members.join(','))
|
121
|
+
group.set_members(users.map { |u| u[:sid]} )
|
123
122
|
|
124
123
|
# most importantly make sure that all name are convertible to SIDs
|
125
124
|
expect { described_class.name_sid_hash(group.members) }.to_not raise_error
|
@@ -1102,15 +1102,15 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
|
|
1102
1102
|
end
|
1103
1103
|
|
1104
1104
|
it 'does not map :undef to empty string in arrays' do
|
1105
|
-
Puppet::Parser::Functions.newfunction("bazinga", :type => :rvalue) { |args| args[0][0]
|
1106
|
-
expect(parser.evaluate_string(scope, "$a = {} $b = [$a[nope]] bazinga($b)", __FILE__)).to eq(
|
1107
|
-
expect(parser.evaluate_string(scope, "bazinga([undef])", __FILE__)).to eq(
|
1105
|
+
Puppet::Parser::Functions.newfunction("bazinga", :type => :rvalue) { |args| args[0][0] }
|
1106
|
+
expect(parser.evaluate_string(scope, "$a = {} $b = [$a[nope]] bazinga($b)", __FILE__)).to eq(:undef)
|
1107
|
+
expect(parser.evaluate_string(scope, "bazinga([undef])", __FILE__)).to eq(:undef)
|
1108
1108
|
end
|
1109
1109
|
|
1110
1110
|
it 'does not map :undef to empty string in hashes' do
|
1111
|
-
Puppet::Parser::Functions.newfunction("bazinga", :type => :rvalue) { |args| args[0]['a']
|
1112
|
-
expect(parser.evaluate_string(scope, "$a = {} $b = {a => $a[nope]} bazinga($b)", __FILE__)).to eq(
|
1113
|
-
expect(parser.evaluate_string(scope, "bazinga({a => undef})", __FILE__)).to eq(
|
1111
|
+
Puppet::Parser::Functions.newfunction("bazinga", :type => :rvalue) { |args| args[0]['a'] }
|
1112
|
+
expect(parser.evaluate_string(scope, "$a = {} $b = {a => $a[nope]} bazinga($b)", __FILE__)).to eq(:undef)
|
1113
|
+
expect(parser.evaluate_string(scope, "bazinga({a => undef})", __FILE__)).to eq(:undef)
|
1114
1114
|
end
|
1115
1115
|
end
|
1116
1116
|
end
|
@@ -271,10 +271,7 @@ describe 'loaders' do
|
|
271
271
|
File.stubs(:read).with(usee_metadata_path, {:encoding => 'utf-8'}).raises Errno::ENOENT
|
272
272
|
File.stubs(:read).with(usee2_metadata_path, {:encoding => 'utf-8'}).raises Errno::ENOENT
|
273
273
|
Puppet[:code] = "$case_number = #{case_number}\ninclude ::user"
|
274
|
-
|
275
|
-
resource = catalog.resource('Notify', "case_#{case_number}")
|
276
|
-
expect(resource).not_to be_nil
|
277
|
-
expect(resource['message']).to eq(desc[:expects])
|
274
|
+
expect { compiler.compile }.to raise_error(Puppet::Error, /Unknown function/)
|
278
275
|
end
|
279
276
|
end
|
280
277
|
end
|
@@ -414,35 +411,6 @@ describe 'loaders' do
|
|
414
411
|
|
415
412
|
end
|
416
413
|
|
417
|
-
context 'when causing a 3x load followed by a 4x load' do
|
418
|
-
let(:env) { environment_for(mix_4x_and_3x_functions) }
|
419
|
-
let(:compiler) { Puppet::Parser::Compiler.new(Puppet::Node.new("test", :environment => env)) }
|
420
|
-
let(:scope) { compiler.topscope }
|
421
|
-
let(:loader) { compiler.loaders.private_loader_for_module('user') }
|
422
|
-
|
423
|
-
|
424
|
-
before(:each) do
|
425
|
-
Puppet.push_context(:current_environment => scope.environment, :global_scope => scope, :loaders => compiler.loaders)
|
426
|
-
end
|
427
|
-
after(:each) do
|
428
|
-
Puppet.pop_context
|
429
|
-
end
|
430
|
-
|
431
|
-
it 'a 3x function is loaded once' do
|
432
|
-
# create a 3x function that when called will do a load of "callee_ws"
|
433
|
-
Puppet::Parser::Functions::newfunction(:callee, :type => :rvalue, :arity => 1) do |args|
|
434
|
-
function_callee_ws(['passed in scope'])
|
435
|
-
end
|
436
|
-
Puppet.expects(:warning).with(any_parameters).never
|
437
|
-
scope['passed_in_scope'] = 'value'
|
438
|
-
function = loader.load_typed(typed_name(:function, 'callee')).value
|
439
|
-
expect(function.call(scope, 'passed in scope')).to eql("usee::callee_ws() got 'value'")
|
440
|
-
|
441
|
-
function = loader.load_typed(typed_name(:function, 'callee_ws')).value
|
442
|
-
expect(function.call(scope, 'passed in scope')).to eql("usee::callee_ws() got 'value'")
|
443
|
-
end
|
444
|
-
end
|
445
|
-
|
446
414
|
context 'loading' do
|
447
415
|
let(:env_name) { 'testenv' }
|
448
416
|
let(:environments_dir) { Puppet[:environmentpath] }
|
@@ -609,22 +577,22 @@ describe 'loaders' do
|
|
609
577
|
expect(type).to be_a(Puppet::Pops::Types::PIntegerType)
|
610
578
|
end
|
611
579
|
|
612
|
-
it 'will resolve implicit transitive dependencies, a -> c' do
|
580
|
+
it 'will not resolve implicit transitive dependencies, a -> c' do
|
613
581
|
type = Puppet::Pops::Types::TypeParser.singleton.parse('A::N', Puppet::Pops::Loaders.find_loader('a'))
|
614
582
|
expect(type).to be_a(Puppet::Pops::Types::PTypeAliasType)
|
615
583
|
expect(type.name).to eql('A::N')
|
616
584
|
type = type.resolved_type
|
617
|
-
expect(type).to be_a(Puppet::Pops::Types::
|
618
|
-
expect(type.
|
585
|
+
expect(type).to be_a(Puppet::Pops::Types::PTypeReferenceType)
|
586
|
+
expect(type.type_string).to eql('C::C')
|
619
587
|
end
|
620
588
|
|
621
|
-
it 'will resolve reverse dependencies, b -> a' do
|
589
|
+
it 'will not resolve reverse dependencies, b -> a' do
|
622
590
|
type = Puppet::Pops::Types::TypeParser.singleton.parse('B::X', Puppet::Pops::Loaders.find_loader('b'))
|
623
591
|
expect(type).to be_a(Puppet::Pops::Types::PTypeAliasType)
|
624
592
|
expect(type.name).to eql('B::X')
|
625
593
|
type = type.resolved_type
|
626
|
-
expect(type).to be_a(Puppet::Pops::Types::
|
627
|
-
expect(type.
|
594
|
+
expect(type).to be_a(Puppet::Pops::Types::PTypeReferenceType)
|
595
|
+
expect(type.type_string).to eql('A::A')
|
628
596
|
end
|
629
597
|
|
630
598
|
it 'does not resolve init_typeset when more qualified type is found in typeset' do
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/env
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
@@ -209,20 +209,18 @@ describe Puppet::Type.type(:cron).provider(:crontab) do
|
|
209
209
|
end
|
210
210
|
|
211
211
|
it "should contain no resources for a user who has no crontab" do
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
described_class.target_object('foobar').expects(:`).with('crontab -u foobar -l 2>/dev/null').returns ""
|
212
|
+
Puppet::Util::Execution.expects(:execute)
|
213
|
+
.with('crontab -u foobar -l', { failonfail: true, combine: true })
|
214
|
+
.returns("")
|
216
215
|
expect(described_class.instances.select { |resource|
|
217
216
|
resource.get('target') == 'foobar'
|
218
217
|
}).to be_empty
|
219
218
|
end
|
220
219
|
|
221
220
|
it "should contain no resources for a user who is absent" do
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
described_class.target_object('foobar').expects(:`).with('crontab -u foobar -l 2>/dev/null').returns ""
|
221
|
+
Puppet::Util::Execution.expects(:execute)
|
222
|
+
.with('crontab -u foobar -l', { failonfail: true, combine: true })
|
223
|
+
.returns("")
|
226
224
|
expect(described_class.instances.select { |resource|
|
227
225
|
resource.get('target') == 'foobar'
|
228
226
|
}).to be_empty
|
@@ -54,4 +54,37 @@ describe 'Puppet::Type::Group::Provider::Aix' do
|
|
54
54
|
expect(provider_class.find(1, ia_module_args)).to eql(expected_group)
|
55
55
|
end
|
56
56
|
end
|
57
|
+
|
58
|
+
describe '.users_to_members' do
|
59
|
+
it 'converts the users attribute to the members property' do
|
60
|
+
expect(provider_class.users_to_members('foo,bar'))
|
61
|
+
.to eql(['foo', 'bar'])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '.members_to_users' do
|
66
|
+
context 'when auth_membership == true' do
|
67
|
+
before(:each) do
|
68
|
+
resource[:auth_membership] = true
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'returns only the passed-in members' do
|
72
|
+
expect(provider_class.members_to_users(provider, ['user1', 'user2']))
|
73
|
+
.to eql('user1,user2')
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'when auth_membership == false' do
|
78
|
+
before(:each) do
|
79
|
+
resource[:auth_membership] = false
|
80
|
+
|
81
|
+
provider.stubs(:members).returns(['user3', 'user1'])
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'adds the passed-in members to the current list of members, filtering out any duplicates' do
|
85
|
+
expect(provider_class.members_to_users(provider, ['user1', 'user2']))
|
86
|
+
.to eql('user1,user2,user3')
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
57
90
|
end
|
@@ -71,5 +71,11 @@ describe provider_class do
|
|
71
71
|
provider.expects(:execute).with(all_of(includes("-M"), includes("user2")), has_entry(:custom_environment, {}))
|
72
72
|
provider.members = "user2"
|
73
73
|
end
|
74
|
+
|
75
|
+
it "should use -M with all the given users when the members property is changed with an array" do
|
76
|
+
resource[:members] = ["user1", "user2"]
|
77
|
+
provider.expects(:execute).with(all_of(includes("-M"), includes("user3,user4")), has_entry(:custom_environment, {}))
|
78
|
+
provider.members = ["user3", "user4"]
|
79
|
+
end
|
74
80
|
end
|
75
81
|
end
|
@@ -50,7 +50,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
50
50
|
it "should return true for same lists of members" do
|
51
51
|
current = [
|
52
52
|
'user1',
|
53
|
-
'user2'
|
53
|
+
'user2',
|
54
54
|
]
|
55
55
|
expect(provider.members_insync?(current, ['user1', 'user2'])).to be_truthy
|
56
56
|
end
|
@@ -58,7 +58,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
58
58
|
it "should return true for same lists of unordered members" do
|
59
59
|
current = [
|
60
60
|
'user1',
|
61
|
-
'user2'
|
61
|
+
'user2',
|
62
62
|
]
|
63
63
|
expect(provider.members_insync?(current, ['user2', 'user1'])).to be_truthy
|
64
64
|
end
|
@@ -67,7 +67,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
67
67
|
current = [
|
68
68
|
'user1',
|
69
69
|
'user2',
|
70
|
-
'user2'
|
70
|
+
'user2',
|
71
71
|
]
|
72
72
|
expect(provider.members_insync?(current, ['user2', 'user1', 'user1'])).to be_truthy
|
73
73
|
end
|
@@ -93,7 +93,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
93
93
|
current = [
|
94
94
|
'user1',
|
95
95
|
'user2',
|
96
|
-
'user3'
|
96
|
+
'user3',
|
97
97
|
]
|
98
98
|
expect(provider.members_insync?(current, ['user3', 'user1', 'user2'])).to be_truthy
|
99
99
|
end
|
@@ -104,21 +104,21 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
104
104
|
|
105
105
|
it "should return false when should is nil" do
|
106
106
|
current = [
|
107
|
-
'user1'
|
107
|
+
'user1',
|
108
108
|
]
|
109
109
|
expect(provider.members_insync?(current, nil)).to be_falsey
|
110
110
|
end
|
111
111
|
|
112
112
|
it "should return false when current contains different users than should" do
|
113
113
|
current = [
|
114
|
-
'user1'
|
114
|
+
'user1',
|
115
115
|
]
|
116
116
|
expect(provider.members_insync?(current, ['user2'])).to be_falsey
|
117
117
|
end
|
118
118
|
|
119
119
|
it "should return false when current contains members and should is empty" do
|
120
120
|
current = [
|
121
|
-
'user1'
|
121
|
+
'user1',
|
122
122
|
]
|
123
123
|
expect(provider.members_insync?(current, [])).to be_falsey
|
124
124
|
end
|
@@ -130,7 +130,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
130
130
|
it "should return false when should user(s) are not the only items in the current" do
|
131
131
|
current = [
|
132
132
|
'user1',
|
133
|
-
'user2'
|
133
|
+
'user2',
|
134
134
|
]
|
135
135
|
expect(provider.members_insync?(current, ['user1'])).to be_falsey
|
136
136
|
end
|
@@ -138,7 +138,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
138
138
|
it "should return false when current user(s) is not empty and should is an empty list" do
|
139
139
|
current = [
|
140
140
|
'user1',
|
141
|
-
'user2'
|
141
|
+
'user2',
|
142
142
|
]
|
143
143
|
expect(provider.members_insync?(current, [])).to be_falsey
|
144
144
|
end
|
@@ -156,21 +156,21 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
156
156
|
|
157
157
|
it "should return true when should is nil" do
|
158
158
|
current = [
|
159
|
-
'user1'
|
159
|
+
'user1',
|
160
160
|
]
|
161
161
|
expect(provider.members_insync?(current, nil)).to be_truthy
|
162
162
|
end
|
163
163
|
|
164
164
|
it "should return false when current contains different users than should" do
|
165
165
|
current = [
|
166
|
-
'user1'
|
166
|
+
'user1',
|
167
167
|
]
|
168
168
|
expect(provider.members_insync?(current, ['user2'])).to be_falsey
|
169
169
|
end
|
170
170
|
|
171
171
|
it "should return true when current contains members and should is empty" do
|
172
172
|
current = [
|
173
|
-
'user1'
|
173
|
+
'user1',
|
174
174
|
]
|
175
175
|
expect(provider.members_insync?(current, [])).to be_truthy
|
176
176
|
end
|
@@ -182,7 +182,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
182
182
|
it "should return true when current user(s) contains at least the should list" do
|
183
183
|
current = [
|
184
184
|
'user1',
|
185
|
-
'user2'
|
185
|
+
'user2',
|
186
186
|
]
|
187
187
|
expect(provider.members_insync?(current, ['user1'])).to be_truthy
|
188
188
|
end
|
@@ -190,7 +190,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
190
190
|
it "should return true when current user(s) is not empty and should is an empty list" do
|
191
191
|
current = [
|
192
192
|
'user1',
|
193
|
-
'user2'
|
193
|
+
'user2',
|
194
194
|
]
|
195
195
|
expect(provider.members_insync?(current, [])).to be_truthy
|
196
196
|
end
|
@@ -199,7 +199,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
199
199
|
current = [
|
200
200
|
'user3',
|
201
201
|
'user1',
|
202
|
-
'user2'
|
202
|
+
'user2',
|
203
203
|
]
|
204
204
|
expect(provider.members_insync?(current, ['user2','user1'])).to be_truthy
|
205
205
|
end
|
@@ -232,20 +232,31 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
232
232
|
end
|
233
233
|
|
234
234
|
describe "when managing members" do
|
235
|
+
let(:user1) { stub(:account => 'user1', :domain => '.', :sid => 'user1sid') }
|
236
|
+
let(:user2) { stub(:account => 'user2', :domain => '.', :sid => 'user2sid') }
|
237
|
+
let(:user3) { stub(:account => 'user3', :domain => '.', :sid => 'user3sid') }
|
238
|
+
|
235
239
|
before :each do
|
240
|
+
Puppet::Util::Windows::SID.stubs(:name_to_principal).with('user1').returns(user1)
|
241
|
+
Puppet::Util::Windows::SID.stubs(:name_to_principal).with('user2').returns(user2)
|
242
|
+
Puppet::Util::Windows::SID.stubs(:name_to_principal).with('user3').returns(user3)
|
243
|
+
|
236
244
|
resource[:auth_membership] = true
|
237
245
|
end
|
238
246
|
|
239
247
|
it "should be able to provide a list of members" do
|
240
|
-
provider.group.stubs(:members).returns [
|
241
|
-
|
242
|
-
|
243
|
-
|
248
|
+
provider.group.stubs(:members).returns [
|
249
|
+
'user1',
|
250
|
+
'user2',
|
251
|
+
'user3',
|
252
|
+
]
|
244
253
|
|
245
|
-
expect(provider.members).to match_array([
|
254
|
+
expect(provider.members).to match_array([user1.sid, user2.sid, user3.sid])
|
246
255
|
end
|
247
256
|
|
248
257
|
it "should be able to set group members" do
|
258
|
+
provider.group.stubs(:members).returns ['user1', 'user2']
|
259
|
+
|
249
260
|
member_sids = [
|
250
261
|
stub(:account => 'user1', :domain => 'testcomputername', :sid => 1),
|
251
262
|
stub(:account => 'user2', :domain => 'testcomputername', :sid => 2),
|
@@ -260,7 +271,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
260
271
|
provider.group.expects(:remove_member_sids).with(member_sids[0])
|
261
272
|
provider.group.expects(:add_member_sids).with(member_sids[2])
|
262
273
|
|
263
|
-
provider.members = 'user2,user3'
|
274
|
+
provider.members = ['user2', 'user3']
|
264
275
|
end
|
265
276
|
end
|
266
277
|
|
@@ -269,13 +280,12 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
269
280
|
resource[:members] = ['user1', 'user2']
|
270
281
|
|
271
282
|
group = stub 'group'
|
272
|
-
group.stubs(:members).returns([])
|
273
283
|
Puppet::Util::Windows::ADSI::Group.expects(:create).with('testers').returns group
|
274
284
|
|
275
285
|
create = sequence('create')
|
276
286
|
group.expects(:commit).in_sequence(create)
|
277
287
|
# due to PUP-1967, defaultto false will set the default to nil
|
278
|
-
group.expects(:set_members).with('user1,user2', nil).in_sequence(create)
|
288
|
+
group.expects(:set_members).with(['user1', 'user2'], nil).in_sequence(create)
|
279
289
|
|
280
290
|
provider.create
|
281
291
|
end
|
@@ -17,13 +17,13 @@ end
|
|
17
17
|
|
18
18
|
it "[#6009] should handle nested arrays of members" do
|
19
19
|
current = ["foo", "bar", "baz"]
|
20
|
-
desired = "foo,quux,qorp"
|
20
|
+
desired = ["foo", ["quux"], "qorp"]
|
21
21
|
group = 'example'
|
22
22
|
|
23
23
|
@resource.stubs(:[]).with(:name).returns(group)
|
24
24
|
@resource.stubs(:[]).with(:auth_membership).returns(true)
|
25
25
|
@provider.instance_variable_set(:@property_value_cache_hash,
|
26
|
-
{ :members => current
|
26
|
+
{ :members => current })
|
27
27
|
|
28
28
|
%w{bar baz}.each do |del|
|
29
29
|
@provider.expects(:execute).once.
|
@@ -23,6 +23,21 @@ context 'default' do
|
|
23
23
|
expect(provider_class).to be_default
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
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
|
+
|
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
|
+
end
|
40
|
+
|
26
41
|
end
|
27
42
|
|
28
43
|
describe provider_class do
|
@@ -138,10 +138,10 @@ describe Puppet::Type.type(:user).provider(:useradd) do
|
|
138
138
|
provider.create
|
139
139
|
end
|
140
140
|
|
141
|
-
it "should not use -e with luseradd, should call
|
141
|
+
it "should not use -e with luseradd, should call usermod with -e after luseradd when expiry is set" do
|
142
142
|
resource[:expiry] = '2038-01-24'
|
143
143
|
provider.expects(:execute).with(all_of(includes('/usr/sbin/luseradd'), Not(includes('-e'))), has_entry(:custom_environment, has_key('LIBUSER_CONF')))
|
144
|
-
provider.expects(:execute).with(all_of(includes('/usr/sbin/
|
144
|
+
provider.expects(:execute).with(all_of(includes('/usr/sbin/usermod'), includes('-e')), has_entry(:custom_environment, has_key('LIBUSER_CONF')))
|
145
145
|
provider.create
|
146
146
|
end
|
147
147
|
|