| 1 | # | ||||||||||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||||||||||
| 3 | # | ||||||||||||||||||
| 4 | |||||||||||||||||||
| 5 | package Rex::Helper::System; | ||||||||||||||||||
| 6 | |||||||||||||||||||
| 7 | 93 | ▶ | use v5.14.4; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 8 | 93 | ▶ | use warnings; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 9 | |||||||||||||||||||
| 10 | 93 | our $VERSION = '1.16.1'; # VERSION | |||||||||||||||||
| 11 | |||||||||||||||||||
| 12 | 93 | ▶ | use Rex::Helper::Hash; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 13 | |||||||||||||||||||
| 14 | 13 | ▶ | sub info { | ||||||||||||||||
|
Subroutine
info: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||
| 15 | |||||||||||||||||||
| 16 | return ( | ||||||||||||||||||
| 17 | 13 | eval { | |||||||||||||||||
| 18 | 13 | my %merge1 = (); | |||||||||||||||||
| 19 | 13 | my %merge2 = Rex::Hardware->get(qw/ All /); | |||||||||||||||||
| 20 | 9 | my %template_vars = ( %merge1, %merge2 ); | |||||||||||||||||
| 21 | |||||||||||||||||||
| 22 | 9 | for my $info_key (qw(Network Host Kernel Memory Swap)) { | |||||||||||||||||
| 23 | |||||||||||||||||||
| 24 | 45 | my $flatten_info = {}; | |||||||||||||||||
| 25 | |||||||||||||||||||
| 26 | 45 | ▶ | if ( $info_key eq "Memory" ) { | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 27 | 9 | hash_flatten( $merge2{$info_key}, $flatten_info, "_", "memory" ); | |||||||||||||||||
| 28 | } | ||||||||||||||||||
| 29 | elsif ( $info_key eq "Swap" ) { | ||||||||||||||||||
| 30 | 9 | hash_flatten( $merge2{$info_key}, $flatten_info, "_", "swap" ); | |||||||||||||||||
| 31 | } | ||||||||||||||||||
| 32 | elsif ( $info_key eq "Network" ) { | ||||||||||||||||||
| 33 | 9 | hash_flatten( $merge2{$info_key}->{"networkconfiguration"}, | |||||||||||||||||
| 34 | $flatten_info, "_" ); | ||||||||||||||||||
| 35 | } | ||||||||||||||||||
| 36 | else { | ||||||||||||||||||
| 37 | 18 | hash_flatten( $merge2{$info_key}, $flatten_info, "_" ); | |||||||||||||||||
| 38 | } | ||||||||||||||||||
| 39 | |||||||||||||||||||
| 40 | 45 | for my $key ( keys %{$flatten_info} ) { | |||||||||||||||||
| 41 | 234 | $template_vars{$key} = $flatten_info->{$key}; | |||||||||||||||||
| 42 | } | ||||||||||||||||||
| 43 | |||||||||||||||||||
| 44 | } | ||||||||||||||||||
| 45 | |||||||||||||||||||
| 46 | 9 | return %template_vars; | |||||||||||||||||
| 47 | } | ||||||||||||||||||
| 48 | ); | ||||||||||||||||||
| 49 | } | ||||||||||||||||||
| 50 | |||||||||||||||||||
| 51 | 93 | 1; | |||||||||||||||||