public function indexAction() { $this->view->title = $this->translate('Deployment details'); $deploymentId = $this->params->get('id'); $this->view->deployment = $deployment = DirectorDeploymentLog::load($deploymentId, $this->db()); $this->view->config_checksum = Util::binary2hex($deployment->config_checksum); $this->view->config = IcingaConfig::load($deployment->config_checksum, $this->db()); $tabs = $this->getTabs()->add('deployment', array('label' => $this->translate('Deployment'), 'url' => $this->getRequest()->getUrl()))->activate('deployment'); if ($deployment->config_checksum !== null) { $tabs->add('config', array('label' => $this->translate('Config'), 'url' => 'director/config/files', 'urlParams' => array('checksum' => $this->view->config_checksum, 'deployment_id' => $deploymentId))); } }
public function dumpConfig(IcingaConfig $config, $db, $moduleName = 'director') { $start = microtime(true); $data = $config->getFileContents(); $deployment = DirectorDeploymentLog::create(array('peer_identity' => $this->client->getPeerIdentity(), 'start_time' => date('Y-m-d H:i:s'), 'config_checksum' => $config->getChecksum())); $this->assertModuleExists($moduleName); $response = $this->client->post('config/stages/' . $moduleName, array('files' => $config->getFileContents())); $duration = (int) ((microtime(true) - $start) * 1000); // $deployment->duration_ms = $duration; $deployment->duration_dump = $duration; if ($response->succeeded()) { if ($stage = $response->getResult('stage', array('package' => $moduleName))) { // Status? $deployment->stage_name = key($stage); $deployment->dump_succeeded = 'y'; } else { $deployment->dump_succeeded = 'n'; } } else { $deployment->dump_succeeded = 'n'; } $deployment->store($db); return $deployment->dump_succeeded === 'y'; }
public function storeAction() { $config = IcingaConfig::generate($this->db()); $this->redirectNow(Url::fromPath('director/config/show', array('checksum' => $config->getHexChecksum()))); }