From c9dbc8eb7779d25e6a66af4d1916decc11e6f64e Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 7 May 2012 02:29:57 +0200 Subject: [PATCH] Add RunCommand and RunCommandCached methods to Container class --- frontend/classes/class.container.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/classes/class.container.php b/frontend/classes/class.container.php index 254f483..a5d80d4 100644 --- a/frontend/classes/class.container.php +++ b/frontend/classes/class.container.php @@ -144,7 +144,7 @@ class Container extends CPHPDatabaseRecordClass public function GetDisk() { - $result = $this->sNode->ssh->RunCommandCached("vzctl exec {$this->sInternalId} df -l -x tmpfs", true); + $result = $this->RunCommandCached("df -l -x tmpfs", true); $lines = explode("\n", $result->stdout); array_shift($lines); @@ -172,6 +172,16 @@ class Container extends CPHPDatabaseRecordClass ); } + public function RunCommand($command, $throw_exception = false) + { + return $this->sNode->ssh->RunCommand("vzctl exec {$this->sInternalId} $command", $throw_exception); + } + + public function RunCommandCached($command, $throw_exception = false) + { + return $this->sNode->ssh->RunCommandCached("vzctl exec {$this->sInternalId} $command", $throw_exception); + } + public function Deploy($conf = array()) { $sRootPassword = random_string(20);