line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Tools::HPUX; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
8624067
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
156
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
133
|
|
5
|
4
|
|
|
4
|
|
22
|
use base 'Exporter'; |
|
4
|
|
|
|
|
32
|
|
|
4
|
|
|
|
|
441
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
17
|
use English qw(-no_match_vars); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
34
|
|
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
2151
|
use FusionInventory::Agent::Tools; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
490
|
|
10
|
4
|
|
|
4
|
|
19
|
use Memoize; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
1395
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw( |
13
|
|
|
|
|
|
|
getInfoFromMachinfo |
14
|
|
|
|
|
|
|
isHPVMGuest |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
memoize('getInfoFromMachinfo'); |
18
|
|
|
|
|
|
|
memoize('isHPVMGuest'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub getInfoFromMachinfo { |
21
|
|
|
|
|
|
|
my (%params) = ( |
22
|
|
|
|
|
|
|
command => '/usr/contrib/bin/machinfo', |
23
|
|
|
|
|
|
|
@_ |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $handle = getFileHandle(%params); |
27
|
|
|
|
|
|
|
return unless $handle; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $info; |
30
|
|
|
|
|
|
|
my $current; |
31
|
|
|
|
|
|
|
while (my $line = <$handle>) { |
32
|
|
|
|
|
|
|
chomp $line; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#key: value |
35
|
|
|
|
|
|
|
if ($line =~ /^ (\S [^:]+) : \s+ (.*\S)/x) { |
36
|
|
|
|
|
|
|
$info->{$1} = $2; |
37
|
|
|
|
|
|
|
next; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# key: value |
41
|
|
|
|
|
|
|
if ($line =~ /^ \s+ (\S [^:]+) : \s+ (.*\S)/x) { |
42
|
|
|
|
|
|
|
$info->{$current}->{lc($1)} = $2; |
43
|
|
|
|
|
|
|
next; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# key = value |
47
|
|
|
|
|
|
|
if ($line =~ /^ \s+ (\S [^=]+) \s+ = \s+ (.*\S)/x) { |
48
|
|
|
|
|
|
|
$info->{$current}->{lc($1)} = $2; |
49
|
|
|
|
|
|
|
next; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# value |
53
|
|
|
|
|
|
|
if ($line =~ /^ \s+ (.*\S)/x) { |
54
|
|
|
|
|
|
|
# hack for CPUinfo: |
55
|
|
|
|
|
|
|
# accumulate new lines if current node is not an hash |
56
|
|
|
|
|
|
|
if ($info->{$current}) { |
57
|
|
|
|
|
|
|
$info->{$current} .= " $1" if ! ref $info->{$current}; |
58
|
|
|
|
|
|
|
} else { |
59
|
|
|
|
|
|
|
$info->{$current} = $1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
next; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#key: |
65
|
|
|
|
|
|
|
if ($line =~ /^ (\S [^:]+) :$/x) { |
66
|
|
|
|
|
|
|
$current = $1; |
67
|
|
|
|
|
|
|
next; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
close $handle; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
return $info; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub isHPVMGuest { |
76
|
|
|
|
|
|
|
return getFirstMatch( |
77
|
|
|
|
|
|
|
command => 'hpvminfo', |
78
|
|
|
|
|
|
|
pattern => qr/HPVM guest/ |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
__END__ |