Skip to content

Commit

Permalink
enh(engine/configuration): globals.hh removed from configuration files (
Browse files Browse the repository at this point in the history
#1465)

* enh(engine/configuration): config_warnings and config_errors are removed as global variables.

* enh(engine/configuration): almost all globals.hh used in configuration are removed

* fix(engine/tests): little change in cfg files comments

* cleanup(engine/configuration): headers removed when not needed

* enh(collect): copyright info are updated automatically now.

* fix(engine/configuration): scheduling configuration is fixed.

* fix(engine): errors counts were badly propagated.

* fix(engine): not needed headers removed

* fix(engine): comments removed

* fix(engine): fix after review on sched_info_config

REFS: MON-34072
  • Loading branch information
bouda1 authored Jun 24, 2024
1 parent 1c3e47f commit 2e726dd
Show file tree
Hide file tree
Showing 155 changed files with 1,271 additions and 1,644 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ cmake_minimum_required(VERSION 3.16)

set(CMAKE_CXX_STANDARD 17)

string(TIMESTAMP CENTREON_CURRENT_YEAR "%Y")
add_definitions(-DCENTREON_CURRENT_YEAR="${CENTREON_CURRENT_YEAR}")

if(DEFINED ENV{VCPKG_ROOT})
set(VCPKG_ROOT "$ENV{VCPKG_ROOT}")
message(STATUS "TOOLCHAIN set to ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2011-2012, 2021-2022 Centreon
* Copyright 2011-2012, 2021-2024 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions broker/core/src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ int main(int argc, char* argv[]) {
core_logger->info(" '-D' Generate a diagnostic file.");
core_logger->info(" '-h' Print this help.");
core_logger->info(" '-v' Print Centreon Broker version.");
core_logger->info("Centreon Broker {}", CENTREON_BROKER_VERSION);
core_logger->info("Copyright 2009-2021 Centreon");
core_logger->info("Centreon Broker " CENTREON_BROKER_VERSION);
core_logger->info("Copyright 2009-" CENTREON_CURRENT_YEAR " Centreon");
core_logger->info(
"License ASL 2.0 <http://www.apache.org/licenses/LICENSE-2.0>");
retval = 0;
Expand Down
39 changes: 19 additions & 20 deletions engine/inc/com/centreon/engine/anomalydetection.hh
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
/*
** Copyright 2020 Centreon
**
** This file is part of Centreon Engine.
**
** Centreon Engine is free software: you can redistribute it and/or
** modify it under the terms of the GNU General Public License version 2
** as published by the Free Software Foundation.
**
** Centreon Engine is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Centreon Engine. If not, see
** <http://www.gnu.org/licenses/>.
*/

/**
* Copyright 2020-2024 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
*/
#ifndef CCE_ANOMALYDETECTION_HH
#define CCE_ANOMALYDETECTION_HH

Expand Down Expand Up @@ -148,7 +147,7 @@ class anomalydetection : public service {
void set_status_change(bool status_change);
const std::string& get_metric_name() const;
const std::string& get_thresholds_file() const;
void resolve(int& w, int& e);
void resolve(uint32_t& w, uint32_t& e);

static const pointer_set& get_anomaly(uint64_t dependent_service_id);
};
Expand Down
41 changes: 20 additions & 21 deletions engine/inc/com/centreon/engine/config.hh
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
/*
** Copyright 2002-2006 Ethan Galstad
** Copyright 2011-2019 Centreon
**
** This file is part of Centreon Engine.
**
** Centreon Engine is free software: you can redistribute it and/or
** modify it under the terms of the GNU General Public License version 2
** as published by the Free Software Foundation.
**
** Centreon Engine is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Centreon Engine. If not, see
** <http://www.gnu.org/licenses/>.
*/

/**
* Copyright 2002-2006 Ethan Galstad
* Copyright 2011-2019 Centreon
*
* This file is part of Centreon Engine.
*
* Centreon Engine is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* Centreon Engine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Centreon Engine. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef CCE_CONFIG_HH
#define CCE_CONFIG_HH

Expand All @@ -30,7 +29,7 @@ extern "C" {
#endif // C++

// Detects circular dependencies and paths.
int pre_flight_circular_check(int* w, int* e);
int pre_flight_circular_check(uint32_t* w, uint32_t* e);

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class anomalydetection : public object {
bool operator==(anomalydetection const& other) const noexcept;
bool operator!=(anomalydetection const& other) const noexcept;
bool operator<(anomalydetection const& other) const noexcept;
void check_validity() const override;
void check_validity(error_cnt& err) const override;
key_type key() const;
void merge(object const& obj) override;
bool parse(char const* key, char const* value) override;
Expand Down Expand Up @@ -144,8 +144,6 @@ class anomalydetection : public object {
bool _set_display_name(std::string const& value);
bool _set_event_handler(std::string const& value);
bool _set_event_handler_enabled(bool value);
bool _set_failure_prediction_enabled(bool value);
bool _set_failure_prediction_options(std::string const& value);
bool _set_first_notification_delay(unsigned int value);
bool _set_flap_detection_enabled(bool value);
bool _set_flap_detection_options(std::string const& value);
Expand All @@ -165,7 +163,6 @@ class anomalydetection : public object {
bool _set_notification_interval(unsigned int value);
bool _set_notification_period(std::string const& value);
bool _set_obsess_over_service(bool value);
bool _set_parallelize_check(bool value);
bool _set_process_perf_data(bool value);
bool _set_retain_nonstatus_information(bool value);
bool _set_retain_status_information(bool value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/**
* Copyright 2020-2024 Centreon
*
* This file is part of Centreon Engine.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* Centreon Engine is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Centreon Engine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
* You should have received a copy of the GNU General Public License
* along with Centreon Engine. If not, see
* <http://www.gnu.org/licenses/>.
*/

#ifndef CCE_CONFIGURATION_APPLIER_ANOMALYDETECTION_HH
#define CCE_CONFIGURATION_APPLIER_ANOMALYDETECTION_HH
#include "com/centreon/engine/configuration/applier/state.hh"

namespace com::centreon::engine {

Expand All @@ -43,7 +43,8 @@ class anomalydetection {
void modify_object(configuration::anomalydetection const& obj);
void remove_object(configuration::anomalydetection const& obj);
void expand_objects(configuration::state& s);
void resolve_object(configuration::anomalydetection const& obj);
void resolve_object(configuration::anomalydetection const& obj,
error_cnt& err);
};
} // namespace applier
} // namespace configuration
Expand Down
26 changes: 13 additions & 13 deletions engine/inc/com/centreon/engine/configuration/applier/command.hh
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/**
* Copyright 2011-2013,2017,2023-2024 Centreon
*
* This file is part of Centreon Engine.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* Centreon Engine is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Centreon Engine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
* You should have received a copy of the GNU General Public License
* along with Centreon Engine. If not, see
* <http://www.gnu.org/licenses/>.
*/

#ifndef CCE_CONFIGURATION_APPLIER_COMMAND_HH
#define CCE_CONFIGURATION_APPLIER_COMMAND_HH
#include "com/centreon/engine/configuration/applier/state.hh"

namespace com::centreon::engine {

Expand Down Expand Up @@ -46,7 +46,7 @@ class command {
void expand_objects(configuration::state& s);
void modify_object(configuration::command const& obj);
void remove_object(configuration::command const& obj);
void resolve_object(configuration::command const& obj);
void resolve_object(configuration::command const& obj, error_cnt& err);
};
} // namespace applier
} // namespace configuration
Expand Down
28 changes: 14 additions & 14 deletions engine/inc/com/centreon/engine/configuration/applier/connector.hh
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/**
* Copyright 2011-2013,2017,2023 Centreon
* Copyright 2011-2013,2017,2023-2024 Centreon
*
* This file is part of Centreon Engine.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* Centreon Engine is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Centreon Engine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
* You should have received a copy of the GNU General Public License
* along with Centreon Engine. If not, see
* <http://www.gnu.org/licenses/>.
*/

#ifndef CCE_CONFIGURATION_APPLIER_CONNECTOR_HH
#define CCE_CONFIGURATION_APPLIER_CONNECTOR_HH
#include "com/centreon/engine/configuration/applier/state.hh"

namespace com::centreon::engine {

Expand All @@ -44,7 +44,7 @@ class connector {
void modify_object(const configuration::connector& obj);
void remove_object(configuration::connector const& obj);
void expand_objects(configuration::state& s);
void resolve_object(configuration::connector const& obj);
void resolve_object(configuration::connector const& obj, error_cnt& err);
};
} // namespace applier
} // namespace configuration
Expand Down
28 changes: 14 additions & 14 deletions engine/inc/com/centreon/engine/configuration/applier/contact.hh
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/**
* Copyright 2011-2013,2017,2023 Centreon
* Copyright 2011-2013,2017,2023-2024 Centreon
*
* This file is part of Centreon Engine.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* Centreon Engine is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Centreon Engine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
* You should have received a copy of the GNU General Public License
* along with Centreon Engine. If not, see
* <http://www.gnu.org/licenses/>.
*/

#ifndef CCE_CONFIGURATION_APPLIER_CONTACT_HH
#define CCE_CONFIGURATION_APPLIER_CONTACT_HH
#include "com/centreon/engine/configuration/applier/state.hh"

namespace com::centreon::engine {

Expand Down Expand Up @@ -46,7 +46,7 @@ class contact {
void modify_object(const configuration::contact& obj);
void remove_object(const configuration::contact& obj);
void expand_objects(configuration::state& s);
void resolve_object(const configuration::contact& obj);
void resolve_object(const configuration::contact& obj, error_cnt& err);
};
} // namespace applier
} // namespace configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/**
* Copyright 2011-2013,2017,2023 Centreon
* Copyright 2011-2013,2017,2023-2024 Centreon
*
* This file is part of Centreon Engine.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* Centreon Engine is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Centreon Engine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : [email protected]
*
* You should have received a copy of the GNU General Public License
* along with Centreon Engine. If not, see
* <http://www.gnu.org/licenses/>.
*/

#ifndef CCE_CONFIGURATION_APPLIER_CONTACTGROUP_HH
#define CCE_CONFIGURATION_APPLIER_CONTACTGROUP_HH

#include "com/centreon/engine/configuration/applier/state.hh"
#include "com/centreon/engine/configuration/contactgroup.hh"

namespace com::centreon::engine {
Expand Down Expand Up @@ -54,7 +54,7 @@ class contactgroup {
void modify_object(configuration::contactgroup const& obj);
void remove_object(configuration::contactgroup const& obj);
void expand_objects(configuration::state& s);
void resolve_object(configuration::contactgroup const& obj);
void resolve_object(configuration::contactgroup const& obj, error_cnt& err);
};
} // namespace applier
} // namespace configuration
Expand Down
Loading

0 comments on commit 2e726dd

Please sign in to comment.