Private GIT

Skip to content
Snippets Groups Projects
Commit 725de26a authored by Laurent Pinsivy's avatar Laurent Pinsivy Committed by Kevin Duret
Browse files

fix(conf): Insert info in log_action when user use deployservices function (#6191)

parent d9d4cf25
No related branches found
No related tags found
No related merge requests found
......@@ -898,11 +898,20 @@ class CentreonHost extends CentreonObject
);
$result = $res->fetchAll();
if (!count($result)) {
$svcId = $svcObj->insert(array('service_description' => $params['service_alias'],
$serviceDesc = array('service_description' => $params['service_alias'],
'service_activate' => '1',
'service_register' => '1',
'service_template_model_stm_id' => $serviceTemplateId));
'service_template_model_stm_id' => $serviceTemplateId,
'service_hPars' => $hostId);
$svcId = $svcObj->insert($serviceDesc);
$hostSvcRel->insert($hostId, $svcId);
$this->params = array_merge($this->params, $serviceDesc);
$this->addAuditLog(
'a',
$svcId,
$params['service_alias'],
$this->params
);
$svcExtended->insert(array($svcExtended->getUniqueLabelField() => $svcId));
}
unset($res);
......
......@@ -36,6 +36,7 @@
require_once _CENTREON_PATH_ . 'www/class/centreonInstance.class.php';
require_once _CENTREON_PATH_ . 'www/class/centreonService.class.php';
require_once _CENTREON_PATH_ . 'www/class/centreonCommand.class.php';
require_once _CENTREON_PATH_ . 'www/class/centreonLogAction.class.php';
/*
* Class that contains various methods for managing hosts
......@@ -1743,6 +1744,8 @@ class CentreonHost
*/
public function deployServices($hostId, $hostTemplateId = null)
{
global $centreon;
if (!isset($hostTemplateId)) {
$id = $hostId;
} else {
......@@ -1778,15 +1781,17 @@ class CentreonHost
$res = $this->db->execute($stmt, $queryValues);
if (!$res->numRows()) {
$svcId = $this->serviceObj->insert(
array(
$serviceDesc = array(
'service_description' => $service['service_alias'],
'service_activate' => array('service_activate' => '1'),
'service_register' => '1',
'service_template_model_stm_id' => $serviceTemplateId
)
'service_template_model_stm_id' => $serviceTemplateId,
'service_hPars' => $hostId
);
$svcId = $this->serviceObj->insert($serviceDesc);
$fields = CentreonLogAction::prepareChanges($serviceDesc);
$centreon->CentreonLogAction->insertLog("service", $svcId, CentreonDB::escape($service['service_alias']), "a", $fields);
$this->insertRelHostService($hostId, $svcId);
}
unset($res);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment