Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 888c7c9

Browse files
bouda1centreonpm
andauthored
fix(conan): build using conan-center works again
* fix(json): json11 changed to nlohmann_json * enh(conan): All our external packages come from the conan center * fix(test/config): fix somes parser tests * enh(influxdb/test): all tests works fine * fix(tcp): warning removed in unittests compilation * fix(bam): unittest could fail because of a missing loop test. * fix(link): several link issues * fix(stats): The center could segfault if the strand is not empty at destruction Co-authored-by: centreonpm <pmargale@centreon.com>
1 parent b6e3a26 commit 888c7c9

File tree

79 files changed

+828
-735
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+828
-735
lines changed

CHANGELOG.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
# Changelog
2-
## 21.04.2
2+
3+
## 21.04.1
4+
5+
`Date of the release`
6+
7+
### Build
8+
9+
Since the bintray closure, we could not build cbd. Dependencies have been moved
10+
to the conan-center and the build is back.
311

412
### Bam
513

614
*meta-services*
715

816
Meta-services are removed from broker. This code was not used and could produce
917

10-
## 21.04.1
11-
12-
`Date of the release`
13-
1418
### Enhancements
1519

1620
*Storage*
1721

18-
We optimize queries by removing useless join. A join with hosts table is not necessary in
19-
certain queries.
22+
We optimize queries by removing useless join. A join with hosts table is not
23+
necessary in certain queries.
2024

2125
## 21.04.0
2226

CMakeLists.txt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_ID STREQ
2727
message(FATAL_ERROR "You can build broker with g++ or clang++. CMake will exit.")
2828
endif ()
2929

30-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
30+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
3131
add_definitions("-D_GLIBCXX_USE_CXX11_ABI=1")
3232

3333
# With ASIO DEBUGGING ENABLED
@@ -65,12 +65,11 @@ add_custom_target(table_max_size DEPENDS ${INC_DIR}/database/table_max_size.hh)
6565
set_source_files_properties(${INC_DIR}/database/table_max_size.hh PROPERTIES GENERATED TRUE)
6666

6767
set(protobuf_MODULE_COMPATIBLE True)
68-
find_package(json11 REQUIRED)
68+
find_package(nlohmann_json REQUIRED)
6969
find_package(fmt REQUIRED)
7070
find_package(spdlog REQUIRED)
7171
find_package(asio REQUIRED)
72-
find_package(protobuf REQUIRED)
73-
find_package(protoc_installer REQUIRED)
72+
find_package(Protobuf REQUIRED)
7473
find_package(gRPC REQUIRED)
7574
find_package(OpenSSL REQUIRED)
7675
find_package(c-ares REQUIRED)
@@ -79,16 +78,17 @@ find_package(mariadb-connector-c REQUIRED)
7978

8079
add_definitions(${spdlog_DEFINITIONS} ${mariadb-connector-c_DEFINITIONS})
8180

82-
include_directories(${json11_INCLUDE_DIRS})
81+
include_directories(${nlohmann_json_INCLUDE_DIRS})
8382
include_directories(${fmt_INCLUDE_DIRS})
8483
include_directories(${spdlog_INCLUDE_DIRS})
8584
include_directories(${asio_INCLUDE_DIRS})
8685
include_directories(${protobuf_INCLUDE_DIRS})
86+
include_directories(${absl_INCLUDE_DIRS})
8787
include_directories(${gRPC_INCLUDE_DIRS})
8888
include_directories(${ZLIB_INCLUDE_DIRS})
89-
include_directories(${mariadb-connector-c_INCLUDE_DIRS}/mysql)
89+
include_directories(${mariadb-connector-c_INCLUDE_DIRS})
9090

91-
link_directories(${json11_LIB_DIRS})
91+
link_directories(${nlohmann_json_LIB_DIRS})
9292
link_directories(${fmt_LIB_DIRS})
9393
link_directories(${spdlog_LIB_DIRS})
9494
link_directories(${protobuf_LIB_DIRS})
@@ -98,8 +98,7 @@ link_directories(${OpenSSL_LIB_DIRS})
9898
link_directories(${ZLIB_LIB_DIRS})
9999
link_directories(${mariadb-connector-c_LIB_DIRS})
100100

101-
message(STATUS "Using protobuf ${gRPC_VERSION}")
102-
set(PROTOBUF_PREFIX "${protoc_installer_LIB_DIRS}/..")
101+
set(PROTOBUF_PREFIX "${protobuf_LIB_DIRS}/..")
103102
message(STATUS "${PROTOBUF_PREFIX}/bin/protoc")
104103
set(GRPC_PREFIX "${gRPC_LIB_DIRS}/..")
105104

@@ -574,23 +573,23 @@ set(LIBROKER_SOURCES
574573
# Static libraries.
575574
add_library(rokerbase STATIC ${LIBROKER_SOURCES})
576575
set_target_properties(rokerbase PROPERTIES COMPILE_FLAGS "-fPIC")
577-
target_link_libraries(rokerbase ${ZLIB_LIBRARIES} ${mariadb-connector-c_LIBS} pthread dl berpc)
576+
target_link_libraries(rokerbase ${ZLIB_LIBRARIES} ${OpenSSL_LIBS} ${mariadb-connector-c_LIBS} pthread dl berpc)
578577

579578
add_library(roker STATIC
580579
${SRC_DIR}/config/applier/init.cc
581580
${SRC_DIR}/config/applier/logger.cc)
582-
target_link_libraries(roker rokerbase dl ${c-ares_LIBS} ${gRPC_LIBS} ${absl_LIBS} grpc++_reflection)
581+
target_link_libraries(roker rokerbase dl ${c-ares_LIBS} ${OpenSSL_LIBS} ${gRPC_LIBS} ${absl_LIBS} grpc++_reflection)
583582

584583
# Standalone binary.
585584
set(DAEMON cbd)
586585
add_executable(${DAEMON} ${SRC_DIR}/main.cc)
587586

588587
#Flags needed to include all symbols in binary.
589588
target_link_libraries("${DAEMON}"
590-
"-Wl,--whole-archive" grpc++_reflection rokerbase roker "-Wl,--no-whole-archive" ${json11_LIBS} ${fmt_LIBS} ${spdlog_LIBS} ${gRPC_LIBS} ${absl_LIBS} )
589+
"-Wl,--whole-archive" grpc++_reflection rokerbase roker "-Wl,--no-whole-archive" ${nlohmann_json_LIBS} ${fmt_LIBS} ${spdlog_LIBS} ${gRPC_LIBS} ${absl_LIBS} pthread)
591590

592591
# Centreon Broker Watchdog
593-
option(WITH_CBWD "Build centreon broker watchdong." ON)
592+
option(WITH_CBWD "Build centreon broker watchdog." ON)
594593
if (WITH_CBWD)
595594
add_subdirectory(watchdog)
596595
endif ()

bam/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##
2-
## Copyright 2011-2016 Centreon
2+
## Copyright 2011-2021 Centreon
33
##
44
## Licensed under the Apache License, Version 2.0 (the "License");
55
## you may not use this file except in compliance with the License.

bam/inc/com/centreon/broker/bam/monitoring_stream.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class monitoring_stream : public io::stream {
6666
int32_t stop() override;
6767
void initialize();
6868
bool read(std::shared_ptr<io::data>& d, time_t deadline) override;
69-
void statistics(json11::Json::object& tree) const override;
69+
void statistics(nlohmann::json& tree) const override;
7070
void update() override final;
7171
int write(std::shared_ptr<io::data> const& d) override;
7272

bam/inc/com/centreon/broker/bam/reporting_stream.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class reporting_stream : public io::stream {
9494
int32_t flush() override;
9595
int32_t stop() override;
9696
bool read(std::shared_ptr<io::data>& d, time_t deadline) override;
97-
void statistics(json11::Json::object& tree) const override;
97+
void statistics(nlohmann::json& tree) const override;
9898
int write(std::shared_ptr<io::data> const& d) override;
9999

100100
private:

bam/src/monitoring_stream.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ bool monitoring_stream::read(std::shared_ptr<io::data>& d, time_t deadline) {
154154
*
155155
* @param[out] tree Output tree.
156156
*/
157-
void monitoring_stream::statistics(json11::Json::object& tree) const {
157+
void monitoring_stream::statistics(nlohmann::json& tree) const {
158158
std::lock_guard<std::mutex> lock(_statusm);
159159
if (!_status.empty())
160160
tree["status"] = _status;

bam/src/reporting_stream.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ bool reporting_stream::read(std::shared_ptr<io::data>& d, time_t deadline) {
109109
*
110110
* @param[out] tree Output tree.
111111
*/
112-
void reporting_stream::statistics(json11::Json::object& tree) const {
112+
void reporting_stream::statistics(nlohmann::json& tree) const {
113113
std::lock_guard<std::mutex> lock(_statusm);
114114
if (!_status.empty())
115115
tree["status"] = _status;

bam/test/ba/kpi_service.cc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,10 @@ TEST_F(BamBA, KpiServiceImpactState) {
184184
ASSERT_EQ(it->end_time, -1);
185185
ASSERT_EQ(it->status, 2);
186186
ASSERT_FALSE(it->in_downtime);
187-
do {
188-
++it;
189-
} while (it->typ != test_visitor::test_event::kpi);
187+
while (++it != events.end()) {
188+
if (it->typ == test_visitor::test_event::kpi)
189+
break;
190+
}
190191
}
191192
}
192193
}
@@ -335,9 +336,10 @@ TEST_F(BamBA, KpiServiceWorstState) {
335336
ASSERT_EQ(it->end_time, -1);
336337
ASSERT_EQ(it->status, 2);
337338
ASSERT_FALSE(it->in_downtime);
338-
do {
339-
++it;
340-
} while (it->typ != test_visitor::test_event::kpi);
339+
while (++it != events.end()) {
340+
if (it->typ == test_visitor::test_event::kpi)
341+
break;
342+
}
341343
}
342344
}
343345
}

conanfile.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
[requires]
2-
gtest/1.8.1@bincrafters/stable
2+
gtest/cci.20210126
33
asio/1.18.1
4-
fmt/7.1.2
5-
spdlog/1.8.1
6-
json11/e2e3a11@centreon/stable
7-
openssl/1.1.1h
8-
grpc/1.27.3@inexorgame/stable
9-
mariadb-connector-c/3.1.10
4+
fmt/7.1.3
5+
spdlog/1.8.5
6+
nlohmann_json/3.9.1
7+
openssl/1.1.1k
8+
protobuf/3.15.5
9+
grpc/1.37.0
10+
mariadb-connector-c/3.1.12
1011
zlib/1.2.11
1112

1213
[generators]

core/inc/com/centreon/broker/bbdo/acceptor.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class acceptor : public io::endpoint {
6464
acceptor(const acceptor&) = delete;
6565
acceptor& operator=(const acceptor&) = delete;
6666
std::unique_ptr<io::stream> open() override;
67-
void stats(json11::Json::object& tree) override;
67+
void stats(nlohmann::json& tree) override;
6868
bool is_one_peer_retention() const { return _one_peer_retention_mode; }
6969

7070
private:

0 commit comments

Comments
 (0)