puppet 5.5.7-x64-mingw32 → 5.5.8-x64-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.
- 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
@@ -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
|
|
@@ -2,21 +2,8 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe Puppet::Type.type(:group) do
|
5
|
-
|
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 "
|
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
|
-
|
123
|
-
|
124
|
-
|
125
|
-
}.to_not raise_error
|
126
|
-
end
|
75
|
+
let (:provider) do
|
76
|
+
@class.provide(:testing) do
|
77
|
+
has_features :manages_members
|
127
78
|
|
128
|
-
|
129
|
-
|
130
|
-
|
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
|
-
|
142
|
-
|
143
|
-
|
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
|
-
|
164
|
-
|
165
|
-
|
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
|
-
|
173
|
-
|
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.features.stubs(:microsoft_windows?).returns true
|
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.features.microsoft_windows?
|
|
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.features.microsoft_windows?
|
|
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.features.microsoft_windows?
|
|
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.features.microsoft_windows?
|
|
511
511
|
adsi_group.expects(:Remove).never
|
512
512
|
adsi_group.expects(:Add).never
|
513
513
|
|
514
|
-
group.set_members(
|
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: 5.5.
|
4
|
+
version: 5.5.8
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facter
|
@@ -892,7 +892,6 @@ files:
|
|
892
892
|
- lib/puppet/pops/loader/puppet_resource_type_impl_instantiator.rb
|
893
893
|
- lib/puppet/pops/loader/ruby_data_type_instantiator.rb
|
894
894
|
- lib/puppet/pops/loader/ruby_function_instantiator.rb
|
895
|
-
- lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb
|
896
895
|
- lib/puppet/pops/loader/runtime3_type_loader.rb
|
897
896
|
- lib/puppet/pops/loader/simple_environment_loader.rb
|
898
897
|
- lib/puppet/pops/loader/static_loader.rb
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# The RubyLegacyFunctionInstantiator instantiates a Puppet::Functions::Function given the ruby source
|
2
|
-
# that calls Puppet::Functions.create_function.
|
3
|
-
#
|
4
|
-
class Puppet::Pops::Loader::RubyLegacyFunctionInstantiator
|
5
|
-
# Produces an instance of the Function class with the given typed_name, or fails with an error if the
|
6
|
-
# given ruby source does not produce this instance when evaluated.
|
7
|
-
#
|
8
|
-
# @param loader [Puppet::Pops::Loader::Loader] The loader the function is associated with
|
9
|
-
# @param typed_name [Puppet::Pops::Loader::TypedName] the type / name of the function to load
|
10
|
-
# @param source_ref [URI, String] a reference to the source / origin of the ruby code to evaluate
|
11
|
-
# @param ruby_code_string [String] ruby code in a string
|
12
|
-
#
|
13
|
-
# @return [Puppet::Pops::Functions.Function] - an instantiated function with global scope closure associated with the given loader
|
14
|
-
#
|
15
|
-
def self.create(loader, typed_name, source_ref, ruby_code_string)
|
16
|
-
unless ruby_code_string.is_a?(String) && ruby_code_string =~ /Puppet\:\:Parser\:\:Functions.*newfunction/m
|
17
|
-
raise ArgumentError, _("The code loaded from %{source_ref} does not seem to be a Puppet 3x API function - no 'newfunction' call.") % { source_ref: source_ref }
|
18
|
-
end
|
19
|
-
# make the private loader available in a binding to allow it to be passed on
|
20
|
-
loader_for_function = loader.private_loader
|
21
|
-
here = get_binding(loader_for_function)
|
22
|
-
|
23
|
-
# Avoid reloading the function if already loaded via one of the APIs that trigger 3x function loading
|
24
|
-
# Check if function is already loaded the 3x way (and obviously not the 4x way since we would not be here in the
|
25
|
-
# first place.
|
26
|
-
environment = Puppet.lookup(:current_environment)
|
27
|
-
func_info = Puppet::Parser::Functions.environment_module(environment).get_function_info(typed_name.name.to_sym)
|
28
|
-
if func_info.nil?
|
29
|
-
# This will to do the 3x loading and define the "function_<name>" and "real_function_<name>" methods
|
30
|
-
# in the anonymous module used to hold function definitions.
|
31
|
-
#
|
32
|
-
func_info = eval(ruby_code_string, here, source_ref, 1)
|
33
|
-
|
34
|
-
# Validate what was loaded
|
35
|
-
unless func_info.is_a?(Hash)
|
36
|
-
raise ArgumentError, _("The code loaded from %{source_ref} did not produce the expected 3x function info Hash when evaluated. Got '%{klass}'") % { source_ref: source_ref, klass: created.class }
|
37
|
-
end
|
38
|
-
unless func_info[:name] == "function_#{typed_name.name()}"
|
39
|
-
raise ArgumentError, _("The code loaded from %{source_ref} produced mis-matched name, expected 'function_%{type_name}', got %{created_name}") % {
|
40
|
-
source_ref: source_ref, type_name: typed_name.name, created_name: func_info[:name] }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
created = Puppet::Functions::Function3x.create_function(typed_name.name(), func_info, loader_for_function)
|
45
|
-
|
46
|
-
# create the function instance - it needs closure (scope), and loader (i.e. where it should start searching for things
|
47
|
-
# when calling functions etc.
|
48
|
-
# It should be bound to global scope
|
49
|
-
|
50
|
-
# Sets closure scope to nil, to let it be picked up at runtime from Puppet.lookup(:global_scope)
|
51
|
-
# If function definition used the loader from the binding to create a new loader, that loader wins
|
52
|
-
created.new(nil, loader_for_function)
|
53
|
-
end
|
54
|
-
|
55
|
-
# Produces a binding where the given loader is bound as a local variable (loader_injected_arg). This variable can be used in loaded
|
56
|
-
# ruby code - e.g. to call Puppet::Function.create_loaded_function(:name, loader,...)
|
57
|
-
#
|
58
|
-
def self.get_binding(loader_injected_arg)
|
59
|
-
binding
|
60
|
-
end
|
61
|
-
private_class_method :get_binding
|
62
|
-
end
|