Skip to content

Commit 5cd690c

Browse files
apatardphilpep
authored andcommitted
host.py: Fix "which" fallback in find_command
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 <[email protected]>
1 parent 6e24819 commit 5cd690c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

testinfra/host.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def find_command(self, command, extrapaths=("/sbin", "/usr/sbin")):
4444
if out.rc == 0:
4545
return out.stdout.rstrip("\r\n")
4646
if out.rc == 127:
47-
out = self.run_expect([0, 1], "which %s", self.path)
47+
out = self.run_expect([0, 1], "which %s", command)
4848
if out.rc == 0:
4949
return out.stdout.rstrip("\r\n")
5050
for basedir in extrapaths:

0 commit comments

Comments
 (0)