mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
HostController: simplify code
This commit is contained in:
parent
a1ed3f4be5
commit
0506bf2b64
@ -335,23 +335,28 @@ class HostController extends ObjectController
|
|||||||
|
|
||||||
public function agentAction()
|
public function agentAction()
|
||||||
{
|
{
|
||||||
switch ($this->params->get('download')) {
|
if ($os = $this->params->get('download')) {
|
||||||
case 'windows-kickstart':
|
|
||||||
header('Content-type: application/octet-stream');
|
|
||||||
header('Content-Disposition: attachment; filename=icinga2-agent-kickstart.ps1');
|
|
||||||
|
|
||||||
$wizard = $this->view->wizard = new AgentWizard($this->object);
|
$wizard = new AgentWizard($this->object);
|
||||||
$wizard->setTicketSalt($this->api()->getTicketSalt());
|
$wizard->setTicketSalt($this->api()->getTicketSalt());
|
||||||
echo preg_replace('/\n/', "\r\n", $wizard->renderWindowsInstaller());
|
|
||||||
exit;
|
|
||||||
case 'linux':
|
|
||||||
header('Content-type: application/octet-stream');
|
|
||||||
header('Content-Disposition: attachment; filename=icinga2-agent-kickstart.bash');
|
|
||||||
|
|
||||||
$wizard = $this->view->wizard = new AgentWizard($this->object);
|
switch ($os) {
|
||||||
$wizard->setTicketSalt($this->api()->getTicketSalt());
|
case 'windows-kickstart':
|
||||||
echo $wizard->renderLinuxInstaller();
|
$ext = 'ps1';
|
||||||
exit;
|
$script = preg_replace('/\n/', "\r\n", $wizard->renderWindowsInstaller());
|
||||||
|
break;
|
||||||
|
case 'linux':
|
||||||
|
$ext = 'bash';
|
||||||
|
$script = $wizard->renderLinuxInstaller();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new NotFoundError('There is no kickstart helper for %s', $os);
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Content-type: application/octet-stream');
|
||||||
|
header('Content-Disposition: attachment; filename=icinga2-agent-kickstart.' . $ext);
|
||||||
|
echo $script;
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->gracefullyActivateTab('agent');
|
$this->gracefullyActivateTab('agent');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user