mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 16:24:05 +02:00
parent
79541be050
commit
1786d08321
@ -3,7 +3,7 @@
|
|||||||
namespace Icinga\Module\Director\Forms;
|
namespace Icinga\Module\Director\Forms;
|
||||||
|
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
use Icinga\Module\Director\Core\CoreApi;
|
use Icinga\Module\Director\Core\DeploymentApiInterface;
|
||||||
use Icinga\Module\Director\Db;
|
use Icinga\Module\Director\Db;
|
||||||
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
||||||
// use Icinga\Module\Director\Objects\DirectorDeploymentLog;
|
// use Icinga\Module\Director\Objects\DirectorDeploymentLog;
|
||||||
@ -12,7 +12,7 @@ use Icinga\Module\Director\Web\Form\QuickForm;
|
|||||||
|
|
||||||
class DeployConfigForm extends QuickForm
|
class DeployConfigForm extends QuickForm
|
||||||
{
|
{
|
||||||
/** @var CoreApi */
|
/** @var DeploymentApiInterface */
|
||||||
private $api;
|
private $api;
|
||||||
|
|
||||||
/** @var Db */
|
/** @var Db */
|
||||||
@ -114,7 +114,7 @@ class DeployConfigForm extends QuickForm
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setApi(CoreApi $api)
|
public function setApi(DeploymentApiInterface $api)
|
||||||
{
|
{
|
||||||
$this->api = $api;
|
$this->api = $api;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -11,7 +11,7 @@ use Icinga\Module\Director\Objects\IcingaCommand;
|
|||||||
use Icinga\Module\Director\Objects\DirectorDeploymentLog;
|
use Icinga\Module\Director\Objects\DirectorDeploymentLog;
|
||||||
use Icinga\Module\Director\Objects\IcingaZone;
|
use Icinga\Module\Director\Objects\IcingaZone;
|
||||||
|
|
||||||
class CoreApi
|
class CoreApi implements DeploymentApiInterface
|
||||||
{
|
{
|
||||||
protected $client;
|
protected $client;
|
||||||
|
|
||||||
@ -614,7 +614,7 @@ constants
|
|||||||
$this->client->request('post', $url, null, false, true);
|
$this->client->request('post', $url, null, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dumpConfig(IcingaConfig $config, $db, $moduleName = 'director')
|
public function dumpConfig(IcingaConfig $config, Db $db, $moduleName = 'director')
|
||||||
{
|
{
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
$deployment = DirectorDeploymentLog::create(array(
|
$deployment = DirectorDeploymentLog::create(array(
|
||||||
|
75
library/Director/Core/DeploymentApiInterface.php
Normal file
75
library/Director/Core/DeploymentApiInterface.php
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Icinga\Module\Director\Core;
|
||||||
|
|
||||||
|
use Icinga\Module\Director\Db;
|
||||||
|
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface to a deployment API of the monitoring configuration
|
||||||
|
*
|
||||||
|
* @package Icinga\Module\Director\Core
|
||||||
|
*/
|
||||||
|
interface DeploymentApiInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Collecting log files from the deployment system
|
||||||
|
* and write them into the database.
|
||||||
|
*
|
||||||
|
* @param Db $db
|
||||||
|
*/
|
||||||
|
public function collectLogFiles(Db $db);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup old stages that are collected and not active
|
||||||
|
*
|
||||||
|
* @param Db $db
|
||||||
|
*/
|
||||||
|
public function wipeInactiveStages(Db $db);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the active configuration stage
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getActiveStageName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List files in a named stage
|
||||||
|
*
|
||||||
|
* @param string $stage name of the stage
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function listStageFiles($stage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a raw file from the named stage
|
||||||
|
*
|
||||||
|
* @param string $stage Stage name
|
||||||
|
* @param string $file Relative file path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getStagedFile($stage, $file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explicitly delete a stage
|
||||||
|
*
|
||||||
|
* @param string $moduleName
|
||||||
|
* @param string $stageName
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function deleteStage($moduleName, $stageName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deploy the config and activate it
|
||||||
|
*
|
||||||
|
* @param IcingaConfig $config
|
||||||
|
* @param Db $db
|
||||||
|
* @param string $moduleName
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function dumpConfig(IcingaConfig $config, Db $db, $moduleName = 'director');
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user