Skip to content

Commit aa69c4c

Browse files
(PA-7815) Rubocop changes for template 3.5.1
1 parent 68541d8 commit aa69c4c

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

lib/puppet/provider/cron/filetype.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def path=(user)
3434
begin
3535
@uid = Puppet::Util.uid(user)
3636
rescue Puppet::Error => detail
37-
raise FileReadError, _('Could not retrieve user %{user}: %{detail}') % { user: user, detail: detail }, detail.backtrace
37+
raise FileReadError, _('Could not retrieve user %{user}: %{detail}') % ({ user:, detail: }), detail.backtrace
3838
end
3939

4040
# XXX We have to have the user name, not the uid, because some
@@ -60,7 +60,7 @@ def read
6060

6161
''
6262
else
63-
raise FileReadError, _('Could not read crontab for %{path}: %{detail}') % { path: @path, detail: detail }, detail.backtrace
63+
raise FileReadError, _('Could not read crontab for %{path}: %{detail}') % ({ path: @path, detail: }), detail.backtrace
6464
end
6565
end
6666

@@ -123,15 +123,15 @@ def read
123123

124124
''
125125
else
126-
raise FileReadError, _('Could not read crontab for %{path}: %{detail}') % { path: @path, detail: detail }, detail.backtrace
126+
raise FileReadError, _('Could not read crontab for %{path}: %{detail}') % ({ path: @path, detail: }), detail.backtrace
127127
end
128128
end
129129

130130
# Remove a specific @path's cron tab.
131131
def remove
132132
Puppet::Util::Execution.execute(['crontab', '-r'], cronargs).to_s
133133
rescue => detail
134-
raise FileReadError, _('Could not remove crontab for %{path}: %{detail}') % { path: @path, detail: detail }, detail.backtrace
134+
raise FileReadError, _('Could not remove crontab for %{path}: %{detail}') % ({ path: @path, detail: }), detail.backtrace
135135
end
136136

137137
# Overwrite a specific @path's cron tab; must be passed the @path name
@@ -146,7 +146,7 @@ def write(text)
146146
File.chown(Puppet::Util.uid(@path), nil, output_file.path)
147147
Puppet::Util::Execution.execute(['crontab', output_file.path], cronargs).to_s
148148
rescue => detail
149-
raise FileReadError, _('Could not write crontab for %{path}: %{detail}') % { path: @path, detail: detail }, detail.backtrace
149+
raise FileReadError, _('Could not write crontab for %{path}: %{detail}') % ({ path: @path, detail: }), detail.backtrace
150150
ensure
151151
output_file.close
152152
output_file.unlink
@@ -174,15 +174,15 @@ def read
174174

175175
''
176176
else
177-
raise FileReadError, _('Could not read crontab for %{path}: %{detail}') % { path: @path, detail: detail }, detail.backtrace
177+
raise FileReadError, _('Could not read crontab for %{path}: %{detail}') % ({ path: @path, detail: }), detail.backtrace
178178
end
179179
end
180180

181181
# Remove a specific @path's cron tab.
182182
def remove
183183
Puppet::Util::Execution.execute(['crontab', '-r'], cronargs).to_s
184184
rescue => detail
185-
raise FileReadError, _('Could not remove crontab for %{path}: %{detail}') % { path: @path, detail: detail }, detail.backtrace
185+
raise FileReadError, _('Could not remove crontab for %{path}: %{detail}') % ({ path: @path, detail: }), detail.backtrace
186186
end
187187

188188
# Overwrite a specific @path's cron tab; must be passed the @path name
@@ -198,7 +198,7 @@ def write(text)
198198
File.chown(Puppet::Util.uid(@path), nil, output_file.path)
199199
Puppet::Util::Execution.execute(['crontab', output_file.path], cronargs).to_s
200200
rescue => detail
201-
raise FileReadError, _('Could not write crontab for %{path}: %{detail}') % { path: @path, detail: detail }, detail.backtrace
201+
raise FileReadError, _('Could not write crontab for %{path}: %{detail}') % ({ path: @path, detail: }), detail.backtrace
202202
ensure
203203
output_file.close
204204
output_file.unlink

lib/puppet/type/cron.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def should=(ary)
186186
retval = alphacheck(value, alpha)
187187
end
188188

189-
raise _('%{value} is not a valid %{name}') % { value: value, name: self.class.name } unless retval
189+
raise _('%{value} is not a valid %{name}') % { value:, name: self.class.name } unless retval
190190
return retval.to_s if retval
191191
end
192192
end
@@ -417,7 +417,7 @@ def should_to_s(newvalue = @should)
417417
[:minute, :hour, :weekday, :monthday, :month].each do |field|
418418
next unless self[field]
419419
next if self[field] == :absent
420-
raise ArgumentError, _('%{cron} cannot specify both a special schedule and a value for %{field}') % { cron: ref, field: field }
420+
raise ArgumentError, _('%{cron} cannot specify both a special schedule and a value for %{field}') % ({ cron: ref, field: })
421421
end
422422
end
423423

spec/spec_helper_acceptance.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def run_puppet_install_helper
109109

110110
agent_sha = ENV['BEAKER_PUPPET_AGENT_SHA'] || ENV['PUPPET_AGENT_SHA']
111111
if agent_sha.nil? || agent_sha.empty?
112-
install_puppet_agent_on(hosts, options.merge(version: version))
112+
install_puppet_agent_on(hosts, options.merge(version:))
113113
else
114114
# If we have a development sha, assume we're testing internally
115115
dev_builds_url = ENV['DEV_BUILDS_URL'] || 'http://builds.delivery.puppetlabs.net'

spec/unit/provider/cron/crontab_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def compare_crontab_record(have, want)
3434

3535
########################################################################
3636
# Simple input fixtures for testing.
37-
samples = YAML.load(File.read(my_fixture('single_line.yaml'))) # rubocop:disable Security/YAMLLoad
37+
samples = YAML.load(File.read(my_fixture('single_line.yaml')))
3838

3939
samples.each do |name, data|
4040
it "parses crontab line #{name} correctly" do

spec/unit/provider/cron/filetype_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
let(:managedtab) { File.read(my_fixture('managed_output')) }
1010
let(:options) { { failonfail: true, combine: true } }
1111
let(:uid) { 'no_such_user' }
12-
let(:user_options) { options.merge(uid: uid) }
12+
let(:user_options) { options.merge(uid:) }
1313

1414
it 'exists' do
1515
expect(type).not_to be_nil

spec/unit/provider/cron/parsed_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
name: 'basic',
1616
command: '/bin/true',
1717
target: 'root',
18-
provider: provider,
18+
provider:,
1919
)
2020
end
2121

@@ -173,7 +173,7 @@
173173
month: :absent,
174174
weekday: :absent,
175175
monthday: :absent,
176-
special: special,
176+
special:,
177177
command: '/bin/true')
178178
end
179179
end

0 commit comments

Comments
 (0)