line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Generic::SSH; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
100407226
|
use strict; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
101
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
65
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
482
|
use FusionInventory::Agent::Tools; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
224
|
|
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; |