Commit 7d7c28ef authored by David Boucher's avatar David Boucher
Browse files

cleanup(cce_core): Coding style applied.

parent d107389d
......@@ -24,8 +24,8 @@
#include <future>
#include <mutex>
#include "com/centreon/engine/namespace.hh"
#include "com/centreon/engine/engine_impl.hh"
#include "com/centreon/engine/namespace.hh"
CCE_BEGIN()
class command_manager {
......
......@@ -31,8 +31,8 @@
#include "com/centreon/engine/events/sched_info.hh"
#include "com/centreon/engine/events/timed_event.hh"
#include "com/centreon/engine/nebmods.hh"
#include "com/centreon/engine/utils.hh"
#include "com/centreon/engine/restart_stats.hh"
#include "com/centreon/engine/utils.hh"
#ifdef __cplusplus
extern "C" {
......
......@@ -17,6 +17,7 @@
*
*/
#include <chrono>
#include "com/centreon/engine/namespace.hh"
CCE_BEGIN()
......
......@@ -17,7 +17,9 @@
*/
#include "com/centreon/broker/neb/statistics/hosts_checked.hh"
#include <sstream>
#include "com/centreon/broker/config/applier/state.hh"
#include "com/centreon/broker/neb/internal.hh"
#include "com/centreon/engine/globals.hh"
......
......@@ -17,7 +17,9 @@
*/
#include "com/centreon/broker/neb/statistics/services_checked.hh"
#include <sstream>
#include "com/centreon/broker/config/applier/state.hh"
#include "com/centreon/broker/neb/internal.hh"
#include "com/centreon/engine/globals.hh"
......
......@@ -18,7 +18,9 @@
*/
#include "com/centreon/engine/checkable.hh"
#include <sstream>
#include "com/centreon/engine/exceptions/error.hh"
#include "com/centreon/engine/logging/logger.hh"
......
......@@ -23,8 +23,8 @@
#include <sys/types.h>
#include <unistd.h>
#include "com/centreon/engine/comment.hh"
#include "com/centreon/engine/checks/checker.hh"
#include "com/centreon/engine/comment.hh"
#include "com/centreon/engine/globals.hh"
#include "com/centreon/engine/logging/logger.hh"
......
......@@ -21,7 +21,9 @@
*/
#include "com/centreon/engine/globals.hh"
#include <map>
#include "com/centreon/engine/logging/logger.hh"
#include "compatibility/nagios.h"
......
......@@ -3432,8 +3432,7 @@ bool host::authorized_by_dependencies(dependency::types dependency_type) const {
if (dep->get_fail_on(state))
return false;
if (state == host::state_up &&
!dep->master_host_ptr->has_been_checked() &&
if (state == host::state_up && !dep->master_host_ptr->has_been_checked() &&
dep->get_fail_on_pending())
return false;
......
......@@ -19,7 +19,9 @@
*/
#include "com/centreon/engine/macros/grab_value.hh"
#include <cstdlib>
#include "com/centreon/engine/configuration/applier/state.hh"
#include "com/centreon/engine/globals.hh"
#include "com/centreon/engine/logging/logger.hh"
......@@ -655,19 +657,26 @@ static int handle_summary_macro(nagios_macros* mac,
mac->x[MACRO_TOTALHOSTSUP] = std::to_string(hosts_up);
mac->x[MACRO_TOTALHOSTSDOWN] = std::to_string(hosts_down);
mac->x[MACRO_TOTALHOSTSUNREACHABLE] = std::to_string(hosts_unreachable);
mac->x[MACRO_TOTALHOSTSDOWNUNHANDLED] = std::to_string(hosts_down_unhandled);
mac->x[MACRO_TOTALHOSTSUNREACHABLEUNHANDLED] = std::to_string(hosts_unreachable_unhandled);
mac->x[MACRO_TOTALHOSTSDOWNUNHANDLED] =
std::to_string(hosts_down_unhandled);
mac->x[MACRO_TOTALHOSTSUNREACHABLEUNHANDLED] =
std::to_string(hosts_unreachable_unhandled);
mac->x[MACRO_TOTALHOSTPROBLEMS] = std::to_string(host_problems);
mac->x[MACRO_TOTALHOSTPROBLEMSUNHANDLED] = std::to_string(host_problems_unhandled);
mac->x[MACRO_TOTALHOSTPROBLEMSUNHANDLED] =
std::to_string(host_problems_unhandled);
mac->x[MACRO_TOTALSERVICESOK] = std::to_string(services_ok);
mac->x[MACRO_TOTALSERVICESWARNING] = std::to_string(services_warning);
mac->x[MACRO_TOTALSERVICESCRITICAL] = std::to_string(services_critical);
mac->x[MACRO_TOTALSERVICESUNKNOWN] = std::to_string(services_unknown);
mac->x[MACRO_TOTALSERVICESWARNINGUNHANDLED] = std::to_string(services_warning_unhandled);
mac->x[MACRO_TOTALSERVICESCRITICALUNHANDLED] = std::to_string(services_critical_unhandled);
mac->x[MACRO_TOTALSERVICESUNKNOWNUNHANDLED] = std::to_string(services_unknown_unhandled);
mac->x[MACRO_TOTALSERVICESWARNINGUNHANDLED] =
std::to_string(services_warning_unhandled);
mac->x[MACRO_TOTALSERVICESCRITICALUNHANDLED] =
std::to_string(services_critical_unhandled);
mac->x[MACRO_TOTALSERVICESUNKNOWNUNHANDLED] =
std::to_string(services_unknown_unhandled);
mac->x[MACRO_TOTALSERVICEPROBLEMS] = std::to_string(service_problems);
mac->x[MACRO_TOTALSERVICEPROBLEMSUNHANDLED] = std::to_string(service_problems_unhandled);
mac->x[MACRO_TOTALSERVICEPROBLEMSUNHANDLED] =
std::to_string(service_problems_unhandled);
}
// Return only the macro the user requested.
......
......@@ -18,6 +18,7 @@
*/
#include "com/centreon/engine/retention/applier/service.hh"
#include "com/centreon/engine/configuration/applier/state.hh"
#include "com/centreon/engine/flapping.hh"
#include "com/centreon/engine/globals.hh"
......
......@@ -18,8 +18,10 @@
*/
#include "com/centreon/engine/retention/dump.hh"
#include <fstream>
#include <iomanip>
#include "com/centreon/engine/broker.hh"
#include "com/centreon/engine/comment.hh"
#include "com/centreon/engine/configuration/applier/state.hh"
......@@ -47,8 +49,7 @@ using namespace com::centreon::engine::retention;
*/
std::ostream& dump::comment(std::ostream& os,
com::centreon::engine::comment const& obj) {
logger(dbg_functions, basic)
<< "dump::comment()";
logger(dbg_functions, basic) << "dump::comment()";
char const* host_name;
char const* service_description;
if (obj.get_comment_type() == com::centreon::engine::comment::host) {
......@@ -58,9 +59,9 @@ std::ostream& dump::comment(std::ostream& os,
host_name = it->second->get_name().c_str();
service_description = "";
os << "hostcomment {\n";
}
else {
auto it = service::services_by_id.find({obj.get_host_id(), obj.get_service_id()});
} else {
auto it =
service::services_by_id.find({obj.get_host_id(), obj.get_service_id()});
if (it == service::services_by_id.end())
return os;
host_name = it->second->get_hostname().c_str();
......@@ -108,8 +109,7 @@ std::ostream& dump::comment(std::ostream& os,
* @return The output stream.
*/
std::ostream& dump::comments(std::ostream& os) {
logger(dbg_functions, basic)
<< "dump::comments()";
logger(dbg_functions, basic) << "dump::comments()";
for (comment_map::iterator it(comment::comments.begin()),
end(comment::comments.end());
it != end; ++it)
......@@ -214,8 +214,7 @@ std::ostream& dump::notifications(
* @return The output stream.
*/
std::ostream& dump::scheduled_downtime(std::ostream& os, downtime const& obj) {
logger(dbg_functions, basic)
<< "dump::scheduled_downtime()";
logger(dbg_functions, basic) << "dump::scheduled_downtime()";
obj.retention(os);
return os;
}
......@@ -228,8 +227,7 @@ std::ostream& dump::scheduled_downtime(std::ostream& os, downtime const& obj) {
* @return The output stream.
*/
std::ostream& dump::downtimes(std::ostream& os) {
logger(dbg_functions, basic)
<< "dump::downtimes()";
logger(dbg_functions, basic) << "dump::downtimes()";
for (std::pair<time_t, std::shared_ptr<downtime>> const& obj :
downtimes::downtime_manager::instance().get_scheduled_downtimes())
dump::scheduled_downtime(os, *obj.second);
......
......@@ -485,8 +485,7 @@ std::ostream& operator<<(std::ostream& os,
<< string::ctime(obj.get_last_time_unknown())
<< "\n last_time_critical: "
<< string::ctime(obj.get_last_time_critical())
<< "\n has_been_checked: "
<< obj.has_been_checked()
<< "\n has_been_checked: " << obj.has_been_checked()
<< "\n is_being_freshened: "
<< obj.get_is_being_freshened()
<< "\n notified_on_unknown: "
......@@ -1850,8 +1849,7 @@ int service::handle_async_check_result(check_result* queued_check_result) {
queued_check_result->get_early_timeout(),
queued_check_result->get_return_code(), nullptr, nullptr);
if (!(reschedule_check && get_should_be_scheduled() &&
has_been_checked()) ||
if (!(reschedule_check && get_should_be_scheduled() && has_been_checked()) ||
!get_checks_enabled()) {
/* set the checked flag */
set_has_been_checked(true);
......
......@@ -21,15 +21,18 @@
*/
#include "com/centreon/engine/xsddefault.hh"
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <sstream>
#include <string>
#include "com/centreon/engine/comment.hh"
#include "com/centreon/engine/common.hh"
#include "com/centreon/engine/configuration/applier/state.hh"
......@@ -109,7 +112,7 @@ int xsddefault_save_status_data() {
// get number of items in the command buffer
if (config->check_external_commands()) {
//FIXME DBR
// FIXME DBR
pthread_mutex_lock(&external_command_buffer.buffer_lock);
used_external_command_buffer_slots = external_command_buffer.items;
high_external_command_buffer_slots = external_command_buffer.high;
......@@ -690,8 +693,7 @@ int xsddefault_save_status_data() {
stream << "\thost_id=" << it->second->get_host_id() << "\n";
if (it->second->get_comment_type() ==
com::centreon::engine::comment::service)
stream << "\tservice_id="
<< it->second->get_service_id() << "\n";
stream << "\tservice_id=" << it->second->get_service_id() << "\n";
stream << "\tentry_type=" << it->second->get_entry_type()
<< "\n"
"\tcomment_id="
......
......@@ -18,6 +18,7 @@
*/
#include <gtest/gtest.h>
#include <sstream>
#define executable "bin/centenginestats2"
......
......@@ -21,8 +21,10 @@
#include <grpcpp/channel.h>
#include <grpcpp/client_context.h>
#include <grpcpp/create_channel.h>
#include <iostream>
#include <memory>
#include "engine.grpc.pb.h"
using namespace com::centreon::engine;
......
......@@ -20,6 +20,7 @@
#include "com/centreon/engine/enginerpc.hh"
#include <gtest/gtest.h>
#include <atomic>
#include <chrono>
#include <cstdio>
......@@ -268,12 +269,12 @@ TEST_F(EngineRpc, GetService) {
th.join();
std::vector<std::string> result_names(output.size());
std::copy(output.begin(), output.end(), result_names.begin());
std::copy(output.begin(), output.end(), result_names.begin());
ASSERT_EQ(vectests, result_names);
std::vector<std::string> result_ids(output2.size());
std::copy(output2.begin(), output2.end(), result_ids.begin());
std::copy(output2.begin(), output2.end(), result_ids.begin());
ASSERT_EQ(vectests, result_ids);
erpc.shutdown();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment