From 7f91978a46de4b06d211295ba5da7e370da4a9cb Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 30 Jul 2015 16:17:57 +0100 Subject: [PATCH] Move ansible logging to gate-check script only Enacting the log link creation and the ansible.cfg change has resulted in polluted patch reviews by developers making use of AIO's for dev/test purposes. This patch moves the Ansible logging changes to the gate-check-script only as that's the only time that it's actually required. Change-Id: I4a1accad94ae153bf363b53fda0905e814c15173 Closes-Bug: #1479824 --- scripts/bootstrap-aio.sh | 22 ---------------------- scripts/gate-check-commit.sh | 21 +++++++++++++-------- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/scripts/bootstrap-aio.sh b/scripts/bootstrap-aio.sh index a19edbf2c0..f2e04baceb 100755 --- a/scripts/bootstrap-aio.sh +++ b/scripts/bootstrap-aio.sh @@ -31,7 +31,6 @@ export NOVA_VIRT_TYPE=${NOVA_VIRT_TYPE:-"qemu"} export TEMPEST_FLAT_CIDR=${TEMPEST_FLAT_CIDR:-"172.29.248.0/22"} export FLUSH_IPTABLES=${FLUSH_IPTABLES:-"yes"} export RABBITMQ_PACKAGE_URL=${RABBITMQ_PACKAGE_URL:-""} -export SYMLINK_DIR=${SYMLINK_DIR:-"$(pwd)/logs"} export MONGO_HOST=172.29.236.100 # Default disabled fatal deprecation warnings @@ -55,27 +54,6 @@ info_block "Checking for required libraries." 2> /dev/null || source $(dirname $ ## Main ---------------------------------------------------------------------- -# Make the /openstack/log directory for openstack-infra gate check log publishing -mkdir -p /openstack/log - -# Implement the log directory link for openstack-infra log publishing -ln -sf /openstack/log $SYMLINK_DIR - -# Create ansible logging directory and add in a log file entry into ansible.cfg -if [ -f "playbooks/ansible.cfg" ];then - mkdir -p /openstack/log/ansible-logging - if [ ! "$(grep -e '^log_path\ =\ /openstack/log/ansible-logging/ansible.log' playbooks/ansible.cfg)" ];then - sed -i '/\[defaults\]/a log_path = /openstack/log/ansible-logging/ansible.log' playbooks/ansible.cfg - fi -fi - -# Check that the link creation was successful -[[ -d $SYMLINK_DIR ]] || exit_fail -if ! [ -d $SYMLINK_DIR ] ; then - echo "Could not create a link from /openstack/log to ${SYMLINK_DIR}" - exit_fail -fi - # Log some data about the instance and the rest of the system log_instance_info diff --git a/scripts/gate-check-commit.sh b/scripts/gate-check-commit.sh index f5182f235b..712d781fe4 100755 --- a/scripts/gate-check-commit.sh +++ b/scripts/gate-check-commit.sh @@ -14,10 +14,9 @@ # limitations under the License. ## Shell Opts ---------------------------------------------------------------- -set -e -u +x +set -e -u -x ## Variables ----------------------------------------------------------------- -export ANSIBLE_DISABLE_COLOR=${ANSIBLE_DISABLE_COLOR:-"yes"} export BOOTSTRAP_ANSIBLE=${BOOTSTRAP_ANSIBLE:-"yes"} export BOOTSTRAP_AIO=${BOOTSTRAP_AIO:-"yes"} export RUN_PLAYBOOKS=${RUN_PLAYBOOKS:-"yes"} @@ -43,12 +42,18 @@ info_block "Checking for required libraries." 2> /dev/null || source $(dirname $ ## Main ---------------------------------------------------------------------- -# Remove color options -if [ "${ANSIBLE_DISABLE_COLOR}" == "yes" ]; then - pushd $(dirname ${0})/../playbooks - sed -i 's/nocolor.*/nocolor = 1/' ansible.cfg - popd -fi +# Disable Ansible color output +sed -i 's/nocolor.*/nocolor = 1/' $(dirname ${0})/../playbooks/ansible.cfg + +# Make the /openstack/log directory for openstack-infra gate check log publishing +mkdir -p /openstack/log + +# Implement the log directory link for openstack-infra log publishing +ln -sf /openstack/log $(dirname ${0})/../logs + +# Create ansible logging directory and add in a log file entry into ansible.cfg +mkdir -p /openstack/log/ansible-logging +sed -i '/\[defaults\]/a log_path = /openstack/log/ansible-logging/ansible.log' $(dirname ${0})/../playbooks/ansible.cfg # Bootstrap an AIO setup if required if [ "${BOOTSTRAP_AIO}" == "yes" ]; then