protected function executeWithBlueprint(Blueprint $blueprint, InputInterface $input, OutputInterface $output) { // trigger resolving all placeholders $this->dependencyTracker->reset(); $blueprint->getPreprocessedTemplate(); $output->writeln("Blueprint '{$blueprint->getName()} depends on following stack's resources/parameters/outputs:"); $table = new Table($output); $table->setHeaders(['Origin (' . $blueprint->getName() . ')', 'Source Stack', 'Field'])->setRows($this->dependencyTracker->getStackDependenciesAsFlatList())->render(); $output->writeln("Blueprint '{$blueprint->getName()} depends on following environment variables:"); $table = new Table($output); $table->setHeaders(['Var', 'Current Value', 'Type', 'Origin (within "' . $blueprint->getName() . '")'])->setRows($this->dependencyTracker->getEnvDependenciesAsFlatList())->render(); }
public function compare() { if (empty($this->stack)) { throw new \InvalidArgumentException('Stack not set'); } if (empty($this->blueprint)) { throw new \InvalidArgumentException('Blueprint not set'); } $tmp = []; try { // parameters if ($this->output->isVerbose()) { $this->output->writeln($this->stack->getName() . ': Comparing parameters'); } $parametersStack = $this->stack->getParameters(); $parametersBlueprint = $this->blueprint->getParameters(true); $parametersBlueprint = Div::flatten($parametersBlueprint, 'ParameterKey', 'ParameterValue'); if ($this->parametersAreEqual($parametersStack, $parametersBlueprint)) { $tmp['parameters'] = "<fg=green>equal</>"; } else { $tmp['parameters'] = "<fg=red>different</>"; $tmp['error'] = true; } // template if ($this->output->isVerbose()) { $this->output->writeln($this->stack->getName() . ': Comparing template'); } $templateStack = trim($this->stack->getTemplate()); $templateBlueprint = trim($this->blueprint->getPreprocessedTemplate()); $templateStack = $this->normalizeJson($templateStack); $templateBlueprint = $this->normalizeJson($templateBlueprint); if ($templateStack === $templateBlueprint) { $tmp['template'] = "<fg=green>equal</>"; } else { $tmp['template'] = "<fg=red>different</>"; $tmp['error'] = true; } } catch (CloudFormationException $e) { $tmp['parameters'] = 'Stack not found'; $tmp['template'] = 'Stack not found'; $tmp['error'] = true; } catch (\Exception $e) { $tmp['parameters'] = '<fg=red>EXCEPTION: ' . $e->getMessage() . '</>'; $tmp['template'] = 'EXCEPTION'; $tmp['error'] = true; } return $tmp; }
protected function executeWithBlueprint(Blueprint $blueprint, InputInterface $input, OutputInterface $output) { $output->writeln($blueprint->getPreprocessedTemplate()); }