puppet 6.8.0 → 6.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c7db647b6d0fddad3fbe82899d306494012181dd255944fdaed7ebf447e41b6
4
- data.tar.gz: 8cdbfbabd8d01c078a61a3b65727e277c07274fe1c8e5383b7725c32c00713b8
3
+ metadata.gz: 223acb5a42c2c6b961e58dd8ee941365737416998a0a326adf7dadd8690c3764
4
+ data.tar.gz: dffdf32c5003e5ff2632c9423039571be609f3b4d65a2314d2ec21d3bd3bb9d2
5
5
  SHA512:
6
- metadata.gz: b8d7a0a1bbcdcebd0ea6a3e34099b9450132be6b125266ddbbf4f78bbd3c9af4a2cf40ac9e0c15679f3ed9ecb27618c61cbe3f3f9e3e91621cc2064c36acf2e2
7
- data.tar.gz: cd86b044ecfdd87e7983aaa6bf18def7fe2546e4b82d676e2b7b5b270eae10bea8895865ad54c71e720162b38eca03a8113eae51120e0ec0d23dafcc463c8d1a
6
+ metadata.gz: b460be876318cd94264d01a4eaf10c87fe12c0a377783c51a571706aec4f8779ec87fa94ef819dabc6029b63ff199234022a2a6ec60015084fc16c5874008d1a
7
+ data.tar.gz: cf8f301bffaf5f4c71b5d68e4c09379a2933e17db54174e29c03985cc6adb15255aff62bdf22dcef11ee7d508e6d1688c76bbd74e35fdcb901d0cf7eae4dc1a6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet (6.8.0)
4
+ puppet (6.8.1)
5
5
  CFPropertyList (~> 2.2)
6
6
  facter (>= 2.4.0, < 4)
7
7
  fast_gettext (~> 1.1)
@@ -23,7 +23,7 @@ GEM
23
23
  crack (0.4.3)
24
24
  safe_yaml (~> 1.0.0)
25
25
  diff-lcs (1.3)
26
- facter (2.5.5)
26
+ facter (2.5.6)
27
27
  fast_gettext (1.1.2)
28
28
  gettext (3.2.9)
29
29
  locale (>= 2.0.5)
@@ -51,7 +51,7 @@ GEM
51
51
  multi_json (1.13.1)
52
52
  mustache (1.1.0)
53
53
  optimist (3.0.0)
54
- packaging (0.99.38)
54
+ packaging (0.99.39)
55
55
  artifactory (~> 2)
56
56
  rake (~> 12.3)
57
57
  parallel (1.17.0)
@@ -8,7 +8,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
8
8
  These options should be specified as an array where each element is either a
9
9
  string or a hash."
10
10
 
11
- has_feature :versionable, :install_options, :virtual_packages
11
+ has_feature :versionable, :install_options
12
12
 
13
13
  commands :aptget => "/usr/bin/apt-get"
14
14
  commands :aptcache => "/usr/bin/apt-cache"
@@ -5,7 +5,7 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
5
5
  and not `apt`, you must specify the source of any packages you want
6
6
  to manage."
7
7
 
8
- has_feature :holdable, :virtual_packages
8
+ has_feature :holdable
9
9
 
10
10
  commands :dpkg => "/usr/bin/dpkg"
11
11
  commands :dpkg_deb => "/usr/bin/dpkg-deb"
@@ -45,18 +45,16 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
45
45
  # Note: self:: is required here to keep these constants in the context of what will
46
46
  # eventually become this Puppet::Type::Package::ProviderDpkg class.
47
47
  self::DPKG_QUERY_FORMAT_STRING = %Q{'${Status} ${Package} ${Version}\\n'}
48
- self::DPKG_QUERY_PROVIDES_FORMAT_STRING = %Q{'${Status} ${Package} ${Version} [${Provides}]\\n'}
49
48
  self::FIELDS_REGEX = %r{^(\S+) +(\S+) +(\S+) (\S+) (\S*)$}
50
- self::FIELDS_REGEX_WITH_PROVIDES = %r{^(\S+) +(\S+) +(\S+) (\S+) (\S*) \[.*\]$}
51
49
  self::FIELDS= [:desired, :error, :status, :name, :ensure]
52
50
 
53
51
  # @param line [String] one line of dpkg-query output
54
52
  # @return [Hash,nil] a hash of FIELDS or nil if we failed to match
55
53
  # @api private
56
- def self.parse_line(line, regex=self::FIELDS_REGEX)
54
+ def self.parse_line(line)
57
55
  hash = nil
58
56
 
59
- match = regex.match(line)
57
+ match = self::FIELDS_REGEX.match(line)
60
58
  if match
61
59
  hash = {}
62
60
 
@@ -118,18 +116,6 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
118
116
 
119
117
  # list out our specific package
120
118
  begin
121
- if @resource.allow_virtual?
122
- output = dpkgquery(
123
- "-W",
124
- "--showformat",
125
- self.class::DPKG_QUERY_PROVIDES_FORMAT_STRING
126
- ).lines.find {|package| package.match(/\[.*#{@resource[:name]}.*\]/)}
127
- if output
128
- hash = self.class.parse_line(output,self.class::FIELDS_REGEX_WITH_PROVIDES)
129
- Puppet.info("Package #{@resource[:name]} is virtual, defaulting to #{hash[:name]}")
130
- @resource[:name] = hash[:name]
131
- end
132
- end
133
119
  output = dpkgquery(
134
120
  "-W",
135
121
  "--showformat",
@@ -162,15 +162,16 @@ module Puppet::Util::Execution
162
162
 
163
163
  options = default_options.merge(options)
164
164
 
165
- if options[:sensitive]
166
- command_str = '[redacted]'
167
- elsif command.is_a?(Array)
165
+ if command.is_a?(Array)
168
166
  command = command.flatten.map(&:to_s)
169
167
  command_str = command.join(" ")
170
168
  elsif command.is_a?(String)
171
169
  command_str = command
172
170
  end
173
171
 
172
+ # do this after processing 'command' array or string
173
+ command_str = '[redacted]' if options[:sensitive]
174
+
174
175
  user_log_s = ''
175
176
  if options[:uid]
176
177
  user_log_s << " uid=#{options[:uid]}"
@@ -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.8.0'
9
+ PUPPETVERSION = '6.8.1'
10
10
 
11
11
  ##
12
12
  # version is a public API method intended to always provide a fast and
@@ -25,7 +25,34 @@ describe Puppet::Util::Execution, unless: Puppet::Util::Platform.jruby? do
25
25
  end
26
26
  end
27
27
 
28
- describe "#execute (non-Windows)", :if => !Puppet::Util::Platform.windows? do
28
+ describe "#execute" do
29
+ if Puppet::Util::Platform.windows?
30
+ let(:argv) { ["cmd", "/c", "echo", 123] }
31
+ else
32
+ let(:argv) { ["echo", 123] }
33
+ end
34
+
35
+ it 'stringifies sensitive arguments when given an array containing integers' do
36
+ result = Puppet::Util::Execution.execute(argv, sensitive: true)
37
+ expect(result.to_s.strip).to eq("123")
38
+ expect(result.exitstatus).to eq(0)
39
+ end
40
+
41
+ it 'redacts sensitive arguments when given an array' do
42
+ Puppet[:log_level] = :debug
43
+ Puppet::Util::Execution.execute(argv, sensitive: true)
44
+ expect(@logs).to include(an_object_having_attributes(level: :debug, message: "Executing: '[redacted]'"))
45
+ end
46
+
47
+ it 'redacts sensitive arguments when given a string' do
48
+ Puppet[:log_level] = :debug
49
+ str = argv.map(&:to_s).join(' ')
50
+ Puppet::Util::Execution.execute(str, sensitive: true)
51
+ expect(@logs).to include(an_object_having_attributes(level: :debug, message: "Executing: '[redacted]'"))
52
+ end
53
+ end
54
+
55
+ describe "#execute (non-Windows)", :if => !Puppet.features.microsoft_windows? do
29
56
  it "should execute basic shell command" do
30
57
  result = Puppet::Util::Execution.execute("ls /tmp", :failonfail => true)
31
58
  expect(result.exitstatus).to eq(0)
@@ -8,7 +8,6 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
8
8
  let(:vim_installed_output) { "install ok installed vim 2:7.3.547-6ubuntu5\n" }
9
9
  let(:all_installed_io) { StringIO.new([bash_installed_output, vim_installed_output].join) }
10
10
  let(:args) { ['-W', '--showformat', %Q{'${Status} ${Package} ${Version}\\n'}] }
11
- let(:args_with_provides) { ['/bin/dpkg-query','-W', '--showformat', %Q{'${Status} ${Package} ${Version} [${Provides}]\\n'}]}
12
11
  let(:execute_options) do
13
12
  {:failonfail => true, :combine => true, :custom_environment => {}}
14
13
  end
@@ -32,6 +31,7 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
32
31
 
33
32
  installed = double('bash')
34
33
  expect(described_class).to receive(:new).with(:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :provider => :dpkg).and_return(installed)
34
+
35
35
  expect(described_class.instances).to eq([installed])
36
36
  end
37
37
 
@@ -68,59 +68,31 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
68
68
  expect(Puppet::Util::Execution).to receive(:execute).with(query_args, execute_options).and_return(Puppet::Util::Execution::ProcessOutput.new(output, 0))
69
69
  end
70
70
 
71
- def dpkg_query_execution_with_multiple_args_returns(output, *args)
72
- args.each do |arg|
73
- expect(Puppet::Util::Execution).to receive(:execute).with(arg, execute_options).ordered.and_return(Puppet::Util::Execution::ProcessOutput.new(output, 0))
74
- end
75
- end
76
-
77
71
  before do
78
72
  allow(Puppet::Util).to receive(:which).with('/usr/bin/dpkg-query').and_return(dpkgquery_path)
79
- allow(resource).to receive(:allow_virtual?).and_return(false)
80
73
  end
81
74
 
82
75
  it "considers the package purged if dpkg-query fails" do
83
76
  allow(Puppet::Util::Execution).to receive(:execute).with(query_args, execute_options).and_raise(Puppet::ExecutionFailure.new("eh"))
84
- expect(provider.query[:ensure]).to eq(:purged)
85
- end
86
77
 
87
- it "considers the package purged if dpkg-query fails with allow_virtual enabled" do
88
- allow(resource).to receive(:allow_virtual?).and_return(true)
89
- allow(Puppet::Util::Execution).to receive(:execute).with(args_with_provides, execute_options).and_raise(Puppet::ExecutionFailure.new("eh"))
90
78
  expect(provider.query[:ensure]).to eq(:purged)
91
79
  end
92
80
 
93
81
  it "returns a hash of the found package status for an installed package" do
94
82
  dpkg_query_execution_returns(bash_installed_output)
95
- expect(provider.query).to eq({:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :provider => :dpkg})
96
- end
97
83
 
98
- it "returns a hash of the found package status for an installed package with allo_virtual enabled" do
99
- allow(resource).to receive(:allow_virtual?).and_return(true)
100
- dpkg_query_execution_with_multiple_args_returns(bash_installed_output,args_with_provides,query_args)
101
84
  expect(provider.query).to eq({:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :provider => :dpkg})
102
85
  end
103
86
 
104
87
  it "considers the package absent if the dpkg-query result cannot be interpreted" do
105
- allow(resource).to receive(:allow_virtual?).and_return(false)
106
88
  dpkg_query_execution_returns('some-bad-data')
107
- expect(provider.query[:ensure]).to eq(:absent)
108
- end
109
89
 
110
- it "considers the package absent if the dpkg-query result cannot be interpreted with allow_virtual enabled" do
111
- allow(resource).to receive(:allow_virtual?).and_return(true)
112
- dpkg_query_execution_with_multiple_args_returns('some-bad-data',args_with_provides,query_args)
113
90
  expect(provider.query[:ensure]).to eq(:absent)
114
91
  end
115
92
 
116
93
  it "fails if an error is discovered" do
117
94
  dpkg_query_execution_returns(bash_installed_output.gsub("ok","error"))
118
- expect { provider.query }.to raise_error(Puppet::Error)
119
- end
120
95
 
121
- it "fails if an error is discovered with allow_virtual enabled" do
122
- allow(resource).to receive(:allow_virtual?).and_return(true)
123
- dpkg_query_execution_with_multiple_args_returns(bash_installed_output.gsub("ok","error"),args_with_provides,query_args)
124
96
  expect { provider.query }.to raise_error(Puppet::Error)
125
97
  end
126
98
 
@@ -128,74 +100,35 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
128
100
  not_installed_bash = bash_installed_output.gsub("installed", "not-installed")
129
101
  not_installed_bash.gsub!(bash_version, "")
130
102
  dpkg_query_execution_returns(not_installed_bash)
131
- expect(provider.query[:ensure]).to eq(:purged)
132
- end
133
103
 
134
- it "considers the package purged if it is marked 'not-installed' with allow_virtual enabled" do
135
- allow(resource).to receive(:allow_virtual?).and_return(true)
136
- not_installed_bash = bash_installed_output.gsub("installed", "not-installed")
137
- not_installed_bash.gsub!(bash_version, "")
138
- dpkg_query_execution_with_multiple_args_returns(not_installed_bash,args_with_provides,query_args)
139
104
  expect(provider.query[:ensure]).to eq(:purged)
140
105
  end
141
106
 
142
-
143
107
  it "considers the package absent if it is marked 'config-files'" do
144
108
  dpkg_query_execution_returns(bash_installed_output.gsub("installed","config-files"))
145
109
  expect(provider.query[:ensure]).to eq(:absent)
146
110
  end
147
111
 
148
- it "considers the package absent if it is marked 'config-files' with allow_virtual enabled" do
149
- allow(resource).to receive(:allow_virtual?).and_return(true)
150
- dpkg_query_execution_with_multiple_args_returns(bash_installed_output.gsub("installed","config-files"),args_with_provides,query_args)
151
- expect(provider.query[:ensure]).to eq(:absent)
152
- end
153
-
154
112
  it "considers the package absent if it is marked 'half-installed'" do
155
113
  dpkg_query_execution_returns(bash_installed_output.gsub("installed","half-installed"))
156
114
  expect(provider.query[:ensure]).to eq(:absent)
157
115
  end
158
116
 
159
- it "considers the package absent if it is marked 'half-installed' with allow_virtual enabled" do
160
- allow(resource).to receive(:allow_virtual?).and_return(true)
161
- dpkg_query_execution_with_multiple_args_returns(bash_installed_output.gsub("installed","half-installed"),args_with_provides,query_args)
162
- expect(provider.query[:ensure]).to eq(:absent)
163
- end
164
-
165
117
  it "considers the package absent if it is marked 'unpacked'" do
166
118
  dpkg_query_execution_returns(bash_installed_output.gsub("installed","unpacked"))
167
119
  expect(provider.query[:ensure]).to eq(:absent)
168
120
  end
169
121
 
170
-
171
- it "considers the package absent if it is marked 'unpacked' with allow_virtual enabled" do
172
- allow(resource).to receive(:allow_virtual?).and_return(true)
173
- dpkg_query_execution_with_multiple_args_returns(bash_installed_output.gsub("installed","unpacked"),args_with_provides,query_args)
174
- expect(provider.query[:ensure]).to eq(:absent)
175
- end
176
-
177
122
  it "considers the package absent if it is marked 'half-configured'" do
178
123
  dpkg_query_execution_returns(bash_installed_output.gsub("installed","half-configured"))
179
124
  expect(provider.query[:ensure]).to eq(:absent)
180
125
  end
181
126
 
182
- it "considers the package absent if it is marked 'half-configured' with allow_virtual enabled" do
183
- allow(resource).to receive(:allow_virtual?).and_return(true)
184
- dpkg_query_execution_with_multiple_args_returns(bash_installed_output.gsub("installed","half-configured"),args_with_provides,query_args)
185
- expect(provider.query[:ensure]).to eq(:absent)
186
- end
187
-
188
127
  it "considers the package held if its state is 'hold'" do
189
128
  dpkg_query_execution_returns(bash_installed_output.gsub("install","hold"))
190
129
  expect(provider.query[:ensure]).to eq(:held)
191
130
  end
192
131
 
193
- it "considers the package held if its state is 'hold' with allow_virtual enabled" do
194
- allow(resource).to receive(:allow_virtual?).and_return(true)
195
- dpkg_query_execution_with_multiple_args_returns(bash_installed_output.gsub("install","hold"),args_with_provides,query_args)
196
- expect(provider.query[:ensure]).to eq(:held)
197
- end
198
-
199
132
  context "parsing tests" do
200
133
  let(:resource_name) { 'name' }
201
134
  let(:package_hash) do
@@ -211,7 +144,6 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
211
144
  let(:package_not_found_hash) do
212
145
  {:ensure => :purged, :status => 'missing', :name => resource_name, :error => 'ok'}
213
146
  end
214
- let(:output) {'an unexpected dpkg msg with an exit code of 0'}
215
147
 
216
148
  def parser_test(dpkg_output_string, gold_hash, number_of_debug_logs = 0)
217
149
  dpkg_query_execution_returns(dpkg_output_string)
@@ -225,33 +157,20 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
225
157
  no_ensure = 'desired ok status name '
226
158
  parser_test(no_ensure, package_hash.merge(:ensure => ''))
227
159
  end
228
- it "provides debug logging of unparsable lines with allow_virtual enabled" do
229
- allow(resource).to receive(:allow_virtual?).and_return(true)
230
- dpkg_query_execution_with_multiple_args_returns(output, args_with_provides, query_args)
231
- expect(Puppet).not_to receive(:warning)
232
- expect(Puppet).to receive(:debug).exactly(1).times
233
- expect(provider.query).to eq(package_not_found_hash.merge(:ensure => :absent))
234
- end
235
-
236
160
 
237
161
  it "provides debug logging of unparsable lines" do
238
162
  parser_test('an unexpected dpkg msg with an exit code of 0', package_not_found_hash.merge(:ensure => :absent), 1)
239
163
  end
240
-
241
- it "does not log if execution returns with non-zero exit code with allow_virtual enabled" do
242
- allow(resource).to receive(:allow_virtual?).and_return(true)
243
- expect(Puppet::Util::Execution).to receive(:execute).with(args_with_provides, execute_options).ordered.and_raise(Puppet::ExecutionFailure.new("failed"))
244
- expect(Puppet).not_to receive(:debug)
245
- expect(provider.query).to eq(package_not_found_hash)
246
- end
247
164
 
248
165
  it "does not log if execution returns with non-zero exit code" do
249
166
  expect(Puppet::Util::Execution).to receive(:execute).with(query_args, execute_options).and_raise(Puppet::ExecutionFailure.new("failed"))
250
167
  expect(Puppet).not_to receive(:debug)
168
+
251
169
  expect(provider.query).to eq(package_not_found_hash)
252
170
  end
253
171
  end
254
172
  end
173
+
255
174
  context "when installing" do
256
175
  before do
257
176
  allow(resource).to receive(:[]).with(:source).and_return("mypkg")
@@ -373,3 +292,4 @@ describe Puppet::Type.type(:package).provider(:dpkg) do
373
292
  expect {provider.package_not_installed?("")}.to raise_error(ArgumentError,"Package name is nil or empty")
374
293
  end
375
294
  end
295
+
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.8.0
4
+ version: 6.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-19 00:00:00.000000000 Z
11
+ date: 2019-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter