From 959158ab0457afc4454e637db89f9d16f8aad775 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Tue, 14 Oct 2014 09:57:57 +0200 Subject: controller: configuration cleanup Better define configuration and provide examples. * controller: Unpack results to correct directory, load the configuration from new place, call run_remote with proper arguments, generate 'results.html' with result_stats script. * ansible/run_include: Adjust to better simulate run_remote. * ansible/fedora.yml: Adjust for fixed configuration. * run_remote: Likewise. Also small issues with option parsing fixed. * config.sh.template: Moved as config/config.sh.template. * config/config.sh.template: Copyyed from /config.sh.template, better documented options. * run: Fix typo - use 'while read i' instead of 'for i in'. * config/os/EXAMPLE.sh: New file - exmaple configuration. * private/os/EXAMPLE.yml: Likewise. * config/hosts.template: Likewise. * dist.include: New file with file patterns that should be distributed to test machine. * dist: Distribute only those files which are necessary. * config/.gitignore: New gitignore file. --- controller | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'controller') diff --git a/controller b/controller index 938bab5..9770497 100755 --- a/controller +++ b/controller @@ -1,6 +1,9 @@ #!/bin/bash -. config.sh || { echo >&2 "sorry, but config.sh not found" ; exit 1 ; } +. config/config.sh || { + echo >&2 "sorry, but config/config.sh not found" + exit 1 +} # (still) local variables distro=fedora @@ -18,31 +21,34 @@ prereq_resultdir() unpack_results() { local where="$1" + local tmp_results_dir="$2" + local workdir=$(mktemp -d "/tmp/.dtf.XXXXXX") || die "can not create workdir" - pushd "$workdir" - tar -xf /var/tmp/dtf.tar.gz + { pushd "$workdir" >/dev/null \ + && tar -xf "$tmp_results_dir/dtf.tar.gz" \ + && pushd dtf >/dev/null + } || die "can not unpack results" - pushd dtf for i in *.log; do - pwd local task_id="${i%%.log}" local mydir="" + + # First item in tarball is the "main" directory while read dirname; do test -z "$mydir" && mydir="$dirname" done <<<"$(tar xvf "$task_id.tar.gz")" + # Give the unpacked results better name rm "$task_id.tar.gz" - mv "$mydir" "$task_id.dir" done + { popd && popd ; } > /dev/null - popd - popd - - mkdir -p "$(dirname "$where")" || die "can not create resultdir" - mv "$workdir/dtf" "$where" + { mkdir -p "$(dirname "$where")" \ + && mv "$workdir/dtf" "$where" ; + } || die "can not create resultdir" } prereq_resultdir @@ -52,9 +58,10 @@ workdir=$(mktemp -d "/var/tmp/dtf_postgresql_setup-XXXXXX") ./run_remote \ --distro="$distro" \ --distro-version="$distro_ver" \ - --workdir="$workdir" + --workdir="$workdir" \ + --openstack-instance="$DTF_OPENSTACK_ID" resultdir="$DTF_DATABASE/$distro/$distro_ver/$arch" -unpack_results "$resultdir/result_$starttime" +unpack_results "$resultdir/result_$starttime" "$workdir" -./runner/result_stats "$resultdir" +./runner/result_stats "$resultdir" > "$resultdir/results.html" -- cgit