Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
Print resources (in addition to outputs) when done deploying
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrizio Branca committed Aug 25, 2016
1 parent ef18aa5 commit ce4f5d6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/StackFormation/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function observeStackActivity($pollInterval = 20)
}, $pollInterval, 1000);

$this->printStatus($lastStatus);
$this->printResources();
$this->printOutputs();
return $lastStatus;
}
Expand All @@ -59,6 +60,26 @@ public function isSuccessfulStatus($status)
return in_array($status, ['CREATE_COMPLETE', 'UPDATE_COMPLETE', Stack::STATUS_STACK_GONE]);
}

protected function printResources()
{
$this->output->writeln("== RESOURCES ==");
try {
$rows = [];
foreach ($this->stack->getResources() as $key => $value) {
$value = strlen($value) > 100 ? substr($value, 0, 100) . "..." : $value;
$rows[] = [$key, $value];
}

$table = new Table($this->output);
$table
->setHeaders(['Key', 'Value'])
->setRows($rows);
$table->render();
} catch (\Exception $e) {
// never mind...
}
}

protected function printOutputs()
{
$this->output->writeln("== OUTPUTS ==");
Expand Down

0 comments on commit ce4f5d6

Please sign in to comment.