fix ssh connection

This commit is contained in:
garnier-quentin 2020-03-24 09:25:13 +01:00
parent c9b1b72a85
commit 9dab364909
3 changed files with 4 additions and 1 deletions

View File

@ -65,6 +65,7 @@ sub execute {
my ($self, %options) = @_;
push @{$self->{ssh_option}}, '-T' if (defined($options{ssh_pipe}) && $options{ssh_pipe} == 1);
$options{command} .= $options{cmd_exit} if (defined($options{cmd_exit}) && $options{cmd_exit} ne '');
my ($content, $exit_code) = centreon::plugins::misc::execute(
output => $self->{output},

View File

@ -67,6 +67,7 @@ sub execute {
my ($self, %options) = @_;
push @{$self->{ssh_option}}, '-T' if (defined($options{ssh_pipe}) && $options{ssh_pipe} == 1);
$options{command} .= $options{cmd_exit} if (defined($options{cmd_exit}) && $options{cmd_exit} ne '');
my ($content, $exit_code) = centreon::plugins::misc::execute(
output => $self->{output},

View File

@ -115,7 +115,8 @@ sub execute_command {
command => defined($self->{option_results}->{command}) && $self->{option_results}->{command} ne '' ? $self->{option_results}->{command} : $self->{ssh_commands},
command_path => $self->{option_results}->{command_path},
command_options => defined($self->{option_results}->{command_options}) && $self->{option_results}->{command_options} ne '' ? $self->{option_results}->{command_options} : undef,
timeout => $self->{option_results}->{timeout}
timeout => $self->{option_results}->{timeout},
cmd_exit => !defined($self->{option_results}->{command}) || $self->{option_results}->{command} eq '' ? "exit\n" : undef
);
} else {
if (!defined($self->{option_results}->{command}) || $self->{option_results}->{command} eq '') {