Skip to content

Commit

Permalink
added discover command
Browse files Browse the repository at this point in the history
  • Loading branch information
pgodel committed Jul 19, 2012
1 parent 8fa6c75 commit 9cec424
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Binary file modified sgcli.phar
Binary file not shown.
34 changes: 34 additions & 0 deletions src/ServerGrove/Cli/Command/ShellCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class ShellCommand extends Command
'stop' => 'Stop an application. It will ask for confirmation.',
'start' => 'Start an application.',
'exec' => 'Execute a command in the server',
'discover' => 'Sends a discover request to server, which will update server and apps information.',
'login' => 'Login with a different set of credentials',
);

Expand Down Expand Up @@ -642,6 +643,39 @@ protected function executeExec($args)
return true;
}

protected function executeDiscover($args)
{
if (count($args) == 1) {
if (!$this->selectServer($args[0])) {
return false;
}
}

if (!$this->server) {
if (!$this->selectServer()) {
return $this->error("No server selected. Please select a server with 'server [name]'.");
}
}

$serverId = $this->server['id'];

$this->info("Sending request...");
if (!$res = $this->call('server/discover', array(
'serverId' => $serverId,
'async' => 0,
))) {
return false;
}

if (false === $rsp = $this->client->getResponse(APIClient::FORMAT_ARRAY)) {
return false;
}

$this->output->writeln('Done.');

return true;
}

protected function executeReboot($args)
{
if (count($args) == 1) {
Expand Down

0 comments on commit 9cec424

Please sign in to comment.