Skip to content

Commit

Permalink
host.py: Fix "which" fallback in find_command
Browse files Browse the repository at this point in the history
Commit "Fallback to which when command -v fails" has changed things to call which(1) in find_command
but used "self.path" has argument to which(1), leading to:

E       AttributeError: 'Host' object has no attribute 'path'

Update the call to pass "command" as argument.

Signed-off-by: Arnaud Patard <apatard@hupstream.com>
  • Loading branch information
apatard authored and philpep committed Feb 10, 2022
1 parent 6e24819 commit 5cd690c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion testinfra/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def find_command(self, command, extrapaths=("/sbin", "/usr/sbin")):
if out.rc == 0:
return out.stdout.rstrip("\r\n")
if out.rc == 127:
out = self.run_expect([0, 1], "which %s", self.path)
out = self.run_expect([0, 1], "which %s", command)
if out.rc == 0:
return out.stdout.rstrip("\r\n")
for basedir in extrapaths:
Expand Down

0 comments on commit 5cd690c

Please sign in to comment.