public function indexAction(Request $request, Application $app) { $requestVars = $request->request->all(); $requestVars['server']['locale'] = $this->extractLocale($request->getLanguages()); $inventory = $this->getInventory($requestVars); $varsFile = new VarfileRenderer('all'); $playbook = new PlaybookRenderer(); // @todo fix str_replace $playbook->setVarsFilename(str_replace('ansible/', '', $varsFile->getFilePath())); $this->getVagrantBundle()->setPlaybook($playbook)->setVarsFile($varsFile)->setInventory($inventory); $app['roles']->setupRole($requestVars, $this->getVagrantBundle()); $playbook->addRole('app'); $zipPath = tempnam(sys_get_temp_dir(), "phansible_bundle_"); if ($this->getVagrantBundle()->generateBundle($zipPath, $playbook->getRoles())) { $vagrantfile = $this->getVagrantBundle()->getVagrantFile(); return $this->outputBundle($zipPath, $app, $vagrantfile->getName()); } return new Response('An error occurred.'); }
/** * @covers Phansible\Renderer\VarfileRenderer::getFilePath */ public function testGetFilePath() { $path = 'ansible/vars/common.yml'; $this->assertEquals($path, $this->model->getFilePath()); }