Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(clapi): Fix the apply template on a host by CLAPI (#6212)
Browse files Browse the repository at this point in the history
* Fix audit log for deploy services templates on a host by CLAPI
  • Loading branch information
leoncx authored and kduret committed Apr 17, 2018
1 parent 2276a7e commit ba57593
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions www/class/centreon-clapi/centreonHost.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -901,16 +901,16 @@ protected function deployServices($hostId, $hostTemplateId = null)
$serviceDesc = array('service_description' => $params['service_alias'],
'service_activate' => '1',
'service_register' => '1',
'service_template_model_stm_id' => $serviceTemplateId,
'service_hPars' => $hostId);
'service_template_model_stm_id' => $serviceTemplateId);
$svcId = $svcObj->insert($serviceDesc);
$hostSvcRel->insert($hostId, $svcId);
$this->params = array_merge($this->params, $serviceDesc);
$serviceDesc['service_hPars'] = $hostId;
$this->addAuditLog(
'a',
$svcId,
$params['service_alias'],
$this->params
$serviceDesc,
'SERVICE'
);
$svcExtended->insert(array($svcExtended->getUniqueLabelField() => $svcId));
}
Expand Down
5 changes: 3 additions & 2 deletions www/class/centreon-clapi/centreonObject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,11 @@ public function export($filters = null)
* @param int $objId
* @param string $objName
* @param array $objValues
* @param string|null $objectType - The object type to log if is null use the object type of the class
*/
public function addAuditLog($actionType, $objId, $objName, $objValues = array())
public function addAuditLog($actionType, $objId, $objName, $objValues = array(), $objectType = null)
{
$objType = strtoupper($this->action);
$objType = is_null($objectType) ? strtoupper($this->action) : $objectType;
$objectTypes = array(
'HTPL' => 'host',
'STPL' => 'service',
Expand Down

0 comments on commit ba57593

Please sign in to comment.