Skip to content

Commit 2c4cc7a

Browse files
Stefan Friesephilpep
authored andcommitted
added additional condition to check for busybox existance, added tests for inode and hardlink test
1 parent abb5535 commit 2c4cc7a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

test/test_modules.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,16 @@ def test_file(host):
350350
assert f == host.file("/d/f")
351351
assert not d == f
352352

353+
host.check_output("ln /d/f /d/h")
354+
hardlink = host.file("/d/h")
355+
assert hardlink.is_file
356+
assert not hardlink.is_symlink
357+
assert isinstance(hardlink.inode, int)
358+
assert isinstance(f.inode, int)
359+
assert hardlink.inode == f.inode
360+
assert f == host.file("/d/f")
361+
assert not d == f
362+
353363
host.check_output("rm -f /d/p && mkfifo /d/p")
354364
assert host.file("/d/p").is_pipe
355365

testinfra/modules/process.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ def _get_process_attribute_by_pid(self, pid, name):
109109
def get_module_class(cls, host):
110110
if host.file("/bin/ps").linked_to == "/bin/busybox":
111111
return BusyboxProcess
112-
if host.file("/bin/ps").inode == host.file("/bin/busybox").inode:
113-
return BusyboxProcess
112+
if host.file("/bin/busybox").exists:
113+
if host.file("/bin/ps").inode == host.file("/bin/busybox").inode:
114+
return BusyboxProcess
114115
if host.system_info.type == "linux" or host.system_info.type.endswith("bsd"):
115116
return PosixProcess
116117
raise NotImplementedError

0 commit comments

Comments
 (0)