Skip to content

Commit

Permalink
Use timeout option for ssh-keyscan
Browse files Browse the repository at this point in the history
This will reduce the inventory duration by 4 seconds when ssh-keyscan is present
and no sshd daemon is locally active
  • Loading branch information
g-bougard committed Nov 16, 2017
1 parent eeefc59 commit 161a2ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/FusionInventory/Agent/Task/Inventory/Generic/SSH.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ sub doInventory {

my $inventory = $params{inventory};

# Use a 1 second timeout instead of default 5 seconds as this is still
# large enough for loopback ssh pubkey scan.
my $ssh_key = getFirstMatch(
command => 'ssh-keyscan 127.0.0.1',
command => 'ssh-keyscan -T 1 127.0.0.1',
pattern => qr/^[^#]\S+\s(ssh.*)/,
@_,
);
Expand Down

0 comments on commit 161a2ea

Please sign in to comment.