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

Commit

Permalink
fix(clapi): improve getparam for host (#8201)
Browse files Browse the repository at this point in the history
* fix(clapi): host getparam is not consistent - #7894
* enh(clapi): add geo_coords for host getparam - #7836
* fix(doc): correct list of get parameters for host in clapi - #6598
  • Loading branch information
lpinsivy authored Jan 6, 2020
1 parent d2f03df commit 059964f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
8 changes: 4 additions & 4 deletions doc/en/api/api_rest/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,8 @@ Parameter Description

3d_coords 3D coordinates (used by statusmap)

geo_coords Geo coordinates (used by Centreon MAP)

action_url Action URL

activate Whether or not host is enabled
Expand Down Expand Up @@ -736,8 +738,6 @@ max_check_attempts Maximum number of attempt before a HARD sta

name Host name

normal_check_interval value in minutes

notes Notes

notes_url Notes URL
Expand Down Expand Up @@ -821,6 +821,8 @@ Parameter Description

3d_coords 3D coordinates (used by statusmap)

geo_coords Geo coordinates (used by Centreon MAP)

action_url Action URL

activate Whether or not host is enabled
Expand Down Expand Up @@ -867,8 +869,6 @@ max_check_attempts Maximum number of attempt before a HARD sta

name Host name

normal_check_interval value in minutes

notes Notes

notes_url Notes URL
Expand Down
8 changes: 4 additions & 4 deletions doc/fr/api/api_rest/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,8 @@ Parameter Description

3d_coords 3D coordinates (used by statusmap)

geo_coords Geo coordinates (used by Centreon MAP)

action_url Action URL

activate Whether or not host is enabled
Expand Down Expand Up @@ -736,8 +738,6 @@ max_check_attempts Maximum number of attempt before a HARD sta

name Host name

normal_check_interval value in minutes

notes Notes

notes_url Notes URL
Expand Down Expand Up @@ -821,6 +821,8 @@ Parameter Description

3d_coords 3D coordinates (used by statusmap)

geo_coords Geo coordinates (used by Centreon MAP)

action_url Action URL

activate Whether or not host is enabled
Expand Down Expand Up @@ -867,8 +869,6 @@ max_check_attempts Maximum number of attempt before a HARD sta

name Host name

normal_check_interval value in minutes

notes Notes

notes_url Notes URL
Expand Down
16 changes: 10 additions & 6 deletions www/class/centreon-clapi/centreonHost.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ public function getparam($parameters = null)
'flap_detection_enabled',
'flap_detection_options',
'freshness_threshold',
'geo_coords',
'host_high_flap_threshold',
'host_low_flap_threshold',
'host_notification_options',
Expand Down Expand Up @@ -467,6 +468,8 @@ public function getparam($parameters = null)

if (($objectId = $this->getObjectId($params[self::ORDER_UNIQUENAME])) != 0) {
$listParam = explode('|', $params[1]);
$exportedFields = [];
$resultString = "";
foreach ($listParam as $paramSearch) {
if (!$paramString) {
$paramString = $paramSearch;
Expand Down Expand Up @@ -500,6 +503,7 @@ public function getparam($parameters = null)
case "contact_additive_inheritance":
case "cg_additive_inheritance":
case "flap_detection_options":
case "geo_coords":
break;
case "notes":
case "notes_url":
Expand Down Expand Up @@ -553,10 +557,9 @@ public function getparam($parameters = null)
$ret = $ret[$field];
break;
}
if (!$resultString) {
$resultString = $ret;
} else {
$resultString = $resultString . $this->delim . $ret;
if (!isset($exportedFields[$paramSearch])) {
$resultString .= $ret . $this->delim;
$exportedFields[$paramSearch] = 1;
}
}
}
Expand All @@ -567,8 +570,8 @@ public function getparam($parameters = null)
if (!empty($unknownParam)) {
throw new CentreonClapiException(self::OBJECT_NOT_FOUND . ":" . implode('|', $unknownParam));
}
echo $paramString . "\n";
echo $resultString . "\n";
echo implode(';', array_unique(explode(';', $paramString))) . "\n";
echo substr($resultString, 0, -1) . "\n";
}

/**
Expand Down Expand Up @@ -1313,6 +1316,7 @@ public function export($filterName = null)
"ehi_action_url",
"ehi_icon_image",
"ehi_icon_image_alt",
"ehi_vrml_image",
"ehi_statusmap_image",
"ehi_2d_coords",
"ehi_3d_coords"
Expand Down

0 comments on commit 059964f

Please sign in to comment.