line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Armadito::Agent::Tools::Inventory; |
2
|
|
|
|
|
|
|
|
3
|
22
|
|
|
22
|
|
2074623
|
use strict; |
|
22
|
|
|
|
|
26
|
|
|
22
|
|
|
|
|
573
|
|
4
|
22
|
|
|
22
|
|
474
|
use warnings; |
|
22
|
|
|
|
|
29
|
|
|
22
|
|
|
|
|
595
|
|
5
|
22
|
|
|
22
|
|
83
|
use base 'Exporter'; |
|
22
|
|
|
|
|
50
|
|
|
22
|
|
|
|
|
1777
|
|
6
|
|
|
|
|
|
|
|
7
|
22
|
|
|
22
|
|
100
|
use UNIVERSAL::require(); |
|
22
|
|
|
|
|
27
|
|
|
22
|
|
|
|
|
313
|
|
8
|
22
|
|
|
22
|
|
844
|
use Encode; |
|
22
|
|
|
|
|
7885
|
|
|
22
|
|
|
|
|
1454
|
|
9
|
22
|
|
|
22
|
|
97
|
use English qw(-no_match_vars); |
|
22
|
|
|
|
|
26
|
|
|
22
|
|
|
|
|
167
|
|
10
|
|
|
|
|
|
|
|
11
|
22
|
|
|
22
|
|
15234
|
use Armadito::Agent::Tools::File qw(canRun); |
|
22
|
|
|
|
|
48
|
|
|
22
|
|
|
|
|
1094
|
|
12
|
22
|
|
|
22
|
|
7805
|
use Armadito::Agent::Tools::Dmidecode qw(getDmidecodeInfos); |
|
22
|
|
|
|
|
53
|
|
|
22
|
|
|
|
|
4250
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
15
|
|
|
|
|
|
|
getUUID |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub getUUID { |
19
|
0
|
|
|
0
|
1
|
|
my (%params) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
if ( canRun('dmidecode') ) { |
22
|
0
|
|
|
|
|
|
my $infos = getDmidecodeInfos(); |
23
|
0
|
|
|
|
|
|
return $infos->{1}->[0]->{'UUID'}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
if ( $OSNAME eq "MSWin32" ) { |
27
|
0
|
|
|
|
|
|
Armadito::Agent::Tools::Win32->use(qw(getWMIObjects)); |
28
|
0
|
|
|
|
|
|
my ($computer_system_product) = getWMIObjects( |
29
|
|
|
|
|
|
|
class => 'Win32_ComputerSystemProduct', |
30
|
|
|
|
|
|
|
properties => [qw/UUID/] |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if ( $computer_system_product->{UUID} !~ /^[0-]+$/ ) { |
34
|
0
|
|
|
|
|
|
return $computer_system_product->{UUID}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
die "Unable to retrieve UUID."; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Armadito::Agent::Tools::Inventory - basic functions to get some inventory information |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This module provides a generic function to retrieve the UUID for this computer. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 FUNCTIONS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 getUUID() |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Returns UUID for this computer. |