Skip to content

Commit c5ff432

Browse files
Merge pull request #291 from aleksei-burlakov/prepend-usr-sbin
Fix: prepend all executable with /usr/sbin
2 parents 0abbc12 + 47a184e commit c5ff432

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

hawk/app/lib/crm_script.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def run(jsondata)
4545
tmpf = Tempfile.new 'crmscript'
4646
tmpf.write("script json \"#{cmd}\"")
4747
tmpf.close
48-
cmdline = ['crm', '-f', tmpf.path]
48+
cmdline = ['/usr/sbin/crm', '-f', tmpf.path]
4949
old_home = Util.ensure_home_for(user)
5050
out, err, status = Util.capture3(*cmdline)
5151
tmpf.unlink

hawk/app/lib/hb_report.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def generate(from_time, to_time, all_nodes = true)
115115
args.push("-Q") # Requires a version of crm report which supports this
116116
args.push("-S") unless all_nodes
117117
args.push(@path)
118-
out, err, status = Util.capture3('crm', "report", *args)
118+
out, err, status = Util.capture3('/usr/sbin/crm', "report", *args)
119119
f = File.new(@outfile, "w")
120120
f.write(out)
121121
f.close

hawk/app/lib/invoker.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def crm_configure_load_update(cmd)
6262
begin
6363
f << cmd
6464
f.close
65-
CrmEvents.instance.push "crm configure\n#{cmd}\n" unless @no_log
65+
CrmEvents.instance.push "/usr/sbin/crm configure\n#{cmd}\n" unless @no_log
6666
result = crm '-F', 'configure', 'load', 'update', f.path
6767
ensure
6868
f.unlink
@@ -73,7 +73,7 @@ def crm_configure_load_update(cmd)
7373
# Invoke cibadmin with command line arguments. Returns stdout as string,
7474
# Raises NotFoundError, SecurityError or RuntimeError on failure.
7575
def cibadmin(*cmd)
76-
out, err, status = Util.run_as(current_user, current_pass, 'cibadmin', *cmd)
76+
out, err, status = Util.run_as(current_user, current_pass, '/usr/sbin/cibadmin', *cmd)
7777
case status.exitstatus
7878
when 0
7979
return out
@@ -89,23 +89,23 @@ def cibadmin(*cmd)
8989

9090
# Invoke "cibadmin -p --replace"
9191
def cibadmin_replace(xml)
92-
CrmEvents.instance.push "cibadmin -p --replace <<EOF\n#{xml}\nEOF" unless @no_log
92+
CrmEvents.instance.push "/usr/sbin/cibadmin -p --replace <<EOF\n#{xml}\nEOF" unless @no_log
9393
cibadmin '-p', '--replace', stdin_data: xml
9494
end
9595

9696
def cibadmin_replace_xpath(xpath, xml)
97-
CrmEvents.instance.push "cibadmin -p --replace --xpath #{xpath} <<EOF\n#{xml}\nEOF" unless @no_log
97+
CrmEvents.instance.push "/usr/sbin/cibadmin -p --replace --xpath #{xpath} <<EOF\n#{xml}\nEOF" unless @no_log
9898
cibadmin '-p', '--replace', '--xpath', xpath, stdin_data: xml
9999
end
100100

101101
def cibadmin_modify(xml)
102-
CrmEvents.instance.push "cibadmin -p -c --modify <<EOF\n#{xml}\nEOF" unless @no_log
102+
CrmEvents.instance.push "/usr/sbin/cibadmin -p -c --modify <<EOF\n#{xml}\nEOF" unless @no_log
103103
cibadmin '-p', '-c', '--modify', stdin_data: xml
104104
end
105105

106106
# Used by the simulator
107107
def crm_simulate(*cmd)
108-
Util.run_as(current_user, current_pass, 'crm_simulate', *cmd)
108+
Util.run_as(current_user, current_pass, '/usr/sbin/crm_simulate', *cmd)
109109
end
110110

111111
private
@@ -132,7 +132,7 @@ def invoke_crm(input, *cmd)
132132
end
133133
cmd << { stdin_data: input }
134134

135-
out, err, status = Util.run_as(current_user, current_pass, 'crm', *cmd)
135+
out, err, status = Util.run_as(current_user, current_pass, '/usr/sbin/crm', *cmd)
136136
[out, fudge_error(status.exitstatus, err), status.exitstatus]
137137
end
138138

hawk/app/models/cib.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def initialize(id, user, pass, use_file = false, stonithwarning = false)
511511
init_offline_cluster id, user, use_file
512512
return
513513
end
514-
out, err, status = Util.run_as(user, pass, 'cibadmin', '-Ql')
514+
out, err, status = Util.run_as(user, pass, '/usr/sbin/cibadmin', '-Ql')
515515
case status.exitstatus
516516
when 0
517517
@xml = REXML::Document.new(out)
@@ -1125,7 +1125,7 @@ def initialize(id, user, pass, use_file = false, stonithwarning = false)
11251125
resource_node = REXML::XPath.first(elem, "ancestor::primitive")
11261126
if booth_resource_id != resource_node.attributes["id"]
11271127
booth_resource_id = resource_node.attributes["id"]
1128-
ip = Util.safe_x('crm_resource', '-r', "#{booth_resource_id}", '-g', 'ip').strip
1128+
ip = Util.safe_x('/usr/sbin/crm_resource', '-r', "#{booth_resource_id}", '-g', 'ip').strip
11291129
next unless @booth[:sites].include?(ip)
11301130

11311131
if !@booth[:me]

hawk/app/models/cluster.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def cluster_copy(clusters)
102102
fname = "#{Rails.root}/tmp/dashboard.js"
103103
File.open(fname, "w") { |f| f.write(JSON.pretty_generate(clusters)) }
104104
File.chmod(0660, fname)
105-
out, err, rc = Util.capture3("crm", "cluster", "copy", fname)
105+
out, err, rc = Util.capture3("/usr/sbin/crm", "cluster", "copy", fname)
106106
Rails.logger.debug "Copy: #{out} #{err} #{rc}"
107107
# always succeed here: we don't really care that much if the copy succeeded or not
108108
true

hawk/app/models/report.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def transitions(hb_report)
8585
end
8686

8787
def peinput_version(path)
88-
nvpair = Util.safe_x("CIB_file=\"#{path}\"", 'cibadmin', '-Q', '--xpath', "/cib/configuration//crm_config//nvpair[@name='dc-version']", '2>/dev/null')
88+
nvpair = Util.safe_x("CIB_file=\"#{path}\"", '/usr/sbin/cibadmin', '-Q', '--xpath', "/cib/configuration//crm_config//nvpair[@name='dc-version']", '2>/dev/null')
8989
m = nvpair.match(/value="([^"]+)"/)
9090
return nil unless m
9191
m[1]
@@ -144,7 +144,7 @@ def graph(hb_report, path, format = :svg)
144144
require "tempfile"
145145
tmpfile = Tempfile.new("hawk_dot")
146146
tmpfile.close
147-
_out, err, status = Util.capture3('crm_simulate', '-x', tpath.to_s, format == :xml ? "-G" : "-D", tmpfile.path.to_s)
147+
_out, err, status = Util.capture3('/usr/sbin/crm_simulate', '-x', tpath.to_s, format == :xml ? "-G" : "-D", tmpfile.path.to_s)
148148
rc = status.exitstatus
149149

150150
ret = [false, err]

hawk/app/models/wizard.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def verify(params)
7272
end
7373

7474
def command_string
75-
base = ["crm", "script", "run", @name]
75+
base = ["/usr/sbin/crm", "script", "run", @name]
7676
@params.each do |k, v|
7777
if v.is_a? Hash
7878
v.each do |kk, vv|

0 commit comments

Comments
 (0)