diff options
Diffstat (limited to 'controller/bin')
-rw-r--r-- | controller/bin/dtf-controller.in | 1 | ||||
-rw-r--r-- | controller/bin/dtf-run-remote.in | 72 |
2 files changed, 50 insertions, 23 deletions
diff --git a/controller/bin/dtf-controller.in b/controller/bin/dtf-controller.in index 0c80ef5..a231270 100644 --- a/controller/bin/dtf-controller.in +++ b/controller/bin/dtf-controller.in @@ -71,6 +71,7 @@ sub child_task '--workdir', $dir, '--distro', $run->{distro}, '--distro-version', $run->{distro_version}, + '--setup-playbook', $run->{setup_playbook}, ], "$dir/dtf-run-remote.out", "$dir/dtf-run-remote.err"; diff --git a/controller/bin/dtf-run-remote.in b/controller/bin/dtf-run-remote.in index b83b79c..14f81a4 100644 --- a/controller/bin/dtf-run-remote.in +++ b/controller/bin/dtf-run-remote.in @@ -2,9 +2,7 @@ . "@sysconfdir@/dtf.sh" || exit 1 -longopts="verbose,help,force,testid:,listonly" - -run_playbook=${run_playbook-@ansibleplaybooksdir@/fedora.yml} +run_playbook=${run_playbook-@ansibleplaybooksdir@/default.yml} opt_workdir= opt_distro=fedora @@ -12,26 +10,31 @@ opt_openstack_instance="$DTF_OPENSTACK_DEFAULT_ID" opt_distro_ver=20 opt_extra_rpms= opt_taskdir= +opt_setup_playbook= +opt_help=false -die() { echo >&2 "$@" ; exit 1 ; } +die() { echo >&2 "$*" ; exit 1 ; } +error() { echo >&2 "$*" ; } -longopts="distro:,distro-version:,workdir:,openstack-instance:,extra-rpms-file:" -longopts+=",taskdir:" +longopts="help" +longopts+=",distro:,distro-version:,workdir:,openstack-instance:,extra-rpms-file:" +longopts+=",taskdir:,setup-playbook:" ARGS=$(getopt -o "v" -l "$longopts" -n "getopt" -- "$@") \ || exit 1 eval set -- "$ARGS" while true; do case "$1" in - --taskdir) + --taskdir|--setup-playbook|--distro|--openstack-instance|--workdir) opt=$(sed -e 's/^--//' -e 's/[^[a-zA-Z0-9]/_/g'<<<"$1") eval "opt_$opt=\"${2,,}\"" shift 2 ;; - --distro) - opt_distro="$2" - shift 2 + --help) + opt=$(sed -e 's/^--//' -e 's/[^[a-zA-Z0-9]/_/g'<<<"$1") + eval "opt_$opt=true" + shift ;; --distro-version) @@ -39,17 +42,6 @@ while true; do shift 2 ;; - --openstack-instance) - opt_openstack_instance="$2" - shift 2 - ;; - - --workdir) - # where the remote results are fetched into - opt_workdir="$2" - shift 2 - ;; - --extra-rpms-file) opt_extra_rpms="$(readlink -f "$2")" shift 2 @@ -68,8 +60,41 @@ while true; do esac done -test -z "$opt_openstack_instance" && die "option --openstack-instance=ID not used" -test -z "$opt_taskdir" && die "you must specify --taskdir" +$opt_help && { +cat <<EOF +Usage: $0 OPTIONS + +Script which runs the dtf testsuite remotely. For that purpose, it starts fresh +VM (currently in OpenStack), runs the testsuite and collects results. + +Options: + --taskdir=DIR The root-directory of dtf testsuite + --distro=DISTRO Linux distribution name (e.g. fedora) + --distro-version=VER Version of DISTRO, e.g. 20 + --workdir=DIR Do not create temporary directory for results and + rather use pre-created DIR + +Global options: + --openstack-instance=OID The OS identifier matching with configuration + --help Shows this help +EOF +exit 0 +} + +optparse_error=false +test -z "$opt_openstack_instance" \ + && error "option --openstack-instance=ID not" \ + && optparse_error=true + +test -z "$opt_taskdir" \ + && error "you must specify '--taskdir DIR'" \ + && optparse_error=true + +test -z "$opt_setup_playbook" \ + && error "you must specify '--setup-playbook PLAYBOOK'" \ + && optparse_error=true + +$optparse_error && exit 1 credsfile="$HOME/.dtf/private/os/$opt_openstack_instance.yml" test ! -f "$credsfile" && die "creds file '$credsfile' not found" @@ -105,6 +130,7 @@ testsuite_name="$(tarball)" || die "can not create dist tarball" export ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -v "$run_playbook" \ --extra-vars "opt_generated_vars=@ansiblevarsdir@/generated-vars.yml" \ + --extra-vars "opt_setup_playbook='$opt_setup_playbook'" \ --extra-vars "opt_distro=$opt_distro" \ --extra-vars "opt_distro_ver=$opt_distro_ver" \ --extra-vars "opt_workdir=$opt_workdir" \ |