Skip to content

Commit 7668f91

Browse files
author
Pat
authored
config: enable YAML support by default (#5360)
* config: add hint for format error Signed-off-by: Patrick Stephens <[email protected]> * cmakefiles: enable YAML support by default Signed-off-by: Patrick Stephens <[email protected]> * workflows: add yaml libs Signed-off-by: Patrick Stephens <[email protected]> * windows: make it explicit that YAML is disabled Signed-off-by: Patrick Stephens <[email protected]> * config: disable YAML support for fuzzing Signed-off-by: Patrick Stephens <[email protected]>
1 parent 937570b commit 7668f91

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

.github/workflows/unit-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
if: matrix.os == 'ubuntu-18.04'
5555
run: |
5656
sudo apt update
57-
sudo apt install -yyq gcc-7 g++-7 clang-6.0 libsystemd-dev gcovr
57+
sudo apt install -yyq gcc-7 g++-7 clang-6.0 libsystemd-dev gcovr libyaml-dev
5858
sudo ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer || true
5959
6060
- uses: actions/checkout@v3

CMakeLists.txt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ option(FLB_PROXY_GO "Enable Go plugins support" Yes)
118118
# Built-in Custom Plugins
119119
option(FLB_CUSTOM_CALYPTIA "Enable Calyptia Support" Yes)
120120

121+
# Config formats
122+
option(FLB_CONFIG_YAML "Enable YAML config format" Yes)
123+
121124
# Built-in Plugins
122125
option(FLB_IN_CPU "Enable CPU input plugin" Yes)
123126
option(FLB_IN_THERMAL "Enable Thermal plugin" Yes)
@@ -297,6 +300,8 @@ endif()
297300

298301
if (FLB_TESTS_OSSFUZZ)
299302
FLB_DEFINITION(FLB_HAVE_TESTS_OSSFUZZ)
303+
# Disable for fuzz testing
304+
set(FLB_CONFIG_YAML Off)
300305
endif()
301306

302307
# Set Fluent Bit dependency libraries path
@@ -659,14 +664,25 @@ if(FLB_HAVE_UNIX_SOCKET)
659664
FLB_DEFINITION(FLB_HAVE_UNIX_SOCKET)
660665
endif()
661666

662-
# libyaml support
667+
# Configuration file YAML format support
668+
if(FLB_CONFIG_YAML)
669+
# Requies libyaml support
663670
check_c_source_compiles("
664671
#include <yaml.h>
665672
int main() {
666673
yaml_parser_t parser;
667674
return 0;
668675
}" FLB_HAVE_LIBYAML)
669-
if(FLB_HAVE_LIBYAML)
676+
677+
if(NOT FLB_HAVE_LIBYAML)
678+
message(FATAL_ERROR
679+
"YAML development dependencies required for YAML configuration format handling.\n"
680+
"This is a build time dependency, you can either install the "
681+
"dependencies or disable the feature setting the CMake option "
682+
"-DFLB_CONFIG_YAML=Off ."
683+
)
684+
endif()
685+
670686
FLB_DEFINITION(FLB_HAVE_LIBYAML)
671687
endif()
672688

cmake/windows-setup.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ if(FLB_WINDOWS_DEFAULTS)
1414
set(FLB_AWS Yes)
1515
set(FLB_HTTP_SERVER Yes)
1616
set(FLB_METRICS Yes)
17+
set(FLB_CONFIG_YAML No)
1718

1819
# INPUT plugins
1920
# =============

dockerfiles/Dockerfile.centos7

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RUN yum -y update && \
77
yum install -y rpm-build curl ca-certificates gcc gcc-c++ cmake make bash \
88
wget unzip systemd-devel wget flex bison \
99
cyrus-sasl-lib cyrus-sasl-devel openssl openss-libs openssl-devel \
10-
postgresql-libs postgresql-devel postgresql-server postgresql && \
10+
postgresql-libs postgresql-devel postgresql-server postgresql libyaml-devel && \
1111
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \
1212
rpm -ivh epel-release-latest-7.noarch.rpm && \
1313
yum install -y cmake3

src/config_format/flb_cf_fluentbit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ static int read_config(struct flb_cf *cf, struct local_ctx *ctx,
604604
key_len = i;
605605

606606
if (!key || i < 0) {
607-
config_error(cfg_file, line, "undefined key");
607+
config_error(cfg_file, line, "undefined key - check config is in valid classic format");
608608
goto error;
609609
}
610610

0 commit comments

Comments
 (0)