Skip to content

Commit

Permalink
Use /sbin/rpcinfo only, /usr/sbin/rpcinfo is gone (bsc#1127138).
Browse files Browse the repository at this point in the history
The delimiter in its output is a tab, not a space
  • Loading branch information
mvidner committed Feb 27, 2019
1 parent 0173791 commit de95c92
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/modules/Nfs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -553,20 +553,10 @@ def AutoPackages
# Uses RPC broadcast to mountd.
# @return [Array<String>] a list of hostnames
def ProbeServers
# newer, shinier, better rpcinfo from rpcbind (#450056)
prog_name = "/sbin/rpcinfo"
delim = ""

# fallback from glibc (uses different field separators, grr :( )
# TODO: looks like glibc no longer contain this fallback?
if !FileUtils.Exists(prog_name)
prog_name = "/usr/sbin/rpcinfo"
delim = "-d ' ' "
end

# #71064
# this works also if ICMP broadcasts are ignored
cmd = "#{prog_name} -b mountd 1 | /usr/bin/cut #{delim} -f 2 | /usr/bin/sort -u"
# newer, shinier, better rpcinfo from rpcbind (#450056)
cmd = "/sbin/rpcinfo -b mountd 1 | /usr/bin/cut -f 2 | /usr/bin/sort -u"
out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd))
Ops.get_string(out, "stdout", "").lines.map(&:strip).reject(&:empty?)
end
Expand Down

0 comments on commit de95c92

Please sign in to comment.