Skip to content

Commit 2f2b74d

Browse files
committed
Fix Lint/NonAtomicFileOperation
Result of: rubocop --autocorrect-all --only Lint/NonAtomicFileOperation This also fixes some deprecated uses of File.exists?
1 parent a1f0ed2 commit 2f2b74d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lib/puppet/provider/katello_ssl_tool.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def create
2020

2121
def destroy
2222
files_to_deploy.each do |file|
23-
File.delete(file) if File.exist?(file)
23+
FileUtils.rm_f(file)
2424
end
2525

2626
output = execute([:rpm, '-q', rpmfile_base_name], failonfail: false)
@@ -53,9 +53,7 @@ def katello_ssl_tool(*args)
5353
end
5454

5555
def generate!
56-
if File.exists?(update_file)
57-
File.delete(update_file)
58-
end
56+
FileUtils.rm_f(update_file)
5957
end
6058

6159
def generate?
@@ -189,7 +187,7 @@ def create
189187
end
190188

191189
def destroy
192-
File.delete(resource[:path]) if File.exist?(resource[:path])
190+
FileUtils.rm_f(resource[:path])
193191
end
194192

195193
protected

lib/puppet/provider/privkey/katello_ssl_tool.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def expected_content
1414
'-passin', "file:#{resource[:password_file]}")
1515
File.read(tmp_file)
1616
ensure
17-
File.delete(tmp_file) if File.exists?(tmp_file)
17+
FileUtils.rm_f(tmp_file)
1818
end
1919
else
2020
super

0 commit comments

Comments
 (0)