Skip to content

Commit 4a00c41

Browse files
david22swantphoney
authored andcommitted
FixToAccountForVersionChange (#867)
1 parent 3817f31 commit 4a00c41

File tree

7 files changed

+26
-24
lines changed

7 files changed

+26
-24
lines changed

lib/facter/facter_dot_d.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def initialize(dir = '/etc/facts.d', cache_file = File.join(Puppet[:libdir], 'fa
2323

2424
def entries
2525
Dir.entries(@dir).reject { |f| f =~ %r{^\.|\.ttl$} }.sort.map { |f| File.join(@dir, f) }
26-
rescue # rubocop:disable Lint/RescueWithoutErrorClass
26+
rescue
2727
[]
2828
end
2929

@@ -113,14 +113,14 @@ def script_parser(file)
113113
def cache_save!
114114
cache = load_cache
115115
File.open(@cache_file, 'w', 0o600) { |f| f.write(YAML.dump(cache)) }
116-
rescue # rubocop:disable Lint/HandleExceptions, Lint/RescueWithoutErrorClass
116+
rescue # rubocop:disable Lint/HandleExceptions
117117
end
118118

119119
def cache_store(file, data)
120120
load_cache
121121

122122
@cache[file] = { :data => data, :stored => Time.now.to_i }
123-
rescue # rubocop:disable Lint/HandleExceptions, Lint/RescueWithoutErrorClass
123+
rescue # rubocop:disable Lint/HandleExceptions
124124
end
125125

126126
def cache_lookup(file)
@@ -136,15 +136,15 @@ def cache_lookup(file)
136136
return cache[file][:data] if ttl == -1
137137
return cache[file][:data] if (now - cache[file][:stored]) <= ttl
138138
return nil
139-
rescue # rubocop:disable Lint/RescueWithoutErrorClass
139+
rescue
140140
return nil
141141
end
142142

143143
def cache_time(file)
144144
meta = file + '.ttl'
145145

146146
return File.read(meta).chomp.to_i
147-
rescue # rubocop:disable Lint/RescueWithoutErrorClass
147+
rescue
148148
return 0
149149
end
150150

@@ -156,7 +156,7 @@ def load_cache
156156
end
157157

158158
return @cache
159-
rescue # rubocop:disable Lint/RescueWithoutErrorClass
159+
rescue
160160
@cache = {}
161161
return @cache
162162
end

lib/puppet/parser/functions/any2bool.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module Puppet::Parser::Functions
3333

3434
valid_float = begin
3535
!!Float(arg) # rubocop:disable Style/DoubleNegation : Could not find a better way to check if a boolean
36-
rescue # rubocop:disable Lint/RescueWithoutErrorClass
36+
rescue
3737
false
3838
end
3939

lib/puppet/parser/functions/dig44.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module Puppet::Parser::Functions
5353
if structure.is_a? Array
5454
begin
5555
key = Integer key
56-
rescue # rubocop:disable Lint/RescueWithoutErrorClass
56+
rescue
5757
break
5858
end
5959
end

lib/puppet/parser/functions/uriescape.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ module Puppet::Parser::Functions
2020

2121
result = if value.is_a?(Array)
2222
# Numbers in Puppet are often string-encoded which is troublesome ...
23-
value.map { |i| i.is_a?(String) ? URI.escape(i) : i } # rubocop:disable Lint/UriEscapeUnescape
23+
value.map { |i| i.is_a?(String) ? URI.escape(i) : i }
2424
else
25-
URI.escape(value) # rubocop:disable Lint/UriEscapeUnescape
25+
URI.escape(value)
2626
end
2727

2828
return result

spec/acceptance/member_spec.rb

+12-10
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,27 @@
2626
end
2727

2828
describe 'members array of integers' do
29-
it_behaves_like 'item found' do
30-
let(:pp) do
31-
<<-DOC
29+
let(:pp) do
30+
<<-DOC
3231
if member( [1,2,3,4], 4 ){
3332
notify { 'output correct': }
3433
}
35-
DOC
36-
end
34+
DOC
35+
end
36+
37+
it_behaves_like 'item found' do
3738
end
3839
end
3940
describe 'members of mixed array' do
40-
it_behaves_like 'item found' do
41-
let(:pp) do
42-
<<-DOC
41+
let(:pp) do
42+
<<-DOC
4343
if member( ['a','4',3], 'a' ){
4444
notify { 'output correct': }
4545
}
46-
DOC
47-
end
46+
DOC
47+
end
48+
49+
it_behaves_like 'item found' do
4850
end
4951
end
5052
it 'members arrays without members'

spec/functions/private_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
scope.expects(:warning).with("private() DEPRECATED: This function will cease to function on Puppet 4; please use assert_private() before upgrading to puppet 4 for backwards-compatibility, or migrate to the new parser's typing system.") # rubocop:disable Metrics/LineLength : unable to cut line to required length
66
begin
77
subject.call []
8-
rescue # rubocop:disable Lint/HandleExceptions, Lint/RescueWithoutErrorClass
8+
rescue # rubocop:disable Lint/HandleExceptions
99
# ignore this
1010
end
1111
end

spec/unit/puppet/type/file_line_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@
7272
expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path) }.to raise_error(Puppet::Error, %r{line is a required attribute})
7373
end
7474
it 'does not require that a line is specified when matching for absence' do
75-
expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error # rubocop:disable Lint/BooleanSymbol, Metrics/LineLength
75+
expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error # rubocop:disable Metrics/LineLength
7676
end
7777
it 'although if a line is specified anyway when matching for absence it still works and the line is silently ignored' do
78-
expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :line => 'i_am_irrelevant', :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error # rubocop:disable Lint/BooleanSymbol, Metrics/LineLength
78+
expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => tmp_path, :line => 'i_am_irrelevant', :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error # rubocop:disable Metrics/LineLength
7979
end
8080
it 'requires that a file is specified' do
8181
expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.to raise_error(Puppet::Error, %r{path is a required attribute})
@@ -84,7 +84,7 @@
8484
expect(file_line[:ensure]).to eq :present
8585
end
8686
it 'defaults to replace => true' do
87-
expect(file_line[:replace]).to eq :true # rubocop:disable Lint/BooleanSymbol
87+
expect(file_line[:replace]).to eq :true
8888
end
8989
it 'defaults to encoding => UTF-8' do
9090
expect(file_line[:encoding]).to eq 'UTF-8'

0 commit comments

Comments
 (0)