This commit is contained in:
qgarnier 2020-10-16 14:52:25 +02:00 committed by GitHub
parent 15fedef013
commit 8e34ef8d10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 0 deletions

View File

@ -40,6 +40,7 @@ sub check {
foreach my $array (@{$self->{results}->{shelve}->{data}}) {
my $array_name = $array->{array_name};
$array_name .= ':' . $array->{serial} if ($self->use_serial());
foreach my $ctrl (@{$array->{ctrlrs}}) {
foreach my $sensor (@{$ctrl->{ctrlr_sensors}}) {

View File

@ -40,6 +40,7 @@ sub check {
foreach my $array (@{$self->{results}->{shelve}->{data}}) {
my $array_name = $array->{array_name};
$array_name .= ':' . $array->{serial} if ($self->use_serial());
foreach my $sensor (@{$array->{chassis_sensors}}) {
next if ($sensor->{type} ne 'power supply');

View File

@ -40,6 +40,7 @@ sub check {
foreach my $array (@{$self->{results}->{shelve}->{data}}) {
my $array_name = $array->{array_name};
$array_name .= ':' . $array->{serial} if ($self->use_serial());
foreach my $ctrl (@{$array->{ctrlrs}}) {
foreach my $sensor (@{$ctrl->{ctrlr_sensors}}) {

View File

@ -73,6 +73,24 @@ sub new {
return $self;
}
sub use_serial {
my ($self, %options) = @_;
return $self->{use_serial} if (defined($self->{use_serial}));
$self->{use_serial} = 0;
my $array_names = {};
foreach (@{$self->{results}->{shelve}->{data}}) {
if (defined($array_names->{ $_->{array_name} })) {
$self->{use_serial} = 1;
last;
}
$array_names->{ $_->{array_name} } = 1;
}
return $self->{use_serial};
}
sub execute_custom {
my ($self, %options) = @_;