fix: set custom path for ibm ds and dell md

This commit is contained in:
garnier-quentin 2019-02-28 14:22:50 +01:00
parent cf6a1b1fef
commit 871d60e2ec
6 changed files with 79 additions and 37 deletions

View File

@ -43,8 +43,7 @@ sub new {
} }
if (!defined($options{noptions})) { if (!defined($options{noptions})) {
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{
"smcli-command:s" => { name => 'smcli_command', default => 'SMcli' }, "smcli-command:s" => { name => 'smcli_command', default => 'SMcli' },
"smcli-path:s" => { name => 'smcli_path', }, "smcli-path:s" => { name => 'smcli_path', },
"sudo:s" => { name => 'sudo', }, "sudo:s" => { name => 'sudo', },
@ -84,6 +83,7 @@ sub set_defaults {
# Manage default value # Manage default value
foreach (keys %{$options{default}}) { foreach (keys %{$options{default}}) {
if ($_ eq $self->{mode}) { if ($_ eq $self->{mode}) {
if (ref($options{default}->{$_}) eq 'ARRAY') {
for (my $i = 0; $i < scalar(@{$options{default}->{$_}}); $i++) { for (my $i = 0; $i < scalar(@{$options{default}->{$_}}); $i++) {
foreach my $opt (keys %{$options{default}->{$_}[$i]}) { foreach my $opt (keys %{$options{default}->{$_}[$i]}) {
if (!defined($self->{option_results}->{$opt}[$i])) { if (!defined($self->{option_results}->{$opt}[$i])) {
@ -92,6 +92,15 @@ sub set_defaults {
} }
} }
} }
if (ref($options{default}->{$_}) eq 'HASH') {
foreach my $opt (keys %{$options{default}->{$_}}) {
if (!defined($self->{option_results}->{$opt})) {
$self->{option_results}->{$opt} = $options{default}->{$_}->{$opt};
}
}
}
}
} }
} }

View File

@ -31,8 +31,7 @@ sub new {
bless $self, $class; bless $self, $class;
$self->{version} = '1.0'; $self->{version} = '1.0';
$options{options}->add_options(arguments => $options{options}->add_options(arguments => {
{
"storage-command:s" => { name => 'storage_command', }, "storage-command:s" => { name => 'storage_command', },
}); });

View File

@ -35,9 +35,16 @@ sub new {
'health-status' => 'centreon::common::smcli::mode::healthstatus', 'health-status' => 'centreon::common::smcli::mode::healthstatus',
); );
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom'; $self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
$self->{default} = { 'health-status' => { storage_command => 'show storageArray healthstatus;', $self->{default} = {
smcli_path => '/opt/dell/mdstoragemanager/client' }, }; 'health-status' => {
storage_command => 'show storageArray healthstatus;',
}
};
$self->{customdefault} = {
'smcli' => {
smcli_path => '/opt/dell/mdstoragemanager/client',
}
};
return $self; return $self;
} }

View File

@ -35,8 +35,17 @@ sub new {
'health-status' => 'centreon::common::smcli::mode::healthstatus', 'health-status' => 'centreon::common::smcli::mode::healthstatus',
); );
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom'; $self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
$self->{default} = { 'health-status' => { storage_command => 'show storageSubsystem healthstatus;',
smcli_path => '/opt/IBM_DS/client' }, }; $self->{default} = {
'health-status' => {
storage_command => 'show storageSubsystem healthstatus;',
}
};
$self->{customdefault} = {
'smcli' => {
smcli_path => '/opt/IBM_DS/client',
}
};
return $self; return $self;
} }

View File

@ -35,8 +35,17 @@ sub new {
'health-status' => 'centreon::common::smcli::mode::healthstatus', 'health-status' => 'centreon::common::smcli::mode::healthstatus',
); );
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom'; $self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
$self->{default} = { 'health-status' => { storage_command => 'show storageSubsystem healthstatus;',
smcli_path => '/opt/IBM_DS/client' }, }; $self->{default} = {
'health-status' => {
storage_command => 'show storageSubsystem healthstatus;',
}
};
$self->{customdefault} = {
'smcli' => {
smcli_path => '/opt/IBM_DS/client',
}
};
return $self; return $self;
} }

View File

@ -35,8 +35,17 @@ sub new {
'health-status' => 'centreon::common::smcli::mode::healthstatus', 'health-status' => 'centreon::common::smcli::mode::healthstatus',
); );
$self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom'; $self->{custom_modes}{smcli} = 'centreon::common::smcli::custom::custom';
$self->{default} = { 'health-status' => { storage_command => 'show storageSubsystem healthstatus;',
smcli_path => '/opt/IBM_DS/client' }, }; $self->{default} = {
'health-status' => {
storage_command => 'show storageSubsystem healthstatus;',
}
};
$self->{customdefault} = {
'smcli' => {
smcli_path => '/opt/IBM_DS/client',
}
};
return $self; return $self;
} }