From 37bdface5c3bd487662a48dacf1acbeb4feef14a Mon Sep 17 00:00:00 2001 From: dmaiocchi Date: Mon, 22 Feb 2021 12:27:57 +0100 Subject: [PATCH] Remove unnecessary chmod --- hawk/app/lib/crm_script.rb | 1 - hawk/app/lib/invoker.rb | 5 ----- hawk/app/models/report.rb | 1 - 3 files changed, 7 deletions(-) diff --git a/hawk/app/lib/crm_script.rb b/hawk/app/lib/crm_script.rb index f6e3fa66d..135c06a6d 100644 --- a/hawk/app/lib/crm_script.rb +++ b/hawk/app/lib/crm_script.rb @@ -45,7 +45,6 @@ def run(jsondata, rootpw) tmpf = Tempfile.new 'crmscript' tmpf.write("script json \"#{cmd}\"") tmpf.close - File.chmod(0666, tmpf.path) if rootpw.nil? cmdline = ['/usr/sbin/hawk_invoke', user, 'crm', '-f', tmpf.path] diff --git a/hawk/app/lib/invoker.rb b/hawk/app/lib/invoker.rb index f4a86975a..3ae62722b 100644 --- a/hawk/app/lib/invoker.rb +++ b/hawk/app/lib/invoker.rb @@ -62,11 +62,6 @@ def crm_configure_load_update(cmd) begin f << cmd f.close - # Evil to allow unprivileged user running crm shell to read the file - # TODO(should): can we just allow group (probably ok live, but no - # good for testing when running as root), or some other alternative - # with piping data to crm? - File.chmod(0666, f.path) CrmEvents.instance.push "crm configure\n#{cmd}\n" unless @no_log result = crm '-F', 'configure', 'load', 'update', f.path ensure diff --git a/hawk/app/models/report.rb b/hawk/app/models/report.rb index 9d0372586..ca7ac131c 100644 --- a/hawk/app/models/report.rb +++ b/hawk/app/models/report.rb @@ -144,7 +144,6 @@ def graph(hb_report, path, format = :svg) require "tempfile" tmpfile = Tempfile.new("hawk_dot") tmpfile.close - File.chmod(0666, tmpfile.path) _out, err, status = Util.run_as('hacluster', 'crm_simulate', '-x', tpath.to_s, format == :xml ? "-G" : "-D", tmpfile.path.to_s) rc = status.exitstatus