Exemplo n.º 1
0
 public function parse_answer($data, Scope $scope)
 {
     foreach ($scope->getVariables() as $var => $val) {
         $data = str_replace('%{' . $var . '}', $val, $data);
     }
     return $data;
 }
Exemplo n.º 2
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $key = $input->getArgument('key');
     $output->write("Hiera-PHP: looking up key `{$key}`\n");
     $scope = new Scope();
     $scope->setVariable('::environment', 'production');
     $scope->setVariable('::clientcert', 'web01.dc1.example.webx');
     $scope->setVariable('::country', 'nl');
     $hiera = new Hiera();
     $loader = new YamlConfigLoader();
     $loader->load($hiera, __DIR__ . '/../../examples/hiera.yaml');
     $answer = $hiera->lookup($key, '#default#', $scope);
     $output->write("Answer: `{$answer}`\n");
 }