From cde8f896f39f7b2a2bda23dca2a6df00112acca9 Mon Sep 17 00:00:00 2001 From: mariegallardo Date: Fri, 4 Aug 2017 10:39:24 +0200 Subject: [PATCH 01/12] Feature fixed: MassiveChangeService (#5511) --- features/bootstrap/MassiveChangeServicesContext.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/bootstrap/MassiveChangeServicesContext.php b/features/bootstrap/MassiveChangeServicesContext.php index c6507547b26..e01971ce2e3 100644 --- a/features/bootstrap/MassiveChangeServicesContext.php +++ b/features/bootstrap/MassiveChangeServicesContext.php @@ -116,7 +116,8 @@ class MassiveChangeServicesContext extends CentreonContext 'service_groups' => 'serviceGroupName', 'update_mode_traps' => 1, 'trap_relations' => array( - 'Generic' => 'Generic - trapName' + 'trapName', + 'Generic - trapName' ), 'obsess_over_service' => 2, 'acknowledgement_timeout' => 7, From 5316297e7e0731f0c2190b9296b8cb368c03b743 Mon Sep 17 00:00:00 2001 From: Laurent Pinsivy Date: Fri, 4 Aug 2017 10:58:51 +0200 Subject: [PATCH 02/12] #5493 - Save geo_coords on modify form (#5505) --- www/include/configuration/configObject/meta_service/DB-Func.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/include/configuration/configObject/meta_service/DB-Func.php b/www/include/configuration/configObject/meta_service/DB-Func.php index 47f29192409..9b298f36e99 100644 --- a/www/include/configuration/configObject/meta_service/DB-Func.php +++ b/www/include/configuration/configObject/meta_service/DB-Func.php @@ -315,6 +315,8 @@ function updateMetaService($meta_id = null) $ret["graph_id"] != null ? $rq .= "'".$ret["graph_id"]."', " : $rq .= "NULL, "; $rq .= "meta_comment = "; $ret["meta_comment"] != null ? $rq .= "'".htmlentities($ret["meta_comment"], ENT_QUOTES, "UTF-8")."', " : $rq .= "NULL, "; + $rq .= "geo_coords = "; + $ret["geo_coords"] != null ? $rq .= "'".htmlentities($ret["geo_coords"], ENT_QUOTES, "UTF-8")."', " : $rq .= "NULL, "; $rq .= "meta_activate = "; $ret["meta_activate"]["meta_activate"] != null ? $rq .= "'".$ret["meta_activate"]["meta_activate"]."' " : $rq .= "NULL "; $rq .= " WHERE meta_id = '".$meta_id."'"; From 6e35298f190b650b0089431aabec781c93c9f7fa Mon Sep 17 00:00:00 2001 From: Laurent Pinsivy Date: Fri, 4 Aug 2017 11:12:47 +0200 Subject: [PATCH 03/12] #5506 add coma to separate multiple values in SQL insert request (#5507) --- .../configuration/configObject/meta_service/DB-Func.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/www/include/configuration/configObject/meta_service/DB-Func.php b/www/include/configuration/configObject/meta_service/DB-Func.php index 9b298f36e99..51847cf768e 100644 --- a/www/include/configuration/configObject/meta_service/DB-Func.php +++ b/www/include/configuration/configObject/meta_service/DB-Func.php @@ -349,6 +349,9 @@ function updateMetaServiceContact($meta_id) if (count($ret)) { $queryAddRelation = "INSERT INTO meta_contact (meta_id, contact_id) VALUES "; for ($i = 0; $i < count($ret); $i++) { + if ($i > 0) { + $queryAddRelation .= ', '; + } $queryAddRelation .= "(" . $meta_id . ", " . $ret[$i] . ")"; } $pearDB->query($queryAddRelation); From ec3460dbad2eaf696abc18ffe1274741cfea6690 Mon Sep 17 00:00:00 2001 From: Laurent Pinsivy Date: Fri, 4 Aug 2017 11:21:57 +0200 Subject: [PATCH 04/12] #5495 duplicate contacts on meta service duplication (#5508) --- .../configuration/configObject/meta_service/DB-Func.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/www/include/configuration/configObject/meta_service/DB-Func.php b/www/include/configuration/configObject/meta_service/DB-Func.php index 51847cf768e..23de20ec0d4 100644 --- a/www/include/configuration/configObject/meta_service/DB-Func.php +++ b/www/include/configuration/configObject/meta_service/DB-Func.php @@ -140,6 +140,12 @@ function multipleMetaServiceInDB($metas = array(), $nbrDup = array()) if (isset($maxId["MAX(meta_id)"])) { $metaObj = new CentreonMeta($pearDB); $metaObj->insertVirtualService($maxId["MAX(meta_id)"], $meta_name); + /* Duplicate contacts */ + $DBRESULT = $pearDB->query("SELECT DISTINCT contact_id FROM meta_contact WHERE meta_id = '".$key."'"); + while ($Contact = $DBRESULT->fetchRow()) { + $DBRESULT2 = $pearDB->query("INSERT INTO meta_contact VALUES ('".$maxId["MAX(meta_id)"]."', '".$Contact["contact_id"]."')"); + } + /* Duplicate contactgroups */ $DBRESULT = $pearDB->query("SELECT DISTINCT cg_cg_id FROM meta_contactgroup_relation WHERE meta_id = '".$key."'"); while ($Cg = $DBRESULT->fetchRow()) { $DBRESULT2 = $pearDB->query("INSERT INTO meta_contactgroup_relation VALUES ('', '".$maxId["MAX(meta_id)"]."', '".$Cg["cg_cg_id"]."')"); From c252b1eea6b82481b25bbf3f2ff93e53fcef16e2 Mon Sep 17 00:00:00 2001 From: Laurent Pinsivy Date: Fri, 4 Aug 2017 15:17:07 +0200 Subject: [PATCH 05/12] #5478 - Check if category is not a severity before duplicate contacts (#5509) * #5478 - Check if category is not a severity before duplicate contacts * * fix style --- .../configObject/host_categories/DB-Func.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/www/include/configuration/configObject/host_categories/DB-Func.php b/www/include/configuration/configObject/host_categories/DB-Func.php index a6b01e80083..cb43f7f0cd4 100644 --- a/www/include/configuration/configObject/host_categories/DB-Func.php +++ b/www/include/configuration/configObject/host_categories/DB-Func.php @@ -147,12 +147,16 @@ function multipleHostCategoriesInDB($hostcategories = array(), $nbrDup = array() for ($i = 1; $i <= $nbrDup[$key]; $i++) { $val = null; $rq = null; + $level = false; foreach ($row as $key2 => $value2) { - (isset($key2) && $key2 == "hc_name") ? ($hc_name = $value2 = $value2."_".$i) : null; - $val ? $val .= ($value2!=null?(", '".$value2."'"):", NULL") : $val .= ($value2!=null?("'".$value2."'"):"NULL"); + (isset($key2) && $key2 == "hc_name") ? ($hc_name = $value2 = $value2 . "_" . $i) : null; + $val ? $val .= ($value2 != null ? (", '" . $value2 . "'") : ", NULL") : $val .= ($value2 != null ? ("'" . $value2 . "'") : "NULL"); if ($key2 != "hc_id") { $fields[$key2] = $value2; } + if ($key2 == "level" && $value2 != "") { + $level = true; + } } $fields["hc_name"] = $hc_name; if (testHostCategorieExistence($hc_name)) { @@ -160,7 +164,7 @@ function multipleHostCategoriesInDB($hostcategories = array(), $nbrDup = array() $DBRESULT = $pearDB->query($rq); $DBRESULT = $pearDB->query("SELECT MAX(hc_id) FROM hostcategories"); $maxId = $DBRESULT->fetchRow(); - if (isset($maxId["MAX(hc_id)"])) { + if (isset($maxId["MAX(hc_id)"]) && ! $level) { $hcAcl[$maxId["MAX(hc_id)"]] = $key; $DBRESULT = $pearDB->query("SELECT DISTINCT hgr.host_host_id FROM hostcategories_relation hgr WHERE hgr.hostcategories_hc_id = '".$key."'"); $fields["hc_hosts"] = ""; From 93f021235f54cfd70c812e0c1d0f09579d00e391 Mon Sep 17 00:00:00 2001 From: Laurent Pinsivy Date: Fri, 4 Aug 2017 15:27:28 +0200 Subject: [PATCH 06/12] #5512 add underscore on object name on duplication (#5513) --- www/include/configuration/configObject/escalation/DB-Func.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/include/configuration/configObject/escalation/DB-Func.php b/www/include/configuration/configObject/escalation/DB-Func.php index 0b2e3ec740d..54f52d491f9 100644 --- a/www/include/configuration/configObject/escalation/DB-Func.php +++ b/www/include/configuration/configObject/escalation/DB-Func.php @@ -84,7 +84,7 @@ function multipleEscalationInDB($escalations = array(), $nbrDup = array()) for ($i = 1; $i <= $nbrDup[$key]; $i++) { $val = null; foreach ($row as $key2 => $value2) { - $key2 == "esc_name" ? ($esc_name = $value2 = $value2 . " " . $i) : null; + $key2 == "esc_name" ? ($esc_name = $value2 = $value2 . "_" . $i) : null; $val ? $val .= ($value2 != null ? (", '" . $value2 . "'") : ", NULL") : $val .= ($value2 != null ? ("'" . $value2 . "'") : "NULL"); if ($key2 != "esc_id") { From abe0342b11c47e5e351c79b1f6a05042f108b895 Mon Sep 17 00:00:00 2001 From: Kevin Duret Date: Fri, 4 Aug 2017 15:34:50 +0200 Subject: [PATCH 07/12] add version 2.7.12 to previous versions --- www/install/sql/centreon/Update-DB-2.7.11_to_2.7.12.sql | 2 ++ ...1_to_2.8.0-beta1.sql => Update-DB-2.7.12_to_2.8.0-beta1.sql} | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 www/install/sql/centreon/Update-DB-2.7.11_to_2.7.12.sql rename www/install/sql/centreon/{Update-DB-2.7.11_to_2.8.0-beta1.sql => Update-DB-2.7.12_to_2.8.0-beta1.sql} (99%) diff --git a/www/install/sql/centreon/Update-DB-2.7.11_to_2.7.12.sql b/www/install/sql/centreon/Update-DB-2.7.11_to_2.7.12.sql new file mode 100644 index 00000000000..d793757626b --- /dev/null +++ b/www/install/sql/centreon/Update-DB-2.7.11_to_2.7.12.sql @@ -0,0 +1,2 @@ +-- Change version of Centreon +UPDATE `informations` SET `value` = '2.7.12' WHERE CONVERT( `informations`.`key` USING utf8 ) = 'version' AND CONVERT ( `informations`.`value` USING utf8 ) = '2.7.11' LIMIT 1; diff --git a/www/install/sql/centreon/Update-DB-2.7.11_to_2.8.0-beta1.sql b/www/install/sql/centreon/Update-DB-2.7.12_to_2.8.0-beta1.sql similarity index 99% rename from www/install/sql/centreon/Update-DB-2.7.11_to_2.8.0-beta1.sql rename to www/install/sql/centreon/Update-DB-2.7.12_to_2.8.0-beta1.sql index 0e66cc9c2f0..fdd6e97e352 100644 --- a/www/install/sql/centreon/Update-DB-2.7.11_to_2.8.0-beta1.sql +++ b/www/install/sql/centreon/Update-DB-2.7.12_to_2.8.0-beta1.sql @@ -1,5 +1,5 @@ -- Change version of Centreon -UPDATE `informations` SET `value` = '2.8.0-beta1' WHERE CONVERT( `informations`.`key` USING utf8 ) = 'version' AND CONVERT ( `informations`.`value` USING utf8 ) = '2.7.11' LIMIT 1; +UPDATE `informations` SET `value` = '2.8.0-beta1' WHERE CONVERT( `informations`.`key` USING utf8 ) = 'version' AND CONVERT ( `informations`.`value` USING utf8 ) = '2.7.12' LIMIT 1; -- Add graphite output for centreon-broker INSERT IGNORE INTO cb_module (name, libname, loading_pos, is_activated) From d51e52b2718fddabf53c3013caaa641d736f0bb8 Mon Sep 17 00:00:00 2001 From: Laurent Pinsivy Date: Thu, 3 Aug 2017 13:28:48 +0100 Subject: [PATCH 08/12] Add Centreon Web 2.7.12 release note --- .../centreon-2.7/centreon-2.7.12.rst | 23 +++++++++++++++++++ doc/en/release_notes/centreon-2.7/index.rst | 2 ++ .../centreon-2.7/centreon-2.7.12.rst | 23 +++++++++++++++++++ doc/fr/release_notes/centreon-2.7/index.rst | 2 ++ 4 files changed, 50 insertions(+) create mode 100644 doc/en/release_notes/centreon-2.7/centreon-2.7.12.rst create mode 100644 doc/fr/release_notes/centreon-2.7/centreon-2.7.12.rst diff --git a/doc/en/release_notes/centreon-2.7/centreon-2.7.12.rst b/doc/en/release_notes/centreon-2.7/centreon-2.7.12.rst new file mode 100644 index 00000000000..8b068d2d354 --- /dev/null +++ b/doc/en/release_notes/centreon-2.7/centreon-2.7.12.rst @@ -0,0 +1,23 @@ +############### +Centreon 2.7.12 +############### + +The 2.7.12 release for Centreon Web is now available for `download `_. +The full release notes for 2.7.12 follow. + +****** +Notice +****** + +If you are upgrading from a version prior to 2.7.0, make sure to go through all the release notes available +`here `_. + +Bug Fixes +========= + +* [CLAPI] Several bugs on HG / CG when export is filtered #5297 PR #5320 +* [CLAPI] fix clapi ldap contact import +* Unable to load public custom view - No Layout... #5449 +* Impossible to acknowledge several object from custom views #5420 +* Security: avoid external command shell injection in comment + diff --git a/doc/en/release_notes/centreon-2.7/index.rst b/doc/en/release_notes/centreon-2.7/index.rst index 05f5162777d..744d7bb200f 100644 --- a/doc/en/release_notes/centreon-2.7/index.rst +++ b/doc/en/release_notes/centreon-2.7/index.rst @@ -18,3 +18,5 @@ Please find here the release notes dedicated to the last 2.7.x version of Centre centreon-2.7.8 centreon-2.7.9 centreon-2.7.10 + centreon-2.7.11 + centreon-2.7.12 diff --git a/doc/fr/release_notes/centreon-2.7/centreon-2.7.12.rst b/doc/fr/release_notes/centreon-2.7/centreon-2.7.12.rst new file mode 100644 index 00000000000..8b068d2d354 --- /dev/null +++ b/doc/fr/release_notes/centreon-2.7/centreon-2.7.12.rst @@ -0,0 +1,23 @@ +############### +Centreon 2.7.12 +############### + +The 2.7.12 release for Centreon Web is now available for `download `_. +The full release notes for 2.7.12 follow. + +****** +Notice +****** + +If you are upgrading from a version prior to 2.7.0, make sure to go through all the release notes available +`here `_. + +Bug Fixes +========= + +* [CLAPI] Several bugs on HG / CG when export is filtered #5297 PR #5320 +* [CLAPI] fix clapi ldap contact import +* Unable to load public custom view - No Layout... #5449 +* Impossible to acknowledge several object from custom views #5420 +* Security: avoid external command shell injection in comment + diff --git a/doc/fr/release_notes/centreon-2.7/index.rst b/doc/fr/release_notes/centreon-2.7/index.rst index 05f5162777d..744d7bb200f 100644 --- a/doc/fr/release_notes/centreon-2.7/index.rst +++ b/doc/fr/release_notes/centreon-2.7/index.rst @@ -18,3 +18,5 @@ Please find here the release notes dedicated to the last 2.7.x version of Centre centreon-2.7.8 centreon-2.7.9 centreon-2.7.10 + centreon-2.7.11 + centreon-2.7.12 From ad75910912f895913083500d68483ba9b25b6863 Mon Sep 17 00:00:00 2001 From: loiclau Date: Mon, 7 Aug 2017 10:26:13 +0200 Subject: [PATCH 09/12] * #5314 remove parallelize_checks in doc --- doc/en/api/clapi/objects/services.rst | 2 -- doc/fr/api/clapi/objects/services.rst | 2 -- 2 files changed, 4 deletions(-) diff --git a/doc/en/api/clapi/objects/services.rst b/doc/en/api/clapi/objects/services.rst index 1508a808e76..557ecfcc1f3 100644 --- a/doc/en/api/clapi/objects/services.rst +++ b/doc/en/api/clapi/objects/services.rst @@ -171,8 +171,6 @@ first_notification_delay First notification delay in seconds recovery_notification_delay Recovery notification delay -parallelize_checks *1* when parallelize checks are enabled, *0* otherwise - obsess_over_service *1* when obsess over service is enabled, *0* otherwise check_freshness *1* when check freshness is enabled, *0* otherwise diff --git a/doc/fr/api/clapi/objects/services.rst b/doc/fr/api/clapi/objects/services.rst index 37284bcbe4f..c1c5dd64256 100644 --- a/doc/fr/api/clapi/objects/services.rst +++ b/doc/fr/api/clapi/objects/services.rst @@ -169,8 +169,6 @@ notification_options Status linked to notifications first_notification_delay First notification delay in seconds -parallelize_checks *1* when parallelize checks are enabled, *0* otherwise - obsess_over_service *1* when obsess over service is enabled, *0* otherwise check_freshness *1* when check freshness is enabled, *0* otherwise From 3d0a5b2b320160b8969ae87b1938d4ec9a80c6da Mon Sep 17 00:00:00 2001 From: loiclau Date: Mon, 7 Aug 2017 10:31:36 +0200 Subject: [PATCH 10/12] * #5315 remove process_perf_data in doc --- doc/en/api/clapi/objects/services.rst | 2 -- doc/fr/api/clapi/objects/services.rst | 2 -- 2 files changed, 4 deletions(-) diff --git a/doc/en/api/clapi/objects/services.rst b/doc/en/api/clapi/objects/services.rst index 557ecfcc1f3..fda150869d5 100644 --- a/doc/en/api/clapi/objects/services.rst +++ b/doc/en/api/clapi/objects/services.rst @@ -181,8 +181,6 @@ event_handler_enabled *1* when event handler is enabled, *0* otherwise flap_detection_enabled *1* when flap detection is enabled, *0* otherwise -process_perf_data *1* when process performance data is enabled, *0* otherwise - retain_status_information *1* when status information is retained, *0* otherwise retain_nonstatus_information *1* when non status information is retained, *0* otherwise diff --git a/doc/fr/api/clapi/objects/services.rst b/doc/fr/api/clapi/objects/services.rst index c1c5dd64256..74af764e010 100644 --- a/doc/fr/api/clapi/objects/services.rst +++ b/doc/fr/api/clapi/objects/services.rst @@ -179,8 +179,6 @@ event_handler_enabled *1* when event handler is enabled, *0* otherwise flap_detection_enabled *1* when flap detection is enabled, *0* otherwise -process_perf_data *1* when process performance data is enabled, *0* otherwise - retain_status_information *1* when status information is retained, *0* otherwise retain_nonstatus_information *1* when non status information is retained, *0* otherwise From bd9c609ae7da681ef1ef7810aed8ada4960077b6 Mon Sep 17 00:00:00 2001 From: loiclau Date: Mon, 7 Aug 2017 10:38:58 +0200 Subject: [PATCH 11/12] * #5316 remove checks_enabled in doc --- doc/en/api/clapi/objects/hosts.rst | 2 -- doc/fr/api/clapi/objects/hosts.rst | 2 -- 2 files changed, 4 deletions(-) diff --git a/doc/en/api/clapi/objects/hosts.rst b/doc/en/api/clapi/objects/hosts.rst index 86470e8c373..7b6097559dc 100644 --- a/doc/en/api/clapi/objects/hosts.rst +++ b/doc/en/api/clapi/objects/hosts.rst @@ -125,8 +125,6 @@ check_freshness Enables check freshness check_period Check period -checks_enabled Whether or not checks are enabled - contact_additive_inheritance Enables contact additive inheritance cg_additive_inheritance Enables contactgroup additive inheritance diff --git a/doc/fr/api/clapi/objects/hosts.rst b/doc/fr/api/clapi/objects/hosts.rst index 98fbfc91388..685165ddbd7 100644 --- a/doc/fr/api/clapi/objects/hosts.rst +++ b/doc/fr/api/clapi/objects/hosts.rst @@ -125,8 +125,6 @@ check_freshness Enables check freshness check_period Check period -checks_enabled Whether or not checks are enabled - contact_additive_inheritance Enables contact additive inheritance cg_additive_inheritance Enables contactgroup additive inheritance From c766d139a1f837871bf1abc6a4e52ac420751039 Mon Sep 17 00:00:00 2001 From: mariegallardo Date: Mon, 7 Aug 2017 13:29:00 +0200 Subject: [PATCH 12/12] New feature HostGroupServiceConfiguration (#5488) * New feature HostGroupServiceConfiguration * Features fixed * File fixed --- behat.yml | 5 + .../HostGroupServiceConfiguration.feature | 20 + .../bootstrap/ACLActionsAccessContext.php | 4 +- .../HostGroupServiceConfigurationContext.php | 436 ++++++++++++++++++ .../MassiveChangeServicesContext.php | 2 +- 5 files changed, 463 insertions(+), 4 deletions(-) create mode 100644 features/HostGroupServiceConfiguration.feature create mode 100644 features/bootstrap/HostGroupServiceConfigurationContext.php diff --git a/behat.yml b/behat.yml index 1260bd32be4..4fa13216826 100644 --- a/behat.yml +++ b/behat.yml @@ -263,3 +263,8 @@ default: paths: [ %paths.base%/features/VirtualMetricHandle.feature ] contexts: - VirtualMetricHandleContext + + host_group_service_configuration: + paths: [ %paths.base%/features/HostGroupServiceConfiguration.feature ] + contexts: + - HostGroupServiceConfigurationContext diff --git a/features/HostGroupServiceConfiguration.feature b/features/HostGroupServiceConfiguration.feature new file mode 100644 index 00000000000..a1b33ce8481 --- /dev/null +++ b/features/HostGroupServiceConfiguration.feature @@ -0,0 +1,20 @@ +Feature: Edit a host group service + As a Centreon user + I want to manipulate a service + To see if all simples manipulations work + + Background: + Given I am logged in a Centreon server + And a service is configured + + Scenario: Change the properties of a host group service + When I change the properties of a host group service + Then the properties are updated + + Scenario: Duplicate one existing host group service + When I duplicate a host group service + Then the new host group service has the same properties + + Scenario: Delete one existing host group service + When I delete a host group service + Then the deleted host group service is not displayed in the list diff --git a/features/bootstrap/ACLActionsAccessContext.php b/features/bootstrap/ACLActionsAccessContext.php index 3b04c8cbb66..a7e0c1f2064 100644 --- a/features/bootstrap/ACLActionsAccessContext.php +++ b/features/bootstrap/ACLActionsAccessContext.php @@ -22,9 +22,7 @@ class ACLActionsAccessContext extends CentreonContext private $adminContactGroup = array( 'name' => 'adminContactGroupName', 'alias' => 'adminContactGroupAlias', - 'contacts' => array( - 'adminUserName' - ), + 'contacts' => 'adminUserName' ); private $nonAdminUser = array( diff --git a/features/bootstrap/HostGroupServiceConfigurationContext.php b/features/bootstrap/HostGroupServiceConfigurationContext.php new file mode 100644 index 00000000000..6a471697bb0 --- /dev/null +++ b/features/bootstrap/HostGroupServiceConfigurationContext.php @@ -0,0 +1,436 @@ + 'serviceCategory1Name', + 'description' => 'serviceCategory1Description', + 'severity' => 1, + 'level' => 3, + 'icon' => ' centreon (png)' + ); + + protected $serviceCategory2 = array( + 'name' => 'serviceCategory2Name', + 'description' => 'serviceCategory2Description', + 'severity' => 1, + 'level' => 2, + 'icon' => ' centreon (png)' + ); + + protected $serviceGroup1 = array( + 'name' => 'serviceGroup1Name', + 'description' => 'serviceGroup1Description' + ); + + protected $serviceGroup2 = array( + 'name' => 'serviceGroup2Name', + 'description' => 'serviceGroup2Description' + ); + + protected $initialProperties = array( + 'hosts' => 'Windows-Servers', + 'description' => 'serviceDescription', + 'templates' => 'generic-service', + 'check_command' => 'check_http', + 'macros' => array( + 'MACRONAME' => 22 + ), + 'check_period' => 'workhours', + 'max_check_attempts' => 15, + 'normal_check_interval' => 7, + 'retry_check_interval' => 9, + 'active_checks_enabled' => 2, + 'passive_checks_enabled' => 1, + 'is_volatile' => 0, + 'notifications_enabled' => 2, + 'inherits_contacts_groups' => 0, + 'contacts' => 'Guest', + 'contact_additive_inheritance' => 1, + 'contact_groups' => 'Supervisors', + 'contact_group_additive_inheritance' => 1, + 'notification_interval' => 23, + 'notify_on_none' => 1, + 'notify_on_warning' => 0, + 'notify_on_unknown' => 0, + 'notify_on_critical' => 0, + 'notify_on_recovery' => 0, + 'notify_on_flapping' => 0, + 'notify_on_downtime_scheduled' => 0, + 'first_notification_delay' => 4, + 'recovery_notification_delay' => 3, + 'service_groups' => 'serviceGroup1Name', + 'trap_relations' => 'Generic - coldStart', + 'obsess_over_service' => 2, + 'acknowledgement_timeout' => 34, + 'check_freshness' => 1, + 'freshness_threshold' => 22, + 'flap_detection_enabled' => 0, + 'low_flap_threshold' => 15, + 'high_flap_threshold' => 18, + 'retain_status_information' => 2, + 'retain_non_status_information' => 1, + 'stalking_on_ok' => 1, + 'stalking_on_warning' => 1, + 'stalking_on_unknown' => 0, + 'stalking_on_critical' => 0, + 'event_handler_enabled' => 0, + 'event_handler' => 'check_https', + 'event_handler_arguments' => 'eventHandlerArgument', + 'graph_template' => 'CPU', + 'service_categories' => 'Disk', + 'url' => 'serviceUrl', + 'notes' => 'serviceNotes', + 'action_url' => 'serviceActionUrl', + 'icon' => ' centreon (png)', + 'alt_icon' => 'serviceAltIcon', + 'severity' => 'serviceCategory2Name (2)', + 'geo_coordinates' => 'Paris', + 'status' => 1, + 'comments' => 'serviceComments' + ); + + protected $duplicatedProperties = array( + 'hosts' => 'Windows-Servers', + 'description' => 'serviceDescription_1', + 'templates' => 'generic-service', + 'check_command' => 'check_http', + 'macros' => array( + 'MACRONAME' => 22 + ), + 'check_period' => 'workhours', + 'max_check_attempts' => 15, + 'normal_check_interval' => 7, + 'retry_check_interval' => 9, + 'active_checks_enabled' => 2, + 'passive_checks_enabled' => 1, + 'is_volatile' => 0, + 'notifications_enabled' => 2, + 'inherits_contacts_groups' => 0, + 'contacts' => 'Guest', + 'contact_additive_inheritance' => 1, + 'contact_groups' => 'Supervisors', + 'contact_group_additive_inheritance' => 1, + 'notification_interval' => 23, + 'notify_on_none' => 1, + 'notify_on_warning' => 0, + 'notify_on_unknown' => 0, + 'notify_on_critical' => 0, + 'notify_on_recovery' => 0, + 'notify_on_flapping' => 0, + 'notify_on_downtime_scheduled' => 0, + 'first_notification_delay' => 4, + 'recovery_notification_delay' => 3, + 'service_groups' => 'serviceGroup1Name', + 'trap_relations' => 'coldStart', + 'obsess_over_service' => 2, + 'acknowledgement_timeout' => 34, + 'check_freshness' => 1, + 'freshness_threshold' => 22, + 'flap_detection_enabled' => 0, + 'low_flap_threshold' => 15, + 'high_flap_threshold' => 18, + 'retain_status_information' => 2, + 'retain_non_status_information' => 1, + 'stalking_on_ok' => 1, + 'stalking_on_warning' => 1, + 'stalking_on_unknown' => 0, + 'stalking_on_critical' => 0, + 'event_handler_enabled' => 0, + 'event_handler' => 'check_https', + 'event_handler_arguments' => 'eventHandlerArgument', + 'graph_template' => 'CPU', + 'service_categories' => 'Disk', + 'url' => 'serviceUrl', + 'notes' => 'serviceNotes', + 'action_url' => 'serviceActionUrl', + 'icon' => ' centreon (png)', + 'alt_icon' => 'serviceAltIcon', + 'severity' => 'serviceCategory2Name (2)', + 'geo_coordinates' => 'Paris', + 'status' => 1, + 'comments' => 'serviceComments' + ); + + protected $update = array( + 'hosts' => 'Firewall', + 'description' => 'serviceDescriptionChanged', + 'templates' => 'Ping-WAN', + 'check_command' => 'check_https', + 'macros' => array( + 'MACRONAMECHANGED' => 11 + ), + 'check_period' => 'none', + 'max_check_attempts' => 32, + 'normal_check_interval' => 81, + 'retry_check_interval' => 12, + 'active_checks_enabled' => 0, + 'passive_checks_enabled' => 2, + 'is_volatile' => 1, + 'notifications_enabled' => 0, + 'inherits_contacts_groups' => 1, + 'notification_interval' => 14, + 'notify_on_none' => 0, + 'notify_on_warning' => 1, + 'notify_on_unknown' => 1, + 'notify_on_critical' => 1, + 'notify_on_recovery' => 1, + 'notify_on_flapping' => 1, + 'notify_on_downtime_scheduled' => 1, + 'first_notification_delay' => 8, + 'recovery_notification_delay' => 9, + 'service_groups' => 'serviceGroup2Name', + 'trap_relations' => 'HP - snTrapL4GslbRemoteControllerUp', + 'obsess_over_service' => 0, + 'acknowledgement_timeout' => 28, + 'check_freshness' => 2, + 'freshness_threshold' => 31, + 'flap_detection_enabled' => 1, + 'low_flap_threshold' => 42, + 'high_flap_threshold' => 79, + 'retain_status_information' => 1, + 'retain_non_status_information' => 0, + 'stalking_on_ok' => 0, + 'stalking_on_warning' => 0, + 'stalking_on_unknown' => 1, + 'stalking_on_critical' => 1, + 'event_handler_enabled' => 1, + 'event_handler' => 'check_http', + 'event_handler_arguments' => 'eventHandlerArgumentChanged', + 'graph_template' => 'Storage', + 'service_categories' => 'Memory', + 'url' => 'serviceUrlChanged', + 'notes' => 'serviceNotesChanged', + 'action_url' => 'serviceActionUrlChanged', + 'icon' => '', + 'alt_icon' => 'Empty', + 'severity' => 'serviceCategory1Name (3)', + 'geo_coordinates' => '1.2.3.4', + 'status' => 1, + 'comments' => 'serviceCommentsChanged' + ); + + protected $updatedProperties = array( + 'hosts' => 'Firewall', + 'description' => 'serviceDescriptionChanged', + 'templates' => 'Ping-WAN', + 'check_command' => 'check_https', + 'macros' => array( + 'MACRONAMECHANGED' => 11, + 'MACRONAME' => 22 + ), + 'check_period' => 'none', + 'max_check_attempts' => 32, + 'normal_check_interval' => 81, + 'retry_check_interval' => 12, + 'active_checks_enabled' => 0, + 'passive_checks_enabled' => 2, + 'is_volatile' => 1, + 'notifications_enabled' => 0, + 'inherits_contacts_groups' => 1, + 'contacts' => '', + 'contact_additive_inheritance' => 0, + 'contact_groups' => '', + 'contact_group_additive_inheritance' => 0, + 'notification_interval' => 14, + 'notify_on_none' => 0, + 'notify_on_warning' => 1, + 'notify_on_unknown' => 1, + 'notify_on_critical' => 1, + 'notify_on_recovery' => 1, + 'notify_on_flapping' => 1, + 'notify_on_downtime_scheduled' => 1, + 'first_notification_delay' => 8, + 'recovery_notification_delay' => 9, + 'service_groups' => 'serviceGroup2Name', + 'trap_relations' => array( + 'snTrapL4GslbRemoteControllerUp' + ), + 'obsess_over_service' => 0, + 'acknowledgement_timeout' => 28, + 'check_freshness' => 2, + 'freshness_threshold' => 31, + 'flap_detection_enabled' => 1, + 'low_flap_threshold' => 42, + 'high_flap_threshold' => 79, + 'retain_status_information' => 1, + 'retain_non_status_information' => 0, + 'stalking_on_ok' => 0, + 'stalking_on_warning' => 0, + 'stalking_on_unknown' => 1, + 'stalking_on_critical' => 1, + 'event_handler_enabled' => 1, + 'event_handler' => 'check_http', + 'event_handler_arguments' => 'eventHandlerArgumentChanged', + 'graph_template' => 'Storage', + 'service_categories' => 'Memory', + 'url' => 'serviceUrlChanged', + 'notes' => 'serviceNotesChanged', + 'action_url' => 'serviceActionUrlChanged', + 'icon' => '', + 'alt_icon' => 'Empty', + 'severity' => 'serviceCategory1Name (3)', + 'geo_coordinates' => '1.2.3.4', + 'status' => 1, + 'comments' => 'serviceCommentsChanged' + ); + + /** + * @Given a service is configured + */ + public function aServiceIsConfigured() + { + $this->currentPage = new ServiceCategoryConfigurationPage($this); + $this->currentPage->setProperties($this->serviceCategory1); + $this->currentPage->save(); + $this->currentPage = new ServiceCategoryConfigurationPage($this); + $this->currentPage->setProperties($this->serviceCategory2); + $this->currentPage->save(); + $this->currentPage = new ServiceGroupConfigurationPage($this); + $this->currentPage->setProperties($this->serviceGroup1); + $this->currentPage->save(); + $this->currentPage = new ServiceGroupConfigurationPage($this); + $this->currentPage->setProperties($this->serviceGroup2); + $this->currentPage->save(); + $this->currentPage = new HostGroupServiceConfigurationPage($this); + $this->currentPage->setProperties($this->initialProperties); + $this->currentPage->save(); + } + + /** + * @When I change the properties of a host group service + */ + public function iChangeThePropertiesOfAHostGroupService() + { + $this->currentPage = new HostGroupServiceConfigurationListingPage($this); + $this->currentPage = $this->currentPage->inspect($this->initialProperties['description']); + $this->currentPage->setProperties($this->update); + $this->currentPage->save(); + } + + /** + * @Then the properties are updated + */ + public function thePropertiesAreUpdated() + { + $this->tableau = array(); + try { + $this->spin( + function ($context) { + $this->currentPage = new HostGroupServiceConfigurationListingPage($this); + $this->currentPage = $this->currentPage->inspect($this->updatedProperties['description']); + $object = $this->currentPage->getProperties(); + foreach ($this->updatedProperties as $key => $value) { + if ($value != $object[$key]) { + if (is_array($value)) { + $value = implode(' ', $value); + } + if ($value != $object[$key]) { + $this->tableau[] = $key; + } + } + } + return count($this->tableau) == 0; + }, + "Some properties are not being updated : ", + 5 + ); + } catch (\Exception $e) { + $this->tableau = array_unique($this->tableau); + throw new \Exception("Some properties are not being updated : " . implode(',', $this->tableau)); + } + } + + /** + * @When I duplicate a host group service + */ + public function iDuplicateAHostGroupService() + { + $this->currentPage = new HostGroupServiceConfigurationListingPage($this); + $object = $this->currentPage->getEntry(array( + 'service' => $this->initialProperties['description'], + 'host_group' => $this->initialProperties['hosts'] + )); + $this->assertFind('css', 'input[type="checkbox"][name="select[' . $object['id'] . ']"]')->check(); + $this->setConfirmBox(true); + $this->selectInList('select[name="o1"]', 'Duplicate'); + } + + /** + * @Then the new host group service has the same properties + */ + public function theNewHostGroupServiceHasTheSameProperties() + { + $this->tableau = array(); + try { + $this->spin( + function ($context) { + $this->currentPage = new HostGroupServiceConfigurationListingPage($this); + $this->currentPage = $this->currentPage->inspect($this->duplicatedProperties['description']); + $object = $this->currentPage->getProperties(); + foreach ($this->duplicatedProperties as $key => $value) { + if ($value != $object[$key]) { + if (is_array($value)) { + $value = implode(' ', $value); + } + if ($value != $object[$key]) { + $this->tableau[] = $key; + } + } + } + return count($this->tableau) == 0; + }, + "Some properties are not being updated : ", + 5 + ); + } catch (\Exception $e) { + $this->tableau = array_unique($this->tableau); + throw new \Exception("Some properties are not being updated : " . implode(',', $this->tableau)); + } + } + + /** + * @When I delete a host group service + */ + public function iDeleteAHostGroupService() + { + $this->currentPage = new HostGroupServiceConfigurationListingPage($this); + $object = $this->currentPage->getEntry(array( + 'service' => $this->initialProperties['description'], + 'host_group' => $this->initialProperties['hosts'] + )); + $this->assertFind('css', 'input[type="checkbox"][name="select[' . $object['id'] . ']"]')->check(); + $this->setConfirmBox(true); + $this->selectInList('select[name="o1"]', 'Delete'); + } + + /** + * @Then the deleted host group service is not displayed in the list + */ + public function theDeletedHostGroupServiceIsNotDisplayedInTheList() + { + $this->spin( + function ($context) { + $this->currentPage = new HostGroupServiceConfigurationListingPage($this); + $object = $this->currentPage->getEntries(); + $bool = true; + foreach ($object as $host => $service) { + foreach ($service as $value) { + $bool = $bool && $value['service'] != $this->initialProperties['description']; + } + } + return $bool; + }, + "The service is not being deleted.", + 5 + ); + } +} diff --git a/features/bootstrap/MassiveChangeServicesContext.php b/features/bootstrap/MassiveChangeServicesContext.php index e01971ce2e3..48f5eb8d738 100644 --- a/features/bootstrap/MassiveChangeServicesContext.php +++ b/features/bootstrap/MassiveChangeServicesContext.php @@ -116,7 +116,7 @@ class MassiveChangeServicesContext extends CentreonContext 'service_groups' => 'serviceGroupName', 'update_mode_traps' => 1, 'trap_relations' => array( - 'trapName', + 'Generic', 'Generic - trapName' ), 'obsess_over_service' => 2,