Skip to content

Commit 18395ba

Browse files
committed
Plumbing logs from tarball into the correct logs parameter.
Signed-off-by: Rob Dobson <[email protected]>
1 parent e4818e7 commit 18395ba

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

hwinfo/tools/inspector.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,10 @@ def main():
412412
validate_args(args)
413413

414414
if args.logs:
415-
host = HostFromLogs(args.logs)
415+
if ".tar" in args.logs:
416+
host = HostFromTarball(args.logs)
417+
else:
418+
host = HostFromLogs(args.logs)
416419
else:
417420
host = Host(args.machine, args.username, args.password)
418421

hwinfo/tools/tests/test_inspector.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,14 @@ def test_validate_local_machine(self):
402402
args.password = None
403403
inspector.validate_args(args)
404404

405+
@patch('hwinfo.tools.inspector.print_system_info')
406+
@patch('hwinfo.tools.inspector.HostFromTarball')
407+
def test_from_tarball(self, host_cls, print_system_info):
408+
sys.argv = ['hwinfo', '-l', 'ack-submission.tar.gz']
409+
mhost = host_cls.return_value = mock.MagicMock()
410+
inspector.main()
411+
host_cls.assert_called_with('ack-submission.tar.gz')
412+
405413
class PrintSystemInfoTests(unittest.TestCase):
406414

407415
@patch('hwinfo.tools.inspector.print_unit')

0 commit comments

Comments
 (0)