puppet 6.0.3-universal-darwin → 6.0.4-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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/Rakefile +2 -1
  4. data/lib/puppet/face/config.rb +1 -1
  5. data/lib/puppet/file_bucket/dipper.rb +1 -1
  6. data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +3 -2
  7. data/lib/puppet/provider/group/aix.rb +31 -1
  8. data/lib/puppet/provider/group/pw.rb +8 -4
  9. data/lib/puppet/provider/group/windows_adsi.rb +4 -3
  10. data/lib/puppet/provider/nameservice/directoryservice.rb +3 -5
  11. data/lib/puppet/provider/package/dnf.rb +1 -0
  12. data/lib/puppet/type/group.rb +41 -57
  13. data/lib/puppet/util/filetype.rb +21 -5
  14. data/lib/puppet/util/log/destinations.rb +3 -2
  15. data/lib/puppet/util/windows/adsi.rb +0 -2
  16. data/lib/puppet/version.rb +1 -1
  17. data/locales/puppet.pot +28 -39
  18. data/man/man5/puppet.conf.5 +1 -1
  19. data/man/man8/puppet-config.8 +1 -1
  20. data/man/man8/puppet.8 +1 -1
  21. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/bad_func_load.rb +11 -0
  22. data/spec/integration/util/windows/adsi_spec.rb +1 -2
  23. data/spec/unit/pops/loaders/loaders_spec.rb +18 -0
  24. data/spec/unit/provider/group/aix_spec.rb +33 -0
  25. data/spec/unit/provider/group/pw_spec.rb +6 -0
  26. data/spec/unit/provider/group/windows_adsi_spec.rb +33 -23
  27. data/spec/unit/provider/nameservice/directoryservice_spec.rb +2 -2
  28. data/spec/unit/provider/package/dnf_spec.rb +14 -0
  29. data/spec/unit/type/group_spec.rb +18 -108
  30. data/spec/unit/util/log/destinations_spec.rb +10 -0
  31. data/spec/unit/util/suidmanager_spec.rb +1 -3
  32. data/spec/unit/util/windows/adsi_spec.rb +5 -5
  33. metadata +4 -2
@@ -6,7 +6,7 @@
6
6
  # Raketasks and such to set the version based on the output of `git describe`
7
7
 
8
8
  module Puppet
9
- PUPPETVERSION = '6.0.3'
9
+ PUPPETVERSION = '6.0.4'
10
10
 
11
11
  ##
12
12
  # version is a public API method intended to always provide a fast and
@@ -6,11 +6,11 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: Puppet automation framework 6.0.2-87-gd2c9723\n"
9
+ "Project-Id-Version: Puppet automation framework 6.0.3-60-g553a5ff\n"
10
10
  "\n"
11
11
  "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n"
12
- "POT-Creation-Date: 2018-10-18 18:20+0000\n"
13
- "PO-Revision-Date: 2018-10-18 18:20+0000\n"
12
+ "POT-Creation-Date: 2018-10-30 23:20+0000\n"
13
+ "PO-Revision-Date: 2018-10-30 23:20+0000\n"
14
14
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15
15
  "Language-Team: LANGUAGE <LL@li.org>\n"
16
16
  "Language: \n"
@@ -826,7 +826,7 @@ msgid "Delete a Puppet setting."
826
826
  msgstr ""
827
827
 
828
828
  #: ../lib/puppet/face/config.rb:213
829
- msgid "(<setting>"
829
+ msgid "<setting>"
830
830
  msgstr ""
831
831
 
832
832
  #. TRANSLATORS 'main' is a specific section name and should not be translated
@@ -1552,7 +1552,7 @@ msgid "Diff is not supported on this platform"
1552
1552
  msgstr ""
1553
1553
 
1554
1554
  #: ../lib/puppet/file_bucket/dipper.rb:80
1555
- msgid "Please provide a file or checksum do diff with"
1555
+ msgid "Please provide a file or checksum to diff with"
1556
1556
  msgstr ""
1557
1557
 
1558
1558
  #: ../lib/puppet/file_bucket/dipper.rb:96
@@ -5551,12 +5551,13 @@ msgstr ""
5551
5551
  msgid "The code loaded from %{source_ref} does not seem to be a Puppet 3x API function - no 'newfunction' call."
5552
5552
  msgstr ""
5553
5553
 
5554
- #: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:36
5555
- msgid "The code loaded from %{source_ref} did not produce the expected 3x function info Hash when evaluated. Got '%{klass}'"
5554
+ #. TRANSLATORS - the word 'newfunction' shoud not be translated as it is a method name.
5555
+ #: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:37
5556
+ msgid "Illegal legacy function definition! The code loaded from %{source_ref} did not return the result of calling 'newfunction'. Got '%{klass}'"
5556
5557
  msgstr ""
5557
5558
 
5558
- #: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:39
5559
- msgid "The code loaded from %{source_ref} produced mis-matched name, expected 'function_%{type_name}', got %{created_name}"
5559
+ #: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:40
5560
+ msgid "The code loaded from %{source_ref} produced mis-matched name, expected 'function_%{type_name}', got '%{created_name}'"
5560
5561
  msgstr ""
5561
5562
 
5562
5563
  #: ../lib/puppet/pops/loader/task_instantiator.rb:27
@@ -6259,7 +6260,7 @@ msgstr ""
6259
6260
  msgid "aix.object_info(): Could not find %{resource}[%{name}]"
6260
6261
  msgstr ""
6261
6262
 
6262
- #: ../lib/puppet/provider/aix_object.rb:469 ../lib/puppet/provider/nameservice.rb:180 ../lib/puppet/provider/nameservice/directoryservice.rb:423
6263
+ #: ../lib/puppet/provider/aix_object.rb:469 ../lib/puppet/provider/nameservice.rb:180 ../lib/puppet/provider/nameservice/directoryservice.rb:421
6263
6264
  msgid "Could not create %{resource} %{name}: %{detail}"
6264
6265
  msgstr ""
6265
6266
 
@@ -6323,7 +6324,7 @@ msgstr ""
6323
6324
  msgid "No AIX group exists with a group name or gid of %{group}!"
6324
6325
  msgstr ""
6325
6326
 
6326
- #: ../lib/puppet/provider/group/groupadd.rb:13 ../lib/puppet/provider/group/pw.rb:17
6327
+ #: ../lib/puppet/provider/group/groupadd.rb:13 ../lib/puppet/provider/group/pw.rb:14
6327
6328
  msgid "GID must be an integer"
6328
6329
  msgstr ""
6329
6330
 
@@ -6356,7 +6357,7 @@ msgstr ""
6356
6357
  msgid "autogen_id() does not support auto generation of id for resource type %{resource_type}"
6357
6358
  msgstr ""
6358
6359
 
6359
- #: ../lib/puppet/provider/nameservice.rb:169 ../lib/puppet/provider/nameservice/directoryservice.rb:378
6360
+ #: ../lib/puppet/provider/nameservice.rb:169 ../lib/puppet/provider/nameservice/directoryservice.rb:376
6360
6361
  msgid "already exists"
6361
6362
  msgstr ""
6362
6363
 
@@ -6368,7 +6369,7 @@ msgstr ""
6368
6369
  msgid "Nameservice command must be an array"
6369
6370
  msgstr ""
6370
6371
 
6371
- #: ../lib/puppet/provider/nameservice.rb:282 ../lib/puppet/provider/nameservice/directoryservice.rb:337 ../lib/puppet/provider/nameservice/directoryservice.rb:368
6372
+ #: ../lib/puppet/provider/nameservice.rb:282 ../lib/puppet/provider/nameservice/directoryservice.rb:337 ../lib/puppet/provider/nameservice/directoryservice.rb:366
6372
6373
  msgid "Could not set %{param} on %{resource}[%{name}]: %{detail}"
6373
6374
  msgstr ""
6374
6375
 
@@ -6393,15 +6394,15 @@ msgstr ""
6393
6394
  msgid "Invalid id_type %{id_type}. Only 'uid' and 'gid' supported"
6394
6395
  msgstr ""
6395
6396
 
6396
- #: ../lib/puppet/provider/nameservice/directoryservice.rb:395
6397
+ #: ../lib/puppet/provider/nameservice/directoryservice.rb:393
6397
6398
  msgid "Could not set GeneratedUID for %{resource} %{name}: %{detail}"
6398
6399
  msgstr ""
6399
6400
 
6400
- #: ../lib/puppet/provider/nameservice/directoryservice.rb:443
6401
+ #: ../lib/puppet/provider/nameservice/directoryservice.rb:441
6401
6402
  msgid "Could not remove %{member} from group: %{resource}, %{detail}"
6402
6403
  msgstr ""
6403
6404
 
6404
- #: ../lib/puppet/provider/nameservice/directoryservice.rb:457
6405
+ #: ../lib/puppet/provider/nameservice/directoryservice.rb:455
6405
6406
  msgid "Could not add %{new_member} to group: %{name}, %{detail}"
6406
6407
  msgstr ""
6407
6408
 
@@ -8128,26 +8129,14 @@ msgstr ""
8128
8129
  msgid "Could not create %{type} filebucket: %{detail}"
8129
8130
  msgstr ""
8130
8131
 
8131
- #: ../lib/puppet/type/group.rb:61
8132
+ #: ../lib/puppet/type/group.rb:60
8132
8133
  msgid "GID cannot be deleted"
8133
8134
  msgstr ""
8134
8135
 
8135
- #: ../lib/puppet/type/group.rb:73
8136
+ #: ../lib/puppet/type/group.rb:72
8136
8137
  msgid "Invalid GID %{gid}"
8137
8138
  msgstr ""
8138
8139
 
8139
- #: ../lib/puppet/type/group.rb:92
8140
- msgid "The members property must be specified as either an array of strings, or as a single string consisting of a comma-separated list of members"
8141
- msgstr ""
8142
-
8143
- #: ../lib/puppet/type/group.rb:96
8144
- msgid "User names must be provided, not UID numbers."
8145
- msgstr ""
8146
-
8147
- #: ../lib/puppet/type/group.rb:100
8148
- msgid "User names must not be empty. If you want to specify \"no users\" pass an empty array"
8149
- msgstr ""
8150
-
8151
8140
  #: ../lib/puppet/type/package.rb:114 ../lib/puppet/type/package.rb:128
8152
8141
  msgid "Could not update: %{detail}"
8153
8142
  msgstr ""
@@ -8396,15 +8385,15 @@ msgstr ""
8396
8385
  msgid "path may not be nil"
8397
8386
  msgstr ""
8398
8387
 
8399
- #: ../lib/puppet/util.rb:563
8388
+ #: ../lib/puppet/util.rb:567
8400
8389
  msgid "replace_file requires a block"
8401
8390
  msgstr ""
8402
8391
 
8403
- #: ../lib/puppet/util.rb:567
8392
+ #: ../lib/puppet/util.rb:571
8404
8393
  msgid "replace_file default_mode: %{default_mode} is invalid"
8405
8394
  msgstr ""
8406
8395
 
8407
- #: ../lib/puppet/util.rb:638
8396
+ #: ../lib/puppet/util.rb:642
8408
8397
  msgid "Is a directory: %{directory}"
8409
8398
  msgstr ""
8410
8399
 
@@ -8781,23 +8770,23 @@ msgstr ""
8781
8770
  msgid "Writing %{path} to RAM"
8782
8771
  msgstr ""
8783
8772
 
8784
- #: ../lib/puppet/util/filetype.rb:178
8773
+ #: ../lib/puppet/util/filetype.rb:184
8785
8774
  msgid "Could not retrieve user %{user}: %{detail}"
8786
8775
  msgstr ""
8787
8776
 
8788
- #: ../lib/puppet/util/filetype.rb:233 ../lib/puppet/util/filetype.rb:276
8777
+ #: ../lib/puppet/util/filetype.rb:200 ../lib/puppet/util/filetype.rb:249 ../lib/puppet/util/filetype.rb:292
8789
8778
  msgid "User %{path} not authorized to use cron"
8790
8779
  msgstr ""
8791
8780
 
8792
- #: ../lib/puppet/util/filetype.rb:235 ../lib/puppet/util/filetype.rb:278
8781
+ #: ../lib/puppet/util/filetype.rb:202 ../lib/puppet/util/filetype.rb:251 ../lib/puppet/util/filetype.rb:294
8793
8782
  msgid "Could not read crontab for %{path}: %{detail}"
8794
8783
  msgstr ""
8795
8784
 
8796
- #: ../lib/puppet/util/filetype.rb:243 ../lib/puppet/util/filetype.rb:286
8785
+ #: ../lib/puppet/util/filetype.rb:259 ../lib/puppet/util/filetype.rb:302
8797
8786
  msgid "Could not remove crontab for %{path}: %{detail}"
8798
8787
  msgstr ""
8799
8788
 
8800
- #: ../lib/puppet/util/filetype.rb:258 ../lib/puppet/util/filetype.rb:302
8789
+ #: ../lib/puppet/util/filetype.rb:274 ../lib/puppet/util/filetype.rb:318
8801
8790
  msgid "Could not write crontab for %{path}: %{detail}"
8802
8791
  msgstr ""
8803
8792
 
@@ -8928,7 +8917,7 @@ msgstr ""
8928
8917
  msgid "Creating log directory %{dir}"
8929
8918
  msgstr ""
8930
8919
 
8931
- #: ../lib/puppet/util/log/destinations.rb:100
8920
+ #: ../lib/puppet/util/log/destinations.rb:101
8932
8921
  msgid "Unable to set ownership to %{user}:%{group} for log file: %{path}"
8933
8922
  msgstr ""
8934
8923
 
@@ -868,7 +868,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea
868
868
  The HTTP User\-Agent string to send when making network requests\.
869
869
  .
870
870
  .IP "\(bu" 4
871
- \fIDefault\fR: Puppet/6\.0\.3 Ruby/2\.4\.1\-p111 (x86_64\-linux)
871
+ \fIDefault\fR: Puppet/6\.0\.4 Ruby/2\.4\.1\-p111 (x86_64\-linux)
872
872
  .
873
873
  .IP "" 0
874
874
  .
@@ -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] (\fIsetting\fR
50
+ puppet config delete [\-\-section SECTION_NAME] \fIsetting\fR
51
51
  .
52
52
  .IP
53
53
  \fBDESCRIPTION\fR
@@ -25,4 +25,4 @@ Specialized:
25
25
  catalog Compile, save, view, and convert catalogs\. 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\. node View and manage node definitions\. parser Interact directly with the parser\. script Run a puppet manifests as a script without compiling a catalog ssl Manage SSL keys and certificates for puppet SSL clients
26
26
  .
27
27
  .P
28
- 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 v6\.0\.3
28
+ 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 v6\.0\.4
@@ -0,0 +1,11 @@
1
+ module Puppet::Parser::Functions
2
+ newfunction(:bad_func_load, :type => :rvalue, :doc => <<-EOS
3
+ A function using the 3x API
4
+ EOS
5
+ ) do |arguments|
6
+ "the returned value"
7
+ end
8
+
9
+ def method_here_is_illegal()
10
+ end
11
+ end
@@ -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
- members = users.map { |u| u[:sid] }
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
@@ -423,6 +423,24 @@ describe 'loaders' do
423
423
 
424
424
  end
425
425
 
426
+ context 'when causing a 3x load followed by a 4x load' do
427
+ let(:env) { environment_for(mix_4x_and_3x_functions) }
428
+ let(:compiler) { Puppet::Parser::Compiler.new(Puppet::Node.new("test", :environment => env)) }
429
+ let(:scope) { compiler.topscope }
430
+ let(:loader) { compiler.loaders.private_loader_for_module('user') }
431
+
432
+ before(:each) do
433
+ Puppet.push_context(:current_environment => scope.environment, :global_scope => scope, :loaders => compiler.loaders)
434
+ end
435
+ after(:each) do
436
+ Puppet.pop_context
437
+ end
438
+
439
+ it "a 3x function with code outside body is reported as an error" do
440
+ expect { loader.load_typed(typed_name(:function, 'bad_func_load')) }.to raise_error(/Illegal legacy function definition/)
441
+ end
442
+ end
443
+
426
444
  context 'when causing a 3x load followed by a 4x load' do
427
445
  let(:env) { environment_for(mix_4x_and_3x_functions) }
428
446
  let(:compiler) { Puppet::Parser::Compiler.new(Puppet::Node.new("test", :environment => env)) }
@@ -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::Util:
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::Util:
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::Util:
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::Util:
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::Util:
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::Util:
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::Util:
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::Util:
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::Util:
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::Util:
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::Util:
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::Util:
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 ['user1', 'user2', 'user3']
241
- Puppet::Util::Windows::ADSI::User.stubs(:name_sid_hash)
242
- .with(provider.group.members)
243
- .returns({ 'user1' => '', 'user2' => '', 'user3' => '' })
248
+ provider.group.stubs(:members).returns [
249
+ 'user1',
250
+ 'user2',
251
+ 'user3',
252
+ ]
244
253
 
245
- expect(provider.members).to match_array(['user1', 'user2', 'user3'])
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::Util:
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::Util:
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