puppet 5.5.13-x64-mingw32 → 5.5.14-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 +9 -9
- data/lib/puppet/application.rb +2 -2
- data/lib/puppet/provider/package/gem.rb +51 -27
- data/lib/puppet/provider/user/directoryservice.rb +16 -4
- data/lib/puppet/type/schedule.rb +4 -0
- data/lib/puppet/version.rb +1 -1
- data/man/man5/puppet.conf.5 +1 -1
- data/man/man8/puppet.8 +1 -1
- data/spec/unit/application_spec.rb +0 -9
- data/spec/unit/provider/package/gem_spec.rb +55 -39
- data/spec/unit/provider/package/puppet_gem_spec.rb +21 -33
- data/spec/unit/provider/user/directoryservice_spec.rb +39 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02d05c08bf1830f6e1bd9f79c5bbfdb81f04dae4980f06219bdec13515887f7e
|
4
|
+
data.tar.gz: 021f04ba792f99dd29038798f7da78964efd42954d4cabc05b5cd9b2215e4f3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b97967715b13beb6056b573735863c4b6fc6901e43126a7b95a07804b1d8e2e9c7c6f2281d3df195b367382c6ed48da96cc9c808a9c930e18a87749f2d126f3c
|
7
|
+
data.tar.gz: b7b6e452e30b0dfecdf3d3ae93510723cbfcbe5a679acac92a37f274b443a198d73465fc32351ace323e80cde53b7260835cb1bbcb218fc45120076c79911497
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
puppet (5.5.
|
4
|
+
puppet (5.5.14)
|
5
5
|
CFPropertyList (~> 2.2)
|
6
6
|
facter (>= 2.4.0, < 4)
|
7
7
|
fast_gettext (~> 1.1.2)
|
@@ -32,7 +32,7 @@ GEM
|
|
32
32
|
fast_gettext (~> 1.1.0)
|
33
33
|
gettext (>= 3.0.2)
|
34
34
|
locale
|
35
|
-
hashdiff (0.3.
|
35
|
+
hashdiff (0.3.9)
|
36
36
|
hiera (3.5.0)
|
37
37
|
hiera-eyaml (3.0.0)
|
38
38
|
highline (~> 1.6.19)
|
@@ -48,16 +48,16 @@ GEM
|
|
48
48
|
method_source (0.9.2)
|
49
49
|
mocha (1.8.0)
|
50
50
|
metaclass (~> 0.0.1)
|
51
|
-
msgpack (1.2.
|
51
|
+
msgpack (1.2.10)
|
52
52
|
multi_json (1.13.1)
|
53
53
|
mustache (1.1.0)
|
54
54
|
net-ssh (4.2.0)
|
55
55
|
optimist (3.0.0)
|
56
|
-
packaging (0.99.
|
56
|
+
packaging (0.99.30)
|
57
57
|
artifactory (~> 2)
|
58
58
|
rake (~> 12.3)
|
59
|
-
parallel (1.
|
60
|
-
parser (2.6.2.
|
59
|
+
parallel (1.17.0)
|
60
|
+
parser (2.6.2.1)
|
61
61
|
ast (~> 2.4.0)
|
62
62
|
pathspec (0.2.1)
|
63
63
|
powerpack (0.1.2)
|
@@ -92,10 +92,10 @@ GEM
|
|
92
92
|
rspec-expectations (>= 2.99.0.beta1)
|
93
93
|
rspec-core (3.8.0)
|
94
94
|
rspec-support (~> 3.8.0)
|
95
|
-
rspec-expectations (3.8.
|
95
|
+
rspec-expectations (3.8.3)
|
96
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
97
97
|
rspec-support (~> 3.8.0)
|
98
|
-
rspec-its (1.
|
98
|
+
rspec-its (1.3.0)
|
99
99
|
rspec-core (>= 3.0.0)
|
100
100
|
rspec-expectations (>= 3.0.0)
|
101
101
|
rspec-legacy_formatters (1.0.1)
|
@@ -125,7 +125,7 @@ GEM
|
|
125
125
|
addressable (>= 2.3.6)
|
126
126
|
crack (>= 0.3.2)
|
127
127
|
hashdiff
|
128
|
-
yard (0.9.
|
128
|
+
yard (0.9.19)
|
129
129
|
yarjuf (2.0.0)
|
130
130
|
builder
|
131
131
|
rspec (~> 3)
|
data/lib/puppet/application.rb
CHANGED
@@ -388,7 +388,7 @@ class Application
|
|
388
388
|
end
|
389
389
|
|
390
390
|
def setup_logs
|
391
|
-
handle_logdest_arg(Puppet[:logdest])
|
391
|
+
handle_logdest_arg(Puppet[:logdest]) if !options[:setdest]
|
392
392
|
|
393
393
|
unless options[:setdest]
|
394
394
|
if options[:debug] || options[:verbose]
|
@@ -411,7 +411,7 @@ class Application
|
|
411
411
|
end
|
412
412
|
|
413
413
|
def handle_logdest_arg(arg)
|
414
|
-
return if
|
414
|
+
return if arg.nil?
|
415
415
|
|
416
416
|
begin
|
417
417
|
Puppet[:logdest] = arg
|
@@ -19,23 +19,36 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
|
|
19
19
|
|
20
20
|
commands :gemcmd => "gem"
|
21
21
|
|
22
|
+
# CommandDefiner in provider.rb creates convenience execution methods that set failonfail, combine, and optionally, environment.
|
23
|
+
# And when a child provider defines its own command via commands() or has_command(), the provider-specific path is always returned by command().
|
24
|
+
# But when the convenience execution method is invoked, the last convenience method to be defined is executed.
|
25
|
+
# This makes invoking those convenience execution methods unsuitable for inherited providers.
|
26
|
+
#
|
27
|
+
# In this case, causing the puppet_gem provider to inherit the parent gem provider's convenience gemcmd() methods, with the wrong path.
|
28
|
+
|
29
|
+
def self.execute_gem_command(command_options)
|
30
|
+
cmd = [command(:gemcmd)] << command_options
|
31
|
+
|
32
|
+
execute(cmd, {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}})
|
33
|
+
end
|
34
|
+
|
22
35
|
def self.gemlist(options)
|
23
|
-
|
36
|
+
command_options = ["list"]
|
24
37
|
|
25
38
|
if options[:local]
|
26
|
-
|
39
|
+
command_options << "--local"
|
27
40
|
else
|
28
|
-
|
41
|
+
command_options << "--remote"
|
29
42
|
end
|
30
43
|
if options[:source]
|
31
|
-
|
44
|
+
command_options << "--source" << options[:source]
|
32
45
|
end
|
33
46
|
if name = options[:justme]
|
34
|
-
|
47
|
+
command_options << '\A' + name + '\z'
|
35
48
|
end
|
36
49
|
|
37
50
|
begin
|
38
|
-
list =
|
51
|
+
list = execute_gem_command(command_options).lines.
|
39
52
|
map {|set| gemsplit(set) }.
|
40
53
|
reject {|x| x.nil? }
|
41
54
|
rescue Puppet::ExecutionFailure => detail
|
@@ -92,14 +105,27 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
|
|
92
105
|
is.any? { |version| dependency.match?('', version) }
|
93
106
|
end
|
94
107
|
|
108
|
+
def rubygem_version
|
109
|
+
command_options = ["--version"]
|
110
|
+
|
111
|
+
self.class.execute_gem_command(command_options)
|
112
|
+
end
|
113
|
+
|
95
114
|
def install(useversion = true)
|
96
|
-
|
97
|
-
|
115
|
+
command_options = ["install"]
|
116
|
+
command_options += install_options if resource[:install_options]
|
117
|
+
|
98
118
|
if Puppet.features.microsoft_windows?
|
99
119
|
version = resource[:ensure]
|
100
|
-
|
120
|
+
command_options << "-v" << %Q["#{version}"] if (! resource[:ensure].is_a? Symbol) and useversion
|
121
|
+
else
|
122
|
+
command_options << "-v" << resource[:ensure] if (! resource[:ensure].is_a? Symbol) and useversion
|
123
|
+
end
|
124
|
+
|
125
|
+
if Puppet::Util::Package.versioncmp(rubygem_version, '2.0.0') == -1
|
126
|
+
command_options << "--no-rdoc" << "--no-ri"
|
101
127
|
else
|
102
|
-
|
128
|
+
command_options << "--no-document"
|
103
129
|
end
|
104
130
|
|
105
131
|
if source = resource[:source]
|
@@ -112,35 +138,35 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
|
|
112
138
|
case uri.scheme
|
113
139
|
when nil
|
114
140
|
# no URI scheme => interpret the source as a local file
|
115
|
-
|
141
|
+
command_options << source
|
116
142
|
when /file/i
|
117
|
-
|
143
|
+
command_options << uri.path
|
118
144
|
when 'puppet'
|
119
145
|
# we don't support puppet:// URLs (yet)
|
120
146
|
raise Puppet::Error.new(_("puppet:// URLs are not supported as gem sources"))
|
121
147
|
else
|
122
148
|
# check whether it's an absolute file path to help Windows out
|
123
149
|
if Puppet::Util.absolute_path?(source)
|
124
|
-
|
150
|
+
command_options << source
|
125
151
|
else
|
126
152
|
# interpret it as a gem repository
|
127
|
-
|
153
|
+
command_options << "--source" << "#{source}" << resource[:name]
|
128
154
|
end
|
129
155
|
end
|
130
156
|
else
|
131
|
-
|
157
|
+
command_options << resource[:name]
|
132
158
|
end
|
133
159
|
|
134
|
-
output =
|
135
|
-
# Apparently some
|
160
|
+
output = self.class.execute_gem_command(command_options)
|
161
|
+
# Apparently some gem versions don't exit non-0 on failure
|
136
162
|
self.fail _("Could not install: %{output}") % { output: output.chomp } if output.include?("ERROR")
|
137
163
|
end
|
138
164
|
|
139
165
|
def latest
|
140
166
|
# This always gets the latest version available.
|
141
|
-
|
142
|
-
|
143
|
-
hash = self.class.gemlist(
|
167
|
+
options = {:justme => resource[:name]}
|
168
|
+
options.merge!({:source => resource[:source]}) unless resource[:source].nil?
|
169
|
+
hash = self.class.gemlist(options)
|
144
170
|
|
145
171
|
hash[:ensure][0]
|
146
172
|
end
|
@@ -150,14 +176,12 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
|
|
150
176
|
end
|
151
177
|
|
152
178
|
def uninstall
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
command += uninstall_options if resource[:uninstall_options]
|
157
|
-
|
158
|
-
output = execute(command, {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}})
|
179
|
+
command_options = ["uninstall"]
|
180
|
+
command_options << "--executables" << "--all" << resource[:name]
|
181
|
+
command_options += uninstall_options if resource[:uninstall_options]
|
159
182
|
|
160
|
-
|
183
|
+
output = self.class.execute_gem_command(command_options)
|
184
|
+
# Apparently some gem versions don't exit non-0 on failure
|
161
185
|
self.fail _("Could not uninstall: %{output}") % { output: output.chomp } if output.include?("ERROR")
|
162
186
|
end
|
163
187
|
|
@@ -302,7 +302,7 @@ Puppet::Type.type(:user).provide :directoryservice do
|
|
302
302
|
merge_attribute_with_dscl('Groups', group, 'GroupMembers', @guid)
|
303
303
|
end
|
304
304
|
else
|
305
|
-
|
305
|
+
create_attribute_with_dscl('Users', @resource.name, self.class.ns_to_ds_attribute_map[attribute], value)
|
306
306
|
end
|
307
307
|
end
|
308
308
|
end
|
@@ -429,11 +429,14 @@ Puppet::Type.type(:user).provide :directoryservice do
|
|
429
429
|
# the case we rescue the error from dscl and alert the user.
|
430
430
|
#
|
431
431
|
# In the event that the user doesn't HAVE a value for the attribute, the
|
432
|
-
# provider should use the -
|
432
|
+
# provider should use the -create option with dscl to add the attribute value
|
433
433
|
# for the user record
|
434
434
|
['home', 'uid', 'gid', 'comment', 'shell'].each do |setter_method|
|
435
435
|
define_method("#{setter_method}=") do |value|
|
436
436
|
if @property_hash[setter_method.intern]
|
437
|
+
if self.class.get_os_version == '10.14' && %w(home uid).include?(setter_method)
|
438
|
+
raise Puppet::Error, "OS X version 10\.14 does not allow changing #{setter_method} using puppet"
|
439
|
+
end
|
437
440
|
begin
|
438
441
|
dscl '.', '-change', "/Users/#{resource.name}", self.class.ns_to_ds_attribute_map[setter_method.intern], @property_hash[setter_method.intern], value
|
439
442
|
rescue Puppet::ExecutionFailure => e
|
@@ -442,7 +445,7 @@ Puppet::Type.type(:user).provide :directoryservice do
|
|
442
445
|
end
|
443
446
|
else
|
444
447
|
begin
|
445
|
-
dscl '.', '-
|
448
|
+
dscl '.', '-create', "/Users/#{resource.name}", self.class.ns_to_ds_attribute_map[setter_method.intern], value
|
446
449
|
rescue Puppet::ExecutionFailure => e
|
447
450
|
raise Puppet::Error, "Cannot set the #{setter_method} value of '#{value}' for user " +
|
448
451
|
"#{@resource.name} due to the following error: #{e.inspect}", e.backtrace
|
@@ -472,10 +475,19 @@ Puppet::Type.type(:user).provide :directoryservice do
|
|
472
475
|
'/var/db/shadow/hash'
|
473
476
|
end
|
474
477
|
|
478
|
+
# This method will create a given value using dscl
|
479
|
+
def create_attribute_with_dscl(path, username, keyname, value)
|
480
|
+
set_attribute_with_dscl('-create', path, username, keyname, value)
|
481
|
+
end
|
482
|
+
|
475
483
|
# This method will merge in a given value using dscl
|
476
484
|
def merge_attribute_with_dscl(path, username, keyname, value)
|
485
|
+
set_attribute_with_dscl('-merge', path, username, keyname, value)
|
486
|
+
end
|
487
|
+
|
488
|
+
def set_attribute_with_dscl(dscl_command, path, username, keyname, value)
|
477
489
|
begin
|
478
|
-
dscl '.',
|
490
|
+
dscl '.', dscl_command, "/#{path}/#{username}", keyname, value
|
479
491
|
rescue Puppet::ExecutionFailure => detail
|
480
492
|
raise Puppet::Error, "Could not set the dscl #{keyname} key with value: #{value} - #{detail.inspect}", detail.backtrace
|
481
493
|
end
|
data/lib/puppet/type/schedule.rb
CHANGED
@@ -271,6 +271,10 @@ module Puppet
|
|
271
271
|
|
272
272
|
See the `periodmatch` attribute for tuning whether to match
|
273
273
|
times by their distance apart or by their specific value.
|
274
|
+
|
275
|
+
> **Tip**: You can use `period => never,` to prevent a resource from being applied
|
276
|
+
in the given `range`. This is useful if you need to create a blackout window to
|
277
|
+
perform sensitive operations without interruption.
|
274
278
|
EOT
|
275
279
|
|
276
280
|
newvalues(:hourly, :daily, :weekly, :monthly, :never)
|
data/lib/puppet/version.rb
CHANGED
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\.14 Ruby/2\.4\.1\-p111 (x86_64\-linux)
|
942
942
|
.
|
943
943
|
.IP "" 0
|
944
944
|
.
|
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\.14
|
@@ -6,7 +6,6 @@ require 'getoptlong'
|
|
6
6
|
require 'timeout'
|
7
7
|
|
8
8
|
describe Puppet::Application do
|
9
|
-
|
10
9
|
before(:each) do
|
11
10
|
@app = Class.new(Puppet::Application).new
|
12
11
|
@appclass = @app.class
|
@@ -326,7 +325,6 @@ describe Puppet::Application do
|
|
326
325
|
end
|
327
326
|
|
328
327
|
describe "when parsing command-line options" do
|
329
|
-
|
330
328
|
before :each do
|
331
329
|
allow(@app.command_line).to receive(:args).and_return([])
|
332
330
|
|
@@ -652,13 +650,6 @@ describe Puppet::Application do
|
|
652
650
|
expect(@app.options[:setdest]).to be_truthy
|
653
651
|
end
|
654
652
|
|
655
|
-
it "does not set the log destination if setdest is true" do
|
656
|
-
expect(Puppet::Util::Log).not_to receive(:newdestination)
|
657
|
-
@app.options[:setdest] = true
|
658
|
-
|
659
|
-
@app.handle_logdest_arg(test_arg)
|
660
|
-
end
|
661
|
-
|
662
653
|
it "does not set the log destination if arg is nil" do
|
663
654
|
expect(Puppet::Util::Log).not_to receive(:newdestination)
|
664
655
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
context Puppet::Type.type(:package).provider(:gem) do
|
4
|
+
|
5
|
+
let(:provider_gem_cmd) { '/provider/gem' }
|
6
|
+
|
4
7
|
context 'installing myresource' do
|
5
8
|
let(:resource) do
|
6
9
|
Puppet::Type.type(:package).new(
|
@@ -15,49 +18,61 @@ context Puppet::Type.type(:package).provider(:gem) do
|
|
15
18
|
provider
|
16
19
|
end
|
17
20
|
|
21
|
+
let(:execute_options) { {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}} }
|
22
|
+
|
18
23
|
before :each do
|
19
24
|
resource.provider = provider
|
25
|
+
allow(described_class).to receive(:command).with(:gemcmd).and_return(provider_gem_cmd)
|
20
26
|
end
|
21
27
|
|
22
28
|
context "when installing" do
|
23
|
-
|
24
|
-
allow(
|
25
|
-
|
29
|
+
before :each do
|
30
|
+
allow(provider).to receive(:rubygem_version).and_return('1.9.9')
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should use the path to the gem command" do
|
34
|
+
allow(described_class).to receive(:which).with(provider_gem_cmd).and_return(provider_gem_cmd)
|
35
|
+
expect(described_class).to receive(:execute).with(be_a(Array), execute_options) { |args| expect(args[0]).to eq(provider_gem_cmd) }.and_return("")
|
26
36
|
provider.install
|
27
37
|
end
|
28
38
|
|
29
39
|
it "should specify that the gem is being installed" do
|
30
|
-
expect(
|
40
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[0]).to eq("install") }.and_return("")
|
41
|
+
provider.install
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should specify that --rdoc should not be included when gem version is < 2.0.0" do
|
45
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[1]).to eq("--no-rdoc") }.and_return("")
|
31
46
|
provider.install
|
32
47
|
end
|
33
48
|
|
34
|
-
it "should specify that
|
35
|
-
expect(
|
49
|
+
it "should specify that --ri should not be included when gem version is < 2.0.0" do
|
50
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[2]).to eq("--no-ri") }.and_return("")
|
36
51
|
provider.install
|
37
52
|
end
|
38
53
|
|
39
|
-
it "should specify that
|
40
|
-
|
54
|
+
it "should specify that --document should not be included when gem version is >= 2.0.0" do
|
55
|
+
allow(provider).to receive(:rubygem_version).and_return('2.0.0')
|
56
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[1]).to eq("--no-document") }.and_return("")
|
41
57
|
provider.install
|
42
58
|
end
|
43
59
|
|
44
60
|
it "should specify the package name" do
|
45
|
-
expect(
|
61
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[3]).to eq("myresource") }.and_return("")
|
46
62
|
provider.install
|
47
63
|
end
|
48
64
|
|
49
65
|
it "should not append install_options by default" do
|
50
|
-
expect(
|
66
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args.length).to eq(4) }.and_return("")
|
51
67
|
provider.install
|
52
68
|
end
|
53
69
|
|
54
70
|
it "should allow setting an install_options parameter" do
|
55
71
|
resource[:install_options] = [ '--force', {'--bindir' => '/usr/bin' } ]
|
56
|
-
expect(
|
57
|
-
expect(args[
|
58
|
-
expect(args[
|
59
|
-
end.and_return(
|
60
|
-
|
72
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) do |args|
|
73
|
+
expect(args[1]).to eq('--force')
|
74
|
+
expect(args[2]).to eq('--bindir=/usr/bin')
|
75
|
+
end.and_return("")
|
61
76
|
provider.install
|
62
77
|
end
|
63
78
|
|
@@ -65,7 +80,7 @@ context Puppet::Type.type(:package).provider(:gem) do
|
|
65
80
|
context "as a normal file" do
|
66
81
|
it "should use the file name instead of the gem name" do
|
67
82
|
resource[:source] = "/my/file"
|
68
|
-
expect(
|
83
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[3]).to eq("/my/file") }.and_return("")
|
69
84
|
provider.install
|
70
85
|
end
|
71
86
|
end
|
@@ -73,7 +88,7 @@ context Puppet::Type.type(:package).provider(:gem) do
|
|
73
88
|
context "as a file url" do
|
74
89
|
it "should use the file name instead of the gem name" do
|
75
90
|
resource[:source] = "file:///my/file"
|
76
|
-
expect(
|
91
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[3]).to eq("/my/file") }.and_return("")
|
77
92
|
provider.install
|
78
93
|
end
|
79
94
|
end
|
@@ -88,7 +103,7 @@ context Puppet::Type.type(:package).provider(:gem) do
|
|
88
103
|
context "as a non-file and non-puppet url" do
|
89
104
|
it "should treat the source as a gem repository" do
|
90
105
|
resource[:source] = "http://host/my/file"
|
91
|
-
expect(
|
106
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[3..5]).to eq(["--source", "http://host/my/file", "myresource"]) }.and_return("")
|
92
107
|
provider.install
|
93
108
|
end
|
94
109
|
end
|
@@ -96,7 +111,7 @@ context Puppet::Type.type(:package).provider(:gem) do
|
|
96
111
|
context "as a windows path on windows", :if => Puppet.features.microsoft_windows? do
|
97
112
|
it "should treat the source as a local path" do
|
98
113
|
resource[:source] = "c:/this/is/a/path/to/a/gem.gem"
|
99
|
-
expect(
|
114
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[3]).to eq("c:/this/is/a/path/to/a/gem.gem") }.and_return("")
|
100
115
|
provider.install
|
101
116
|
end
|
102
117
|
end
|
@@ -139,16 +154,16 @@ context Puppet::Type.type(:package).provider(:gem) do
|
|
139
154
|
|
140
155
|
context "#instances" do
|
141
156
|
before do
|
142
|
-
allow(described_class).to receive(:command).with(:gemcmd).and_return(
|
157
|
+
allow(described_class).to receive(:command).with(:gemcmd).and_return(provider_gem_cmd)
|
143
158
|
end
|
144
159
|
|
145
160
|
it "should return an empty array when no gems installed" do
|
146
|
-
expect(described_class).to receive(:
|
161
|
+
expect(described_class).to receive(:execute_gem_command).with(%w{list --local}).and_return("\n")
|
147
162
|
expect(described_class.instances).to eq([])
|
148
163
|
end
|
149
164
|
|
150
165
|
it "should return ensure values as an array of installed versions" do
|
151
|
-
expect(described_class).to receive(:
|
166
|
+
expect(described_class).to receive(:execute_gem_command).with(%w{list --local}).and_return(<<-HEREDOC.gsub(/ /, ''))
|
152
167
|
systemu (1.2.0)
|
153
168
|
vagrant (0.8.7, 0.6.9)
|
154
169
|
HEREDOC
|
@@ -160,7 +175,7 @@ context Puppet::Type.type(:package).provider(:gem) do
|
|
160
175
|
end
|
161
176
|
|
162
177
|
it "should ignore platform specifications" do
|
163
|
-
expect(described_class).to receive(:
|
178
|
+
expect(described_class).to receive(:execute_gem_command).with(%w{list --local}).and_return(<<-HEREDOC.gsub(/ /, ''))
|
164
179
|
systemu (1.2.0)
|
165
180
|
nokogiri (1.6.1 ruby java x86-mingw32 x86-mswin32-60, 1.4.4.1 x86-mswin32)
|
166
181
|
HEREDOC
|
@@ -172,7 +187,7 @@ context Puppet::Type.type(:package).provider(:gem) do
|
|
172
187
|
end
|
173
188
|
|
174
189
|
it "should not list 'default: ' text from rubygems''" do
|
175
|
-
expect(described_class).to receive(:
|
190
|
+
expect(described_class).to receive(:execute_gem_command).with(%w{list --local}).and_return(<<-HEREDOC.gsub(/ /, ''))
|
176
191
|
bundler (1.16.1, default: 1.16.0, 1.15.1)
|
177
192
|
HEREDOC
|
178
193
|
|
@@ -182,8 +197,7 @@ context Puppet::Type.type(:package).provider(:gem) do
|
|
182
197
|
end
|
183
198
|
|
184
199
|
it "should not fail when an unmatched line is returned" do
|
185
|
-
expect(described_class).to receive(:
|
186
|
-
and_return(File.read(my_fixture('line-with-1.8.5-warning')))
|
200
|
+
expect(described_class).to receive(:execute_gem_command).with(%w{list --local}).and_return(File.read(my_fixture('line-with-1.8.5-warning')))
|
187
201
|
|
188
202
|
expect(described_class.instances.map {|p| p.properties}).
|
189
203
|
to eq([{provider: :gem, ensure: ["0.3.2"], name: "columnize"},
|
@@ -202,7 +216,7 @@ context Puppet::Type.type(:package).provider(:gem) do
|
|
202
216
|
context "listing gems" do
|
203
217
|
context "searching for a single package" do
|
204
218
|
it "searches for an exact match" do
|
205
|
-
expect(described_class).to receive(:
|
219
|
+
expect(described_class).to receive(:execute_gem_command).with(include('\Abundler\z')).and_return(File.read(my_fixture('gem-list-single-package')))
|
206
220
|
expected = {:name => 'bundler', :ensure => %w[1.6.2], :provider => :gem}
|
207
221
|
expect(described_class.gemlist({:justme => 'bundler'})).to eq(expected)
|
208
222
|
end
|
@@ -294,49 +308,51 @@ context Puppet::Type.type(:package).provider(:gem) do
|
|
294
308
|
provider
|
295
309
|
end
|
296
310
|
|
311
|
+
let(:execute_options) { {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}} }
|
312
|
+
|
297
313
|
before :each do
|
298
314
|
resource.provider = provider
|
315
|
+
allow(described_class).to receive(:command).with(:gemcmd).and_return(provider_gem_cmd)
|
299
316
|
end
|
300
317
|
|
301
318
|
context "when uninstalling" do
|
302
|
-
it "should use the path to the gem" do
|
303
|
-
allow(described_class).to receive(:
|
304
|
-
expect(
|
319
|
+
it "should use the path to the gem command" do
|
320
|
+
allow(described_class).to receive(:which).with(provider_gem_cmd).and_return(provider_gem_cmd)
|
321
|
+
expect(described_class).to receive(:execute).with(be_a(Array), execute_options) { |args| expect(args[0]).to eq(provider_gem_cmd) }.and_return("")
|
305
322
|
provider.uninstall
|
306
323
|
end
|
307
324
|
|
308
325
|
it "should specify that the gem is being uninstalled" do
|
309
|
-
expect(
|
326
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[0]).to eq("uninstall") }.and_return("")
|
310
327
|
provider.uninstall
|
311
328
|
end
|
312
329
|
|
313
330
|
it "should specify that the relevant executables should be removed without confirmation" do
|
314
|
-
expect(
|
331
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[1]).to eq("--executables") }.and_return("")
|
315
332
|
provider.uninstall
|
316
333
|
end
|
317
334
|
|
318
335
|
it "should specify that all the matching versions should be removed" do
|
319
|
-
expect(
|
336
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[2]).to eq("--all") }.and_return("")
|
320
337
|
provider.uninstall
|
321
338
|
end
|
322
339
|
|
323
340
|
it "should specify the package name" do
|
324
|
-
expect(
|
341
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args[3]).to eq("myresource") }.and_return("")
|
325
342
|
provider.uninstall
|
326
343
|
end
|
327
344
|
|
328
345
|
it "should not append uninstall_options by default" do
|
329
|
-
expect(
|
346
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) { |args| expect(args.length).to eq(4) }.and_return("")
|
330
347
|
provider.uninstall
|
331
348
|
end
|
332
349
|
|
333
350
|
it "should allow setting an uninstall_options parameter" do
|
334
351
|
resource[:uninstall_options] = [ '--ignore-dependencies', {'--version' => '0.1.1' } ]
|
335
|
-
expect(
|
336
|
-
expect(args[
|
337
|
-
expect(args[
|
352
|
+
expect(described_class).to receive(:execute_gem_command).with(be_a(Array)) do |args|
|
353
|
+
expect(args[4]).to eq('--ignore-dependencies')
|
354
|
+
expect(args[5]).to eq('--version=0.1.1')
|
338
355
|
end.and_return('')
|
339
|
-
|
340
356
|
provider.uninstall
|
341
357
|
end
|
342
358
|
end
|
@@ -15,70 +15,58 @@ describe Puppet::Type.type(:package).provider(:puppet_gem) do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
if Puppet.features.microsoft_windows?
|
18
|
-
let(:
|
18
|
+
let(:provider_gem_cmd) { 'gem' }
|
19
19
|
else
|
20
|
-
let(:
|
20
|
+
let(:provider_gem_cmd) { '/opt/puppetlabs/puppet/bin/gem' }
|
21
21
|
end
|
22
22
|
|
23
|
+
let(:execute_options) { {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}} }
|
24
|
+
|
23
25
|
before :each do
|
24
26
|
resource.provider = provider
|
27
|
+
allow(described_class).to receive(:command).with(:gemcmd).and_return(provider_gem_cmd)
|
25
28
|
end
|
26
29
|
|
27
30
|
context "when installing" do
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
before :each do
|
32
|
+
allow(provider).to receive(:rubygem_version).and_return('1.9.9')
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should use the path to the gem command" do
|
36
|
+
allow(described_class).to receive(:which).with(provider_gem_cmd).and_return(provider_gem_cmd)
|
37
|
+
expect(described_class).to receive(:execute).with(be_a(Array), execute_options) { |args| expect(args[0]).to eq(provider_gem_cmd) }.and_return('')
|
34
38
|
provider.install
|
35
39
|
end
|
36
40
|
|
37
41
|
it "should not append install_options by default" do
|
38
|
-
expect(
|
39
|
-
expect(args.length).to eq(5)
|
40
|
-
''
|
41
|
-
end
|
42
|
+
expect(described_class).to receive(:execute_gem_command).with(%w{install --no-rdoc --no-ri myresource}).and_return('')
|
42
43
|
provider.install
|
43
44
|
end
|
44
45
|
|
45
46
|
it "should allow setting an install_options parameter" do
|
46
47
|
resource[:install_options] = [ '--force', {'--bindir' => '/usr/bin' } ]
|
47
|
-
expect(
|
48
|
-
expect(args[2]).to eq('--force')
|
49
|
-
expect(args[3]).to eq('--bindir=/usr/bin')
|
50
|
-
''
|
51
|
-
end
|
48
|
+
expect(described_class).to receive(:execute_gem_command).with(%w{install --force --bindir=/usr/bin --no-rdoc --no-ri myresource}).and_return('')
|
52
49
|
provider.install
|
53
50
|
end
|
54
51
|
end
|
55
52
|
|
56
53
|
context "when uninstalling" do
|
57
|
-
it "should use the path to the gem" do
|
58
|
-
|
59
|
-
expect(
|
60
|
-
|
61
|
-
''
|
62
|
-
end
|
63
|
-
provider.install
|
54
|
+
it "should use the path to the gem command" do
|
55
|
+
allow(described_class).to receive(:which).with(provider_gem_cmd).and_return(provider_gem_cmd)
|
56
|
+
expect(described_class).to receive(:execute).with(be_a(Array), execute_options) { |args| expect(args[0]).to eq(provider_gem_cmd) }.and_return('')
|
57
|
+
provider.uninstall
|
64
58
|
end
|
65
59
|
|
66
60
|
it "should not append uninstall_options by default" do
|
67
|
-
expect(
|
68
|
-
expect(args.length).to eq(5)
|
69
|
-
''
|
70
|
-
end
|
61
|
+
expect(described_class).to receive(:execute_gem_command).with(%w{uninstall --executables --all myresource}).and_return('')
|
71
62
|
provider.uninstall
|
72
63
|
end
|
73
64
|
|
74
65
|
it "should allow setting an uninstall_options parameter" do
|
75
66
|
resource[:uninstall_options] = [ '--force', {'--bindir' => '/usr/bin' } ]
|
76
|
-
expect(
|
77
|
-
expect(args[5]).to eq('--force')
|
78
|
-
expect(args[6]).to eq('--bindir=/usr/bin')
|
79
|
-
''
|
80
|
-
end
|
67
|
+
expect(described_class).to receive(:execute_gem_command).with(%w{uninstall --executables --all myresource --force --bindir=/usr/bin}).and_return('')
|
81
68
|
provider.uninstall
|
82
69
|
end
|
83
70
|
end
|
71
|
+
|
84
72
|
end
|
@@ -294,7 +294,7 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
294
294
|
before :each do
|
295
295
|
# Stub out all calls to dscl with default values from above
|
296
296
|
defaults.each do |key, val|
|
297
|
-
allow(provider).to receive(:
|
297
|
+
allow(provider).to receive(:create_attribute_with_dscl).with('Users', username, key, val)
|
298
298
|
end
|
299
299
|
|
300
300
|
# Mock the rest of the dscl calls. We can't assume that our Linux
|
@@ -327,11 +327,41 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
327
327
|
it 'should convert group names into integers' do
|
328
328
|
resource[:gid] = 'somegroup'
|
329
329
|
expect(Puppet::Util).to receive(:gid).with('somegroup').and_return(21)
|
330
|
-
expect(provider).to receive(:
|
330
|
+
expect(provider).to receive(:create_attribute_with_dscl).with('Users', username, 'PrimaryGroupID', 21)
|
331
331
|
provider.create
|
332
332
|
end
|
333
333
|
end
|
334
334
|
|
335
|
+
describe 'Update existing user' do
|
336
|
+
describe 'home=' do
|
337
|
+
context 'on OS X 10.14' do
|
338
|
+
before do
|
339
|
+
provider.instance_variable_set(:@property_hash, { home: 'value' })
|
340
|
+
allow(provider.class).to receive(:get_os_version).and_return('10.14')
|
341
|
+
end
|
342
|
+
|
343
|
+
it 'raises error' do
|
344
|
+
expect { provider.home = 'new' }.to \
|
345
|
+
raise_error(Puppet::Error, "OS X version 10.14 does not allow changing home using puppet")
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
350
|
+
describe 'uid=' do
|
351
|
+
context 'on OS X 10.14' do
|
352
|
+
before do
|
353
|
+
provider.instance_variable_set(:@property_hash, { uid: 'value' })
|
354
|
+
allow(provider.class).to receive(:get_os_version).and_return('10.14')
|
355
|
+
end
|
356
|
+
|
357
|
+
it 'raises error' do
|
358
|
+
expect { provider.uid = 'new' }.to \
|
359
|
+
raise_error(Puppet::Error, "OS X version 10.14 does not allow changing uid using puppet")
|
360
|
+
end
|
361
|
+
end
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
335
365
|
describe 'self#instances' do
|
336
366
|
it 'should create an array of provider instances' do
|
337
367
|
expect(provider.class).to receive(:get_all_users).and_return(['foo', 'bar'])
|
@@ -988,6 +1018,13 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
988
1018
|
end
|
989
1019
|
end
|
990
1020
|
|
1021
|
+
describe '#create_attribute_with_dscl' do
|
1022
|
+
it 'should raise an error if a dscl command raises an error' do
|
1023
|
+
expect(provider).to receive(:dscl).with('.', '-create', user_path, 'GeneratedUID', 'GUID').and_raise(Puppet::ExecutionFailure, 'boom')
|
1024
|
+
expect { provider.create_attribute_with_dscl('Users', username, 'GeneratedUID', 'GUID') }.to raise_error Puppet::Error, /Could not set the dscl GeneratedUID key with value: GUID/
|
1025
|
+
end
|
1026
|
+
end
|
1027
|
+
|
991
1028
|
describe '#get_users_plist' do
|
992
1029
|
let(:test_hash) do
|
993
1030
|
{
|
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.14
|
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: 2019-04-
|
11
|
+
date: 2019-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facter
|