/usr/share/perl5/Rex/Helper/System.pm is in rex 1.4.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #
# (c) Jan Gehring <jan.gehring@gmail.com>
#
# vim: set ts=2 sw=2 tw=0:
# vim: set expandtab:
package Rex::Helper::System;
use strict;
use warnings;
our $VERSION = '1.4.1'; # VERSION
use Rex::Helper::Hash;
sub info {
return (
eval {
my %merge1 = ();
my %merge2 = Rex::Hardware->get(qw/ All /);
my %template_vars = ( %merge1, %merge2 );
for my $info_key (qw(Network Host Kernel Memory Swap)) {
my $flatten_info = {};
if ( $info_key eq "Memory" ) {
hash_flatten( $merge2{$info_key}, $flatten_info, "_", "memory" );
}
elsif ( $info_key eq "Swap" ) {
hash_flatten( $merge2{$info_key}, $flatten_info, "_", "swap" );
}
elsif ( $info_key eq "Network" ) {
hash_flatten( $merge2{$info_key}->{"networkconfiguration"},
$flatten_info, "_" );
}
else {
hash_flatten( $merge2{$info_key}, $flatten_info, "_" );
}
for my $key ( keys %{$flatten_info} ) {
$template_vars{$key} = $flatten_info->{$key};
}
}
return %template_vars;
}
);
}
1;
|