From 09e30448452876ee7f33876c3021475ea10c2bb8 Mon Sep 17 00:00:00 2001 From: jeffreyc-splunk Date: Thu, 21 Sep 2023 14:06:01 -0400 Subject: [PATCH] Rename zeroconfig config files --- instrumentation/packaging/fpm/common.sh | 16 +++++----------- instrumentation/packaging/fpm/deb/build.sh | 3 +-- .../splunk/zeroconfig/java.conf} | 0 .../splunk/zeroconfig/node.conf} | 0 instrumentation/packaging/fpm/rpm/build.sh | 3 +-- instrumentation/src/main.c | 4 ++-- instrumentation/tests/java/Dockerfile | 5 ++--- instrumentation/tests/nodejs/Dockerfile | 6 +++--- .../instrumentation/instrumentation_test.py | 4 ++-- 9 files changed, 16 insertions(+), 25 deletions(-) rename instrumentation/packaging/fpm/{zeroconfig_java.conf => etc/splunk/zeroconfig/java.conf} (100%) rename instrumentation/packaging/fpm/{zeroconfig_node.conf => etc/splunk/zeroconfig/node.conf} (100%) diff --git a/instrumentation/packaging/fpm/common.sh b/instrumentation/packaging/fpm/common.sh index 04f864f70f..99eb693f79 100644 --- a/instrumentation/packaging/fpm/common.sh +++ b/instrumentation/packaging/fpm/common.sh @@ -27,10 +27,8 @@ PKG_URL="https://github.com/signalfx/splunk-otel-collector" INSTALL_DIR="/usr/lib/splunk-instrumentation" LIBSPLUNK_INSTALL_PATH="${INSTALL_DIR}/libsplunk.so" JAVA_AGENT_INSTALL_PATH="${INSTALL_DIR}/splunk-otel-javaagent.jar" -JAVA_CONFIG_REPO_PATH="${FPM_DIR}/zeroconfig_java.conf" -JAVA_CONFIG_INSTALL_PATH="/etc/splunk/zeroconfig_java.conf" -NODE_CONFIG_REPO_PATH="${FPM_DIR}/zeroconfig_node.conf" -NODE_CONFIG_INSTALL_PATH="/etc/splunk/zeroconfig_node.conf" +CONFIG_DIR_REPO_PATH="${FPM_DIR}/etc/splunk/zeroconfig" +CONFIG_DIR_INSTALL_PATH="/etc/splunk/zeroconfig" EXAMPLES_INSTALL_DIR="${INSTALL_DIR}/examples" EXAMPLES_DIR="${FPM_DIR}/examples" @@ -100,13 +98,9 @@ setup_files_and_permissions() { download_nodejs_agent "$nodejs_agent_release" "${buildroot}/${NODEJS_AGENT_INSTALL_PATH}" sudo chmod 644 "$buildroot/$NODEJS_AGENT_INSTALL_PATH" - mkdir -p "$buildroot/$(dirname $JAVA_CONFIG_INSTALL_PATH)" - cp -f "$JAVA_CONFIG_REPO_PATH" "$buildroot/$JAVA_CONFIG_INSTALL_PATH" - sudo chmod 644 "$buildroot/$JAVA_CONFIG_INSTALL_PATH" - - mkdir -p "$buildroot/$(dirname $NODE_CONFIG_INSTALL_PATH)" - cp -f "$NODE_CONFIG_REPO_PATH" "$buildroot/$NODE_CONFIG_INSTALL_PATH" - sudo chmod 644 "$buildroot/$NODE_CONFIG_INSTALL_PATH" + mkdir -p "$buildroot/$CONFIG_DIR_INSTALL_PATH" + cp -rf "$CONFIG_DIR_REPO_PATH"/* "$buildroot/$CONFIG_DIR_INSTALL_PATH"/ + sudo chmod -R 644 "$buildroot/$CONFIG_DIR_INSTALL_PATH" mkdir -p "$buildroot/$INSTALL_DIR" cp -rf "$EXAMPLES_DIR" "$buildroot/$INSTALL_DIR/" diff --git a/instrumentation/packaging/fpm/deb/build.sh b/instrumentation/packaging/fpm/deb/build.sh index 53d6f3a399..5dd09094ac 100755 --- a/instrumentation/packaging/fpm/deb/build.sh +++ b/instrumentation/packaging/fpm/deb/build.sh @@ -47,8 +47,7 @@ sudo fpm -s dir -t deb -n "$PKG_NAME" -v "$VERSION" -f -p "$OUTPUT_DIR" \ --deb-no-default-config-files \ --depends sed \ --depends grep \ - --config-files "$JAVA_CONFIG_INSTALL_PATH" \ - --config-files "$NODE_CONFIG_INSTALL_PATH" \ + --config-files "$CONFIG_DIR_INSTALL_PATH" \ "$buildroot/"=/ dpkg -c "${OUTPUT_DIR}/${PKG_NAME}_${VERSION}_${ARCH}.deb" diff --git a/instrumentation/packaging/fpm/zeroconfig_java.conf b/instrumentation/packaging/fpm/etc/splunk/zeroconfig/java.conf similarity index 100% rename from instrumentation/packaging/fpm/zeroconfig_java.conf rename to instrumentation/packaging/fpm/etc/splunk/zeroconfig/java.conf diff --git a/instrumentation/packaging/fpm/zeroconfig_node.conf b/instrumentation/packaging/fpm/etc/splunk/zeroconfig/node.conf similarity index 100% rename from instrumentation/packaging/fpm/zeroconfig_node.conf rename to instrumentation/packaging/fpm/etc/splunk/zeroconfig/node.conf diff --git a/instrumentation/packaging/fpm/rpm/build.sh b/instrumentation/packaging/fpm/rpm/build.sh index 8c10f4c4a7..61609422eb 100755 --- a/instrumentation/packaging/fpm/rpm/build.sh +++ b/instrumentation/packaging/fpm/rpm/build.sh @@ -56,8 +56,7 @@ sudo fpm -s dir -t rpm -n "$PKG_NAME" -v "$VERSION" -f -p "$OUTPUT_DIR" \ --before-remove "$PREUNINSTALL_PATH" \ --depends sed \ --depends grep \ - --config-files "$JAVA_CONFIG_INSTALL_PATH" \ - --config-files "$NODE_CONFIG_INSTALL_PATH" \ + --config-files "$CONFIG_DIR_INSTALL_PATH" \ "$buildroot/"=/ rpm -qpli "${OUTPUT_DIR}/${PKG_NAME}-${VERSION}-1.${ARCH}.rpm" diff --git a/instrumentation/src/main.c b/instrumentation/src/main.c index 074e02bfb6..497b2f0d10 100644 --- a/instrumentation/src/main.c +++ b/instrumentation/src/main.c @@ -11,8 +11,8 @@ static char *const allowed_env_vars[] = {ALLOWED_ENV_VARS}; static size_t const allowed_env_vars_size = sizeof(allowed_env_vars) / sizeof(*allowed_env_vars); -#define JAVA_ENV_VAR_FILE "/etc/splunk/zeroconfig_java.conf" -#define NODEJS_ENV_VAR_FILE "/etc/splunk/zeroconfig_node.conf" +#define JAVA_ENV_VAR_FILE "/etc/splunk/zeroconfig/java.conf" +#define NODEJS_ENV_VAR_FILE "/etc/splunk/zeroconfig/node.conf" // TODO change to systemd drop in file paths static char *const env_var_file_java = JAVA_ENV_VAR_FILE; diff --git a/instrumentation/tests/java/Dockerfile b/instrumentation/tests/java/Dockerfile index 3f66808ffa..f9dc34d545 100644 --- a/instrumentation/tests/java/Dockerfile +++ b/instrumentation/tests/java/Dockerfile @@ -6,9 +6,9 @@ COPY Main.java . RUN javac Main.java && \ jar cfe Main.jar Main Main.class -RUN mkdir -p /etc/splunk/ +RUN mkdir -p /etc/splunk/zerconfig -COPY zeroconfig.conf /etc/splunk/zeroconfig_java.conf +COPY zeroconfig.conf /etc/splunk/zeroconfig/java.conf CMD java -jar Main.jar @@ -19,4 +19,3 @@ ENV ANOTHER_VAR foo COPY libsplunk.so /usr/lib/splunk-instrumentation/libsplunk.so RUN echo /usr/lib/splunk-instrumentation/libsplunk.so >> /etc/ld.so.preload - diff --git a/instrumentation/tests/nodejs/Dockerfile b/instrumentation/tests/nodejs/Dockerfile index 6554805c82..34606e5565 100644 --- a/instrumentation/tests/nodejs/Dockerfile +++ b/instrumentation/tests/nodejs/Dockerfile @@ -3,12 +3,12 @@ FROM $BASE COPY index.js . -RUN mkdir -p /etc/splunk/ +RUN mkdir -p /etc/splunk/zeroconfig -COPY zeroconfig.conf /etc/splunk/zeroconfig_node.conf +COPY zeroconfig.conf /etc/splunk/zeroconfig/node.conf CMD node index.js COPY libsplunk.so /usr/lib/splunk-instrumentation/libsplunk.so -RUN echo /usr/lib/splunk-instrumentation/libsplunk.so >> /etc/ld.so.preload \ No newline at end of file +RUN echo /usr/lib/splunk-instrumentation/libsplunk.so >> /etc/ld.so.preload diff --git a/internal/buildscripts/packaging/tests/instrumentation/instrumentation_test.py b/internal/buildscripts/packaging/tests/instrumentation/instrumentation_test.py index ff7811610b..ba98b6bbcb 100644 --- a/internal/buildscripts/packaging/tests/instrumentation/instrumentation_test.py +++ b/internal/buildscripts/packaging/tests/instrumentation/instrumentation_test.py @@ -48,13 +48,13 @@ SYSTEMD_CONF_DIR = "/usr/lib/systemd/system.conf.d" JAVA_AGENT_PATH = "/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar" -JAVA_CONFIG_PATH = "/etc/splunk/zeroconfig_java.conf" +JAVA_CONFIG_PATH = "/etc/splunk/zeroconfig/java.conf" CUSTOM_JAVA_CONFIG_PATH = TESTS_DIR / "instrumentation" / "libsplunk-java-test.conf" SAMPLE_JAVA_SYSTEMD_CONF_PATH = "/usr/lib/splunk-instrumentation/examples/systemd/00-splunk-otel-javaagent.conf" CUSTOM_JAVA_SYSTEMD_CONF_PATH = TESTS_DIR / "instrumentation" / "systemd-java-test.conf" NODE_AGENT_PATH = "/usr/lib/splunk-instrumentation/splunk-otel-js.tgz" -NODE_CONFIG_PATH = "/etc/splunk/zeroconfig_node.conf" +NODE_CONFIG_PATH = "/etc/splunk/zeroconfig/node.conf" CUSTOM_NODE_CONFIG_PATH = TESTS_DIR / "instrumentation" / "libsplunk-node-test.conf" SAMPLE_NODE_SYSTEMD_CONF_PATH = "/usr/lib/splunk-instrumentation/examples/systemd/00-splunk-otel-js.conf" CUSTOM_NODE_SYSTEMD_CONF_PATH = TESTS_DIR / "instrumentation" / "systemd-node-test.conf"