line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Generic::SSH; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
127802888
|
use strict; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
58
|
|
4
|
1
|
|
|
1
|
|
18
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
73
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
847
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
349
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub isEnabled { |
9
|
0
|
|
|
0
|
0
|
|
return canRun('ssh-keyscan'); |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub doInventory { |
13
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $inventory = $params{inventory}; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $ssh_key = getFirstMatch( |
18
|
|
|
|
|
|
|
command => 'ssh-keyscan 127.0.0.1', |
19
|
|
|
|
|
|
|
pattern => qr/^[^#]\S+\s(ssh.*)/, |
20
|
|
|
|
|
|
|
@_, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$inventory->setOperatingSystem({ |
24
|
|
|
|
|
|
|
SSH_KEY => $ssh_key |
25
|
|
|
|
|
|
|
}); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |