puppet 6.0.3-x86-mingw32 → 6.0.4-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (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
@@ -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.join(',') })
26
+ { :members => current })
27
27
 
28
28
  %w{bar baz}.each do |del|
29
29
  @provider.expects(:execute).once.
@@ -30,6 +30,20 @@ context 'default' do
30
30
  Facter.stubs(:value).with(:operatingsystemmajrelease).returns("8675")
31
31
  expect(provider_class).to be_default
32
32
  end
33
+
34
+ it "should not be the default provider on rhel7" do
35
+ Facter.stubs(:value).with(:osfamily).returns(:redhat)
36
+ Facter.stubs(:value).with(:operatingsystem).returns(:redhat)
37
+ Facter.stubs(:value).with(:operatingsystemmajrelease).returns("7")
38
+ expect(provider_class).to_not be_default
39
+ end
40
+
41
+ it "should be the default provider on rhel8" do
42
+ Facter.stubs(:value).with(:osfamily).returns(:redhat)
43
+ Facter.stubs(:value).with(:operatingsystem).returns(:redhat)
44
+ Facter.stubs(:value).with(:operatingsystemmajrelease).returns("8")
45
+ expect(provider_class).to be_default
46
+ end
33
47
  end
34
48
 
35
49
  describe provider_class do
@@ -2,21 +2,8 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Puppet::Type.type(:group) do
5
- let(:mock_group_provider) do
6
- described_class.provide(:mock_group_provider) do
7
- has_features :manages_members
8
- mk_resource_methods
9
- def create; end
10
- def delete; end
11
- def exists?; get(:ensure) != :absent; end
12
- def flush; end
13
- def self.instances; []; end
14
- end
15
- end
16
-
17
- before(:each) do
5
+ before do
18
6
  @class = Puppet::Type.type(:group)
19
- described_class.stubs(:defaultprovider).returns mock_group_provider
20
7
  end
21
8
 
22
9
  it "should have a system_groups feature" do
@@ -83,108 +70,31 @@ describe Puppet::Type.type(:group) do
83
70
  expect(type.exists?).to eq(true)
84
71
  end
85
72
 
86
- describe "when managing members" do
87
- def stub_property(resource_hash)
88
- described_class.new(resource_hash).property(:members)
89
- end
90
-
91
- describe "validation" do
92
- it "raises an error for a non-String value" do
93
- expect {
94
- described_class.new(:name => 'foo', :members => true)
95
- }.to raise_error(Puppet::Error)
96
- end
97
-
98
- it "raises an error for an array value containing a non-String element" do
99
- expect {
100
- described_class.new(:name => 'foo', :members => [ true, 'foo' ])
101
- }.to raise_error(Puppet::Error)
102
- end
103
-
104
- it "raises an error when the members are specified as UIDs instead of usernames" do
105
- expect {
106
- described_class.new(:name => 'foo', :members => [ '123', '456' ])
107
- }.to raise_error(Puppet::Error)
108
- end
109
-
110
- it "raises an error when an empty string is passed for a member's username" do
111
- expect {
112
- described_class.new(:name => 'foo', :members => [ 'foo', '' ])
113
- }.to raise_error(Puppet::Error)
114
- end
115
-
116
- it "passes for a single member" do
117
- expect {
118
- described_class.new(:name => 'foo', :members => 'foo')
119
- }.to_not raise_error
120
- end
73
+ describe "should delegate :members implementation to the provider:" do
121
74
 
122
- it "passes for a member whose username has a number" do
123
- expect {
124
- described_class.new(:name => 'foo', :members => 'foo123')
125
- }.to_not raise_error
126
- end
75
+ let (:provider) do
76
+ @class.provide(:testing) do
77
+ has_features :manages_members
127
78
 
128
- it "passes for an array of members" do
129
- expect {
130
- described_class.new(:name => 'foo', :members => [ 'foo', 'bar' ])
131
- }.to_not raise_error
132
- end
133
-
134
- it "passes for a comma-separated list of members" do
135
- expect {
136
- described_class.new(:name => 'foo', :members => 'foo,bar')
137
- }.to_not raise_error
79
+ def members
80
+ []
81
+ end
138
82
  end
139
83
  end
84
+ let (:provider_instance) { provider.new }
85
+ let (:type) { @class.new(:name => "group", :provider => provider_instance, :members => ['user1']) }
140
86
 
141
- describe "#inclusive?" do
142
- it "returns false when auth_membership == false" do
143
- members_property = stub_property(
144
- :name => 'foo',
145
- :auth_membership => false,
146
- :members => []
147
- )
148
-
149
- expect(members_property.inclusive?).to be false
150
- end
151
-
152
- it "returns true when auth_membership == true" do
153
- members_property = stub_property(
154
- :name => 'foo',
155
- :auth_membership => true,
156
- :members => []
157
- )
158
-
159
- expect(members_property.inclusive?).to be true
160
- end
87
+ it "insync? calls members_insync?" do
88
+ provider_instance.expects(:members_insync?).with(['user1'], ['user1']).returns true
89
+ expect(type.property(:members).insync?(['user1'])).to be_truthy
161
90
  end
162
91
 
163
- describe "#should= munging the @should instance variable" do
164
- def should_var_of(property)
165
- property.instance_variable_get(:@should)
166
- end
167
-
168
- it "leaves a single member as-is" do
169
- members_property = stub_property(:name => 'foo', :members => [])
170
- members_property.should = 'foo'
92
+ it "is_to_s and should_to_s call members_to_s" do
93
+ provider_instance.expects(:members_to_s).with(['user1', 'user2']).returns "user1 (), user2 ()"
94
+ provider_instance.expects(:members_to_s).with(['user1']).returns "user1 ()"
171
95
 
172
- expect(should_var_of(members_property)).to eql([ 'foo' ])
173
- end
174
-
175
- it "leaves an array of members as-is" do
176
- members_property = stub_property(:name => 'foo', :members => [])
177
- members_property.should = [ 'foo', 'bar' ]
178
-
179
- expect(should_var_of(members_property)).to eql(['foo', 'bar'])
180
- end
181
-
182
- it "munges a comma-separated list of members into an array" do
183
- members_property = stub_property(:name => 'foo', :members => [])
184
- members_property.should = 'foo,bar'
185
-
186
- expect(should_var_of(members_property)).to eql(['foo', 'bar'])
187
- end
96
+ expect(type.property(:members).is_to_s('user1')).to eq('user1 ()')
97
+ expect(type.property(:members).should_to_s('user1,user2')).to eq('user1 (), user2 ()')
188
98
  end
189
99
  end
190
100
  end
@@ -54,6 +54,7 @@ describe Puppet::Util::Log.desttypes[:file] do
54
54
  it_behaves_like "file destination"
55
55
 
56
56
  it "logs an error if it can't chown the file owner & group" do
57
+ File.expects(:exists?).with(abspath).returns(false)
57
58
  FileUtils.expects(:chown).with(Puppet[:user], Puppet[:group], abspath).raises(Errno::EPERM)
58
59
  Puppet.features.expects(:root?).returns(true)
59
60
  Puppet.expects(:err).with("Unable to set ownership to #{Puppet[:user]}:#{Puppet[:group]} for log file: #{abspath}")
@@ -62,11 +63,20 @@ describe Puppet::Util::Log.desttypes[:file] do
62
63
  end
63
64
 
64
65
  it "doesn't attempt to chown when running as non-root" do
66
+ File.expects(:exists?).with(abspath).returns(false)
65
67
  FileUtils.expects(:chown).with(Puppet[:user], Puppet[:group], abspath).never
66
68
  Puppet.features.expects(:root?).returns(false)
67
69
 
68
70
  @class.new(abspath)
69
71
  end
72
+
73
+ it "doesn't attempt to chown when file already exists" do
74
+ File.expects(:exists?).with(abspath).returns(true)
75
+ FileUtils.expects(:chown).with(Puppet[:user], Puppet[:group], abspath).never
76
+ Puppet.features.expects(:root?).returns(true)
77
+
78
+ @class.new(abspath)
79
+ end
70
80
  end
71
81
 
72
82
  describe "with a JSON file" do
@@ -121,9 +121,7 @@ describe Puppet::Util::SUIDManager do
121
121
  end
122
122
  end
123
123
 
124
- it "should not get or set euid/egid on Windows" do
125
- Puppet::Util::Platform.stubs(:windows?).returns false
126
-
124
+ it "should not get or set euid/egid on Windows", if: Puppet::Util::Platform.windows? do
127
125
  Puppet::Util::SUIDManager.asuser(user[:uid], user[:gid]) {}
128
126
 
129
127
  expect(xids).to be_empty
@@ -433,7 +433,7 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet::Util::Platform.windows? do
433
433
  adsi_group.expects(:Remove).with('WinNT://DOMAIN/user1,user')
434
434
  adsi_group.expects(:Add).with('WinNT://DOMAIN2/user3,user')
435
435
 
436
- group.set_members('user2,DOMAIN2\user3')
436
+ group.set_members(['user2', 'DOMAIN2\user3'])
437
437
  end
438
438
 
439
439
  it "should add the desired_members to an existing group when not inclusive" do
@@ -460,7 +460,7 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet::Util::Platform.windows? do
460
460
 
461
461
  adsi_group.expects(:Add).with('WinNT://DOMAIN2/user3,user')
462
462
 
463
- group.set_members('user2,DOMAIN2\user3',false)
463
+ group.set_members(['user2', 'DOMAIN2\user3'],false)
464
464
  end
465
465
 
466
466
  it "should return immediately when desired_members is nil" do
@@ -492,7 +492,7 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet::Util::Platform.windows? do
492
492
  adsi_group.expects(:Remove).with('WinNT://DOMAIN/user1,user')
493
493
  adsi_group.expects(:Remove).with('WinNT://testcomputername/user2,user')
494
494
 
495
- group.set_members('')
495
+ group.set_members([])
496
496
  end
497
497
 
498
498
  it "should do nothing when desired_members is empty and not inclusive" do
@@ -511,13 +511,13 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet::Util::Platform.windows? do
511
511
  adsi_group.expects(:Remove).never
512
512
  adsi_group.expects(:Add).never
513
513
 
514
- group.set_members('',false)
514
+ group.set_members([],false)
515
515
  end
516
516
 
517
517
  it "should raise an error when a username does not resolve to a SID" do
518
518
  expect {
519
519
  adsi_group.expects(:Members).returns []
520
- group.set_members('foobar')
520
+ group.set_members(['foobar'])
521
521
  }.to raise_error(Puppet::Error, /Could not resolve name: foobar/)
522
522
  end
523
523
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.3
4
+ version: 6.0.4
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-23 00:00:00.000000000 Z
11
+ date: 2018-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter
@@ -1627,6 +1627,7 @@ files:
1627
1627
  - spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/metadata.json
1628
1628
  - spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/types/withuseeone.pp
1629
1629
  - spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/types/withuseezero.pp
1630
+ - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/bad_func_load.rb
1630
1631
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/callee.rb
1631
1632
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/callee_ws.rb
1632
1633
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/metadata.json
@@ -2823,6 +2824,7 @@ test_files:
2823
2824
  - spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/metadata.json
2824
2825
  - spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/types/withuseeone.pp
2825
2826
  - spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/types/withuseezero.pp
2827
+ - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/bad_func_load.rb
2826
2828
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/callee.rb
2827
2829
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/callee_ws.rb
2828
2830
  - spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/metadata.json