| 1 | # | ||||||||||||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||||||||||||
| 3 | # | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | package Rex::Inventory::Hal::Object::Volume; | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | ▶ | use v5.14.4; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 1 | our $VERSION = '1.16.1'; # VERSION | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 1 | ▶ | use Rex::Inventory::Hal::Object; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | 1 | ▶ | use base qw(Rex::Inventory::Hal::Object); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 1 | __PACKAGE__->has( | |||||||||||||||||||
| 17 | [ | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | { key => "block.device", accessor => "dev", }, | ||||||||||||||||||||
| 20 | { key => "volume.size", accessor => "size", }, | ||||||||||||||||||||
| 21 | { key => "volume.fstype", accessor => "fstype" }, | ||||||||||||||||||||
| 22 | { key => "volume.uuid", accessor => "uuid" }, | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | ] | ||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 28 | 0 | my $that = shift; | |||||||||||||||||||
| 29 | 0 | ▶ | my $proto = ref($that) || $that; | ||||||||||||||||||
|
Condition0%0/3
ref $that || $that
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table0%0/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||
| 30 | 0 | my $self = {@_}; | |||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 0 | bless( $self, $proto ); | |||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 0 | return $self; | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 0 | ▶ | sub is_parition { | ||||||||||||||||||
|
Subroutine
is_parition: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 0 | my ($self) = @_; | |||||||||||||||||||
| 40 | 0 | ▶ | return $self->get('volume.is_partition') eq "true" ? 1 : 0; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 0 | ▶ | sub is_mounted { | ||||||||||||||||||
|
Subroutine
is_mounted: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 0 | my ($self) = @_; | |||||||||||||||||||
| 47 | 0 | ▶ | return $self->get('volume.is_mounted') eq "true" ? 1 : 0; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 0 | ▶ | sub is_cdrom { | ||||||||||||||||||
|
Subroutine
is_cdrom: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 0 | my ($self) = @_; | |||||||||||||||||||
| 54 | 0 | ▶ | if ( grep { /^storage\.cdrom$/ } $self->get('info.capabilities') ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 55 | 0 | return 1; | |||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 0 | ▶ | sub is_volume { | ||||||||||||||||||
|
Subroutine
is_volume: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | 0 | my ($self) = @_; | |||||||||||||||||||
| 63 | 0 | ▶ | if ( grep { !/^false$/ } $self->get('block.is_volume') ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 64 | 0 | return 1; | |||||||||||||||||||
| 65 | } | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 0 | ▶ | sub is_floppy { | ||||||||||||||||||
|
Subroutine
is_floppy: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 0 | my ($self) = @_; | |||||||||||||||||||
| 72 | 0 | ▶ | if ( grep { /^floppy$/ } $self->get('storage.drive_type') ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 73 | 0 | return 1; | |||||||||||||||||||
| 74 | } | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | } | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | 1 | 1; | |||||||||||||||||||