From: Jamo Luhrsen Date: Wed, 14 Nov 2018 21:47:39 +0000 (-0800) Subject: Add ability to tweak log levels in apex job X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=releng%2Fbuilder.git;a=commitdiff_plain;h=481c3d432a96fdc26f974db25f6634759dd97b32 Add ability to tweak log levels in apex job Change-Id: I19bb281d183c3aaa63fd9b6093d88b4ad1d706f1 Signed-off-by: Jamo Luhrsen --- diff --git a/jjb/integration/common-functions.sh b/jjb/integration/common-functions.sh index 2c466d220..6cbf10069 100644 --- a/jjb/integration/common-functions.sh +++ b/jjb/integration/common-functions.sh @@ -90,8 +90,9 @@ function configure_karaf_log() { fi # Add custom logging levels - # CONTROLLERDEBUGMAP is expected to be a key:value map of space separated values like "module:level module2:level2" - # where module is abbreviated and does not include "org.opendaylight." + # CONTROLLERDEBUGMAP is expected to be a key:value map of space separated + # values like "module:level module2:level2" where module is abbreviated and + # does not include "org.opendaylight." unset IFS echo "controllerdebugmap: ${controllerdebugmap}" if [ -n "${controllerdebugmap}" ]; then @@ -117,6 +118,45 @@ function configure_karaf_log() { cat ${LOGCONF} } # function configure_karaf_log() +function configure_karaf_log_for_apex() { + # TODO: add the extra steps to this function to do any extra work + # in this apex environment like we do in our standard environment. + # EX: log size, rollover, etc. + + # Modify ODL Log Levels, if needed, for new distribution. This will modify + # the control nodes hiera data which will be used during the puppet deploy + # CONTROLLERDEBUGMAP is expected to be a key:value map of space separated + # values like "module:level module2:level2" where module is abbreviated and + # does not include "org.opendaylight." + + local -r controller_ip=$1 + + unset IFS + # shellcheck disable=SC2153 + echo "CONTROLLERDEBUGMAP: ${CONTROLLERDEBUGMAP}" + if [ -n "${CONTROLLERDEBUGMAP}" ]; then + logging_config='\"opendaylight::log_levels\": {' + for kv in ${CONTROLLERDEBUGMAP}; do + module="${kv%%:*}" + level="${kv#*:}" + echo "module: $module, level: $level" + # shellcheck disable=SC2157 + if [ -n "${module}" ] && [ -n "${level}" ]; then + orgmodule="org.opendaylight.${module}" + logging_config="${logging_config} \\\"${orgmodule}\\\": \\\"${level}\\\"," + fi + done + # replace the trailing comma with a closing brace followed by trailing comma + logging_config=${logging_config%,}" }," + echo $logging_config + + # fine a sane line number to inject the custom logging json + lineno=$(ssh $OPENSTACK_CONTROL_NODE_1_IP "sudo grep -Fn 'opendaylight::log_mechanism' /etc/puppet/hieradata/service_configs.json" | awk -F: '{print $1}') + ssh $controller_ip "sudo sed -i \"${lineno}i ${logging_config}\" /etc/puppet/hieradata/service_configs.json" + ssh $controller_ip "sudo cat /etc/puppet/hieradata/service_configs.json" + fi +} # function configure_karaf_log_for_apex() + function get_os_deploy() { local -r num_systems=${1:-$NUM_OPENSTACK_SYSTEM} case ${num_systems} in diff --git a/jjb/integration/integration-apex-run-tests.sh b/jjb/integration/integration-apex-run-tests.sh index 2b4fc1ba3..4c7692b9d 100644 --- a/jjb/integration/integration-apex-run-tests.sh +++ b/jjb/integration/integration-apex-run-tests.sh @@ -12,6 +12,8 @@ print_job_parameters get_os_deploy +configure_karaf_log_for_apex $OPENSTACK_CONTROL_NODE_1_IP + # Swap out the ODL distribution DISTRO_UNDER_TEST=/tmp/odl.tar.gz wget --progress=dot:mega ${ACTUAL_BUNDLE_URL}