From cd68d10d166fb5fb0cb98e23db8b07326309d870 Mon Sep 17 00:00:00 2001 From: Jean Christophe Roques Date: Mon, 24 Jun 2024 15:28:19 +0200 Subject: [PATCH] we embed mariadb connector and caching_sha2_password.so in centreon packages --- .github/docker/Dockerfile.centreon-collect-alma9 | 1 - .../Dockerfile.centreon-collect-debian-bullseye | 1 - .../Dockerfile.centreon-collect-mysql-alma9 | 1 - .../Dockerfile.centreon-collect-mysql-alma9-test | 1 - .github/scripts/collect-unit-tests.sh | 1 + CMakeLists.txt | 3 --- broker/CMakeLists.txt | 15 +++++++++------ conanfile.txt | 1 + packaging/centreon-broker-core.yaml | 10 ++++++++-- tests/broker-engine/big-metrics.robot | 6 +++++- 10 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/docker/Dockerfile.centreon-collect-alma9 b/.github/docker/Dockerfile.centreon-collect-alma9 index 31fc0f14b80..09076dd7879 100644 --- a/.github/docker/Dockerfile.centreon-collect-alma9 +++ b/.github/docker/Dockerfile.centreon-collect-alma9 @@ -29,7 +29,6 @@ dnf --best install -y cmake \ openssh-server \ mariadb-server \ mariadb \ - mariadb-connector-c-devel \ gnutls-devel \ libgcrypt-devel \ lua-devel \ diff --git a/.github/docker/Dockerfile.centreon-collect-debian-bullseye b/.github/docker/Dockerfile.centreon-collect-debian-bullseye index 5b5b2cb8688..def8c861329 100644 --- a/.github/docker/Dockerfile.centreon-collect-debian-bullseye +++ b/.github/docker/Dockerfile.centreon-collect-debian-bullseye @@ -16,7 +16,6 @@ apt-get -y install cmake \ mariadb-server \ openssh-server \ libmariadb3 \ - libmariadb-dev \ librrd-dev \ libgnutls28-dev \ liblua5.3-dev \ diff --git a/.github/docker/Dockerfile.centreon-collect-mysql-alma9 b/.github/docker/Dockerfile.centreon-collect-mysql-alma9 index b49516d8c7a..068e0f781f1 100644 --- a/.github/docker/Dockerfile.centreon-collect-mysql-alma9 +++ b/.github/docker/Dockerfile.centreon-collect-mysql-alma9 @@ -25,7 +25,6 @@ dnf --best install -y cmake \ gdb \ gettext \ git \ - mariadb-connector-c-devel \ ninja-build \ openssh-server \ mysql-server \ diff --git a/.github/docker/Dockerfile.centreon-collect-mysql-alma9-test b/.github/docker/Dockerfile.centreon-collect-mysql-alma9-test index e0746f5e22c..fb460cebb36 100644 --- a/.github/docker/Dockerfile.centreon-collect-mysql-alma9-test +++ b/.github/docker/Dockerfile.centreon-collect-mysql-alma9-test @@ -20,7 +20,6 @@ dnf --best install -y gcc \ gdb \ git \ openssh-server \ - mariadb-connector-c \ mysql-server \ mysql \ gnutls \ diff --git a/.github/scripts/collect-unit-tests.sh b/.github/scripts/collect-unit-tests.sh index 57f7d6b11a0..ea6239a89da 100755 --- a/.github/scripts/collect-unit-tests.sh +++ b/.github/scripts/collect-unit-tests.sh @@ -13,6 +13,7 @@ else CXXFLAGS="-Wall -Wextra" cmake3 -G "Ninja" -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DWITH_CENTREON_CLIB_INCLUDE_DIR=../clib/inc/ -DWITH_CENTREON_CLIB_LIBRARIES=centreon-clib/libcentreon_clib.so -DCMAKE_BUILD_TYPE=Debug -DWITH_PREFIX=/usr -DWITH_PREFIX_BIN=/usr/sbin -DWITH_USER_BROKER=centreon-broker -DWITH_USER_ENGINE=centreon-engine -DWITH_GROUP_BROKER=centreon-broker -DWITH_GROUP_ENGINE=centreon-engine -DWITH_TESTING=On -DWITH_PREFIX_MODULES=/usr/share/centreon/lib/centreon-broker -DWITH_PREFIX_CONF_BROKER=/etc/centreon-broker -DWITH_PREFIX_LIB_BROKER=/usr/lib64/nagios -DWITH_PREFIX_CONF_ENGINE=/etc/centreon-engine -DWITH_PREFIX_LIB_ENGINE=/usr/lib64/centreon-engine -DWITH_PREFIX_LIB_CLIB=/usr/lib64/ -DWITH_RW_DIR=/var/lib/centreon-engine/rw -DWITH_VAR_DIR=/var/log/centreon-engine -DWITH_MODULE_SIMU=On .. fi + #Build ninja -j 8 ninja -j 8 install diff --git a/CMakeLists.txt b/CMakeLists.txt index 6df00302781..f40b3b16311 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,9 +142,6 @@ set(CMAKE_PROGRAM_PATH ${CONAN_BIN_DIRS_PROTOBUF};${CMAKE_PROGRAM_PATH}) find_package(Protobuf REQUIRED) -include(FindPkgConfig) -pkg_check_modules(MARIADB REQUIRED libmariadb) - message(NOTICE "-- use protoc compiler: ${Protobuf_PROTOC_EXECUTABLE}") include(GNUInstallDirs) diff --git a/broker/CMakeLists.txt b/broker/CMakeLists.txt index eec85da2593..2dfb6acbb9c 100644 --- a/broker/CMakeLists.txt +++ b/broker/CMakeLists.txt @@ -66,30 +66,33 @@ endif() if(OS_DISTRIBUTOR STREQUAL "Debian" OR OS_DISTRIBUTOR STREQUAL "Ubuntu") message(STATUS "deb based os") add_definitions("-DMYSQL_SOCKET=\"/var/run/mysqld/mysqld.sock\"") - add_definitions("-DDEFAULT_MARIADB_EXTENSION_DIR=\"/usr/lib/x86_64-linux-gnu/libmariadb3/plugin\"") + add_definitions("-DDEFAULT_MARIADB_EXTENSION_DIR=\"/usr/lib/x86_64-linux-gnu/centreon-broker\"") elseif(OS_DISTRIBUTOR STREQUAL "CentOS" OR OS_DISTRIBUTOR STREQUAL "RedHat") message(STATUS "rpm based os") add_definitions("-DMYSQL_SOCKET=\"/var/lib/mysql/mysql.sock\"") - add_definitions("-DDEFAULT_MARIADB_EXTENSION_DIR=\"/usr/lib64/mariadb/plugin\"") + add_definitions("-DDEFAULT_MARIADB_EXTENSION_DIR=\"/usr/lib64/centreon-broker\"") else() message(STATUS "other os: ${OS_DISTRIBUTOR}") add_definitions("-DMYSQL_SOCKET=\"/tmp/mysql.sock\"") - add_definitions("-DDEFAULT_MARIADB_EXTENSION_DIR=\"/usr/lib/x86_64-linux-gnu/libmariadb3/plugin\"") + add_definitions("-DDEFAULT_MARIADB_EXTENSION_DIR=\"/usr/lib/x86_64-linux-gnu/centreon-broker\"") endif() +#we have to provide caching_sha2_password.so generated by conan in order to avoid conflicts with other versions of openssl +configure_file(${CONAN_LIB_DIRS_MARIADB-CONNECTOR-C}/plugin/caching_sha2_password.so ${CMAKE_BINARY_DIR}/lib/caching_sha2_password.so COPYONLY) + + include_directories( "${PROJECT_SOURCE_DIR}/core/inc" "${PROJECT_SOURCE_DIR}/neb/inc" "${CMAKE_SOURCE_DIR}/engine/inc" "${PROJECT_SOURCE_DIR}/core/multiplexing/inc" - "${PROJECT_SOURCE_DIR}/core/sql/inc" - "${MARIADB_INCLUDE_DIRS}") + "${PROJECT_SOURCE_DIR}/core/sql/inc") set(INC_DIR "${PROJECT_SOURCE_DIR}/core/inc/com/centreon/broker") set(SRC_DIR "${PROJECT_SOURCE_DIR}/core/src") set(TEST_DIR "${PROJECT_SOURCE_DIR}/core/test") add_definitions(-DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE) -add_definitions(${spdlog_DEFINITIONS}) +add_definitions(${spdlog_DEFINITIONS} ${mariadb-connector-c_DEFINITIONS}) include_directories(${CONAN_INCLUDE_DIRS_MARIADB-CONNECTOR-C}) diff --git a/conanfile.txt b/conanfile.txt index a0a51a4135c..b03f140fb83 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -6,6 +6,7 @@ grpc/1.54.3 gtest/cci.20210126 libcurl/8.0.1 libssh2/1.10.0 +mariadb-connector-c/3.3.3 nlohmann_json/3.11.2 openssl/1.1.1t opentelemetry-cpp/1.14.2 diff --git a/packaging/centreon-broker-core.yaml b/packaging/centreon-broker-core.yaml index 8eb8369b23a..32e3f97856e 100644 --- a/packaging/centreon-broker-core.yaml +++ b/packaging/centreon-broker-core.yaml @@ -18,6 +18,14 @@ contents: - src: "../lib/{10-neb,15-stats,20-bam,20-storage,20-unified_sql,50-tcp,50-grpc,60-tls,70-rrd,70-lua,80-sql}.so" dst: "/usr/share/centreon/lib/centreon-broker/" + - src: "../lib/caching_sha2_password.so" + dst: "/usr/lib64/centreon-broker" + packager: rpm + + - src: "../lib/caching_sha2_password.so" + dst: "/usr/lib/x86_64-linux-gnu/centreon-broker" + packager: deb + - src: "../broker/script/centreon-broker.logrotate" dst: "/etc/logrotate.d/cbd" type: config|noreplace @@ -43,7 +51,6 @@ overrides: - centreon-clib = ${VERSION}-${RELEASE}${DIST} - centreon-broker = ${VERSION}-${RELEASE}${DIST} - gnutls >= 3.3.29 - - mariadb-connector-c >= 3.1.10 conflicts: - centreon-broker-storage - centreon-broker-core-devel @@ -59,7 +66,6 @@ overrides: - centreon-clib (= ${VERSION}-${RELEASE}${DIST}) - centreon-broker (= ${VERSION}-${RELEASE}${DIST}) - libgnutls30 - - libmariadb3 conflicts: - centreon-broker-storage - centreon-broker-core-dev diff --git a/tests/broker-engine/big-metrics.robot b/tests/broker-engine/big-metrics.robot index 84e3176550b..fcf0e13da35 100644 --- a/tests/broker-engine/big-metrics.robot +++ b/tests/broker-engine/big-metrics.robot @@ -1,7 +1,11 @@ *** Settings *** Documentation There tests are about big metric values -Resource ../resources/import.resource +Resource ../resources/resources.robot + +Library ../resources/Engine.py +Library ../resources/Broker.py +Library ../resources/Common.py Suite Setup Ctn Clean Before Suite Suite Teardown Ctn Clean After Suite