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 8aeecbce53
commit 624f3d60e0
6 changed files with 79 additions and 37 deletions

View File

@ -43,19 +43,18 @@ 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', }, "extra-options:s@" => { name => 'extra_options' },
"extra-options:s@" => { name => 'extra_options' }, "special-arg:s@" => { name => 'special_arg' },
"special-arg:s@" => { name => 'special_arg' }, "hostname:s@" => { name => 'hostname' },
"hostname:s@" => { name => 'hostname' }, "hostname2:s@" => { name => 'hostname2' },
"hostname2:s@" => { name => 'hostname2' }, "password:s@" => { name => 'password' },
"password:s@" => { name => 'password' }, "timeout:s@" => { name => 'timeout' },
"timeout:s@" => { name => 'timeout' }, "show-output:s" => { name => 'show_output' },
"show-output:s" => { name => 'show_output' }, });
});
} }
$options{options}->add_help(package => __PACKAGE__, sections => 'SMCLI OPTIONS', once => 1); $options{options}->add_help(package => __PACKAGE__, sections => 'SMCLI OPTIONS', once => 1);
@ -84,15 +83,25 @@ 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}) {
for (my $i = 0; $i < scalar(@{$options{default}->{$_}}); $i++) { if (ref($options{default}->{$_}) eq 'ARRAY') {
foreach my $opt (keys %{$options{default}->{$_}[$i]}) { for (my $i = 0; $i < scalar(@{$options{default}->{$_}}); $i++) {
if (!defined($self->{option_results}->{$opt}[$i])) { foreach my $opt (keys %{$options{default}->{$_}[$i]}) {
$self->{option_results}->{$opt}[$i] = $options{default}->{$_}[$i]->{$opt}; if (!defined($self->{option_results}->{$opt}[$i])) {
$self->{option_results}->{$opt}[$i] = $options{default}->{$_}[$i]->{$opt};
}
}
}
}
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};
} }
} }
} }
} }
} }
} }
sub build_command { sub build_command {

View File

@ -31,10 +31,9 @@ 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', }, });
});
return $self; return $self;
} }

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

@ -32,11 +32,20 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{$self->{modes}} = ( %{$self->{modes}} = (
'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

@ -32,11 +32,20 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{$self->{modes}} = ( %{$self->{modes}} = (
'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

@ -32,11 +32,20 @@ sub new {
$self->{version} = '0.1'; $self->{version} = '0.1';
%{$self->{modes}} = ( %{$self->{modes}} = (
'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;
} }