WIP: Omnishell error xml if YAML::Tiny not installed on agent
This commit is contained in:
parent
f845cc9478
commit
06442fa6e3
|
@ -556,10 +556,19 @@ BEGIN {
|
||||||
sub runCommand {
|
sub runCommand {
|
||||||
my ($self, $ref, $output_mode) = @_;
|
my ($self, $ref, $output_mode) = @_;
|
||||||
|
|
||||||
|
my $result;
|
||||||
if($self->load_libraries()) {
|
if($self->load_libraries()) {
|
||||||
# Functionality possible.
|
# Functionality possible.
|
||||||
my $command = $self->{'commands'}->{$ref};
|
my $command = $self->{'commands'}->{$ref};
|
||||||
my $result = $self->evaluate_command($ref);
|
$result = $self->evaluate_command($ref);
|
||||||
|
} else {
|
||||||
|
$result = {
|
||||||
|
'stderr' => 'Cannot use commands without YAML dependency, please install it.',
|
||||||
|
'name' => 'YAML::Tiny',
|
||||||
|
'error_level' => 2,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (ref($result) eq "HASH") {
|
if (ref($result) eq "HASH") {
|
||||||
# Process command result.
|
# Process command result.
|
||||||
if (defined($output_mode) && $output_mode eq 'xml') {
|
if (defined($output_mode) && $output_mode eq 'xml') {
|
||||||
|
@ -580,7 +589,6 @@ BEGIN {
|
||||||
} else {
|
} else {
|
||||||
$self->set_last_error('Failed to process ['.$ref.']: '.$result);
|
$self->set_last_error('Failed to process ['.$ref.']: '.$result);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue