mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-22 13:24:24 +02:00
Merge branch 'bugfix/monitoring-beautify-command-transport-errors-8006'
fixes #8006
This commit is contained in:
commit
068bfc0c71
@ -4,6 +4,7 @@
|
|||||||
namespace Icinga\Module\Monitoring\Command\Transport;
|
namespace Icinga\Module\Monitoring\Command\Transport;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use RuntimeException;
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
use Icinga\Exception\ConfigurationError;
|
use Icinga\Exception\ConfigurationError;
|
||||||
use Icinga\Module\Monitoring\Command\Exception\TransportException;
|
use Icinga\Module\Monitoring\Command\Exception\TransportException;
|
||||||
@ -123,11 +124,15 @@ class LocalCommandFile implements CommandTransportInterface
|
|||||||
$file->fwrite($commandString . "\n");
|
$file->fwrite($commandString . "\n");
|
||||||
$file->fflush();
|
$file->fflush();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
$message = $e->getMessage();
|
||||||
|
if ($e instanceof RuntimeException && ($pos = strrpos($message, ':')) !== false) {
|
||||||
|
// Assume RuntimeException thrown by SplFileObject in the format: __METHOD__ . "({$filename}): Message"
|
||||||
|
$message = substr($message, $pos + 1);
|
||||||
|
}
|
||||||
throw new TransportException(
|
throw new TransportException(
|
||||||
'Can\'t send external Icinga command "%s" to the local command file "%s": %s',
|
'Can\'t send external Icinga command to the local command file "%s": %s',
|
||||||
$commandString,
|
|
||||||
$this->path,
|
$this->path,
|
||||||
$e
|
$message
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,8 +201,7 @@ class RemoteCommandFile implements CommandTransportInterface
|
|||||||
exec($ssh, $output, $status);
|
exec($ssh, $output, $status);
|
||||||
if ($status !== 0) {
|
if ($status !== 0) {
|
||||||
throw new TransportException(
|
throw new TransportException(
|
||||||
'Can\'t send external Icinga command "%s": %s',
|
'Can\'t send external Icinga command: %s',
|
||||||
$ssh,
|
|
||||||
implode(' ', $output)
|
implode(' ', $output)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user