From 050d8a27ac90671ddd4bdf840476fd9d43b32201 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 29 Apr 2012 07:56:26 +0200 Subject: [PATCH] Test exceptions --- frontend/classes/class.node.php | 2 +- frontend/classes/class.sshconnector.php | 4 ++-- frontend/includes/include.exceptions.php | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/classes/class.node.php b/frontend/classes/class.node.php index 5ca3633..f842952 100644 --- a/frontend/classes/class.node.php +++ b/frontend/classes/class.node.php @@ -74,7 +74,7 @@ class Node extends CPHPDatabaseRecordClass public function GetHostname() { - return $this->ssh->RunCommandCached("hostname")->stdout; + return $this->ssh->RunCommandCached("hostname2", true)->stdout; } } diff --git a/frontend/classes/class.sshconnector.php b/frontend/classes/class.sshconnector.php index b9114a9..d60fefb 100644 --- a/frontend/classes/class.sshconnector.php +++ b/frontend/classes/class.sshconnector.php @@ -30,7 +30,7 @@ class SshConnector extends CPHPBaseClass private $cache = ""; - public function RunCommand($command, $throw_exception) + public function RunCommand($command, $throw_exception = false) { try { @@ -56,7 +56,7 @@ class SshConnector extends CPHPBaseClass } } - public function RunCommandCached($command, $throw_exception) + public function RunCommandCached($command, $throw_exception = false) { if(!isset($this->cache[$command])) { diff --git a/frontend/includes/include.exceptions.php b/frontend/includes/include.exceptions.php index e975043..c7f0f8d 100644 --- a/frontend/includes/include.exceptions.php +++ b/frontend/includes/include.exceptions.php @@ -14,4 +14,5 @@ class SshConnectException extends Exception {} class SshAuthException extends Exception {} class SshCommandException extends Exception {} +class SshExitException extends Exception {} ?>