summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controller/.gitignore10
-rw-r--r--controller/Makefile.am37
-rw-r--r--[-rwxr-xr-x]controller/bin/dtf-get-machine.in (renamed from controller/get_machine)2
-rw-r--r--[-rwxr-xr-x]controller/bin/dtf-run-remote.in (renamed from controller/run_remote)19
-rwxr-xr-xcontroller/build11
-rw-r--r--controller/configure.ac35
-rw-r--r--controller/etc/dtf.sh.in3
-rwxr-xr-xcontroller/libexec/dtf-wait-for-ssh (renamed from controller/ansible_helpers/wait-for-ssh)0
-rw-r--r--controller/parse_credsfile16
-rw-r--r--controller/share/dtf-controller/ansible/dummy-wrapper.yml (renamed from controller/ansible/dummy-wrapper.yml)0
-rw-r--r--controller/share/dtf-controller/ansible/playbooks/fedora.yml (renamed from controller/ansible/fedora.yml)14
-rw-r--r--controller/share/dtf-controller/ansible/playbooks/include/additional-packages.yml (renamed from controller/ansible/include/additional-packages.yml)0
-rw-r--r--controller/share/dtf-controller/ansible/playbooks/include/beakerlib.yml (renamed from controller/ansible/include/beakerlib.yml)0
-rw-r--r--controller/share/dtf-controller/ansible/playbooks/include/download-results.yml (renamed from controller/ansible/include/download-results.yml)0
-rw-r--r--controller/share/dtf-controller/ansible/playbooks/include/prepare-testenv.yml (renamed from controller/ansible/include/prepare-testenv.yml)0
-rwxr-xr-xcontroller/share/dtf-controller/ansible/run_include (renamed from controller/ansible/run_include)0
-rw-r--r--controller/share/dtf-controller/ansible/vars/generated-vars.yml.in4
-rw-r--r--controller/share/dtf-controller/parse_credsfile31
18 files changed, 148 insertions, 34 deletions
diff --git a/controller/.gitignore b/controller/.gitignore
new file mode 100644
index 0000000..0ce42e7
--- /dev/null
+++ b/controller/.gitignore
@@ -0,0 +1,10 @@
+.*
+build-aux
+config.*
+dtf.sh
+dtf-get-machine
+dtf-run-remote
+generated-vars.yml
+Makefile
+Makefile.in
+stamp-h1
diff --git a/controller/Makefile.am b/controller/Makefile.am
new file mode 100644
index 0000000..4df5e25
--- /dev/null
+++ b/controller/Makefile.am
@@ -0,0 +1,37 @@
+bin_SCRIPTS = bin/dtf-run-remote bin/dtf-get-machine
+
+sysconf_DATA = etc/dtf.sh
+
+pkgdata_DATA = ./share/dtf-controller/parse_credsfile
+
+libexec_SCRIPTS = libexec/dtf-wait-for-ssh
+
+ansiblevarsdir = $(pkgdatadir)/ansible/vars
+ansibleplaybooksdir = $(pkgdatadir)/ansible/playbooks
+
+ansiblevars_DATA = share/dtf-controller/ansible/vars/generated-vars.yml
+
+dtfplaybookdir = $(pkgdatadir)/ansible/playbooks
+ansibleplaybooks_DATA = share/dtf-controller/ansible/playbooks/fedora.yml
+
+share/dtf-controller/ansible/vars/generated-vars.yml: \
+ share/dtf-controller/ansible/vars/generated-vars.yml.in .dep
+ $(INSTANTIATE)
+
+.dep: $(c_s)
+ touch .dep
+
+bin/dtf-run-remote: bin/dtf-run-remote.in .dep
+ $(INSTANTIATE_SCRIPT)
+
+bin/dtf-get-machine: bin/dtf-get-machine.in .dep
+ $(INSTANTIATE_SCRIPT)
+
+etc/dtf.sh: etc/dtf.sh.in .dep
+ $(INSTANTIATE)
+
+GENERATED_FILES = $(bin_SCRIPTS) \
+ $(sysconf_DATA) \
+ share/dtf-controller/ansible/vars/generated-vars.yml
+
+CLEANFILES = $(GENERATED_FILES)
diff --git a/controller/get_machine b/controller/bin/dtf-get-machine.in
index 7121114..0d7c567 100755..100644
--- a/controller/get_machine
+++ b/controller/bin/dtf-get-machine.in
@@ -66,7 +66,7 @@ while true; do
esac
done
-. ./parse_credsfile "$opt_openstack_instance" || exit 1
+. "@pkgdatadir@/parse_credsfile" "$opt_openstack_instance" || exit 1
. ./config/os/"$opt_openstack_instance.sh" || exit 1
image_version=$opt_distro$opt_distro_version
diff --git a/controller/run_remote b/controller/bin/dtf-run-remote.in
index 0b405aa..276ad40 100755..100644
--- a/controller/run_remote
+++ b/controller/bin/dtf-run-remote.in
@@ -1,15 +1,10 @@
#!/bin/bash
-srcdir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) || exit 1
-
-. "$srcdir/config/config.sh" || {
- echo >&2 "sorry, but $srcdir/config/config.sh not found"
- exit 1
-}
+. "@sysconfdir@/dtf.sh" || exit 1
longopts="verbose,help,force,testid:,listonly"
-run_playbook=${run_playbook-$srcdir/ansible/fedora.yml}
+run_playbook=${run_playbook-@ansibleplaybooksdir@/fedora.yml}
opt_workdir=
opt_distro=fedora
@@ -69,12 +64,11 @@ done
test -z "$opt_taskdir" && die "you must specify --taskdir"
-credsfile="$(readlink -f "$srcdir/private/os/$opt_openstack_instance.yml")"
-test -z "$credsfile" && die "--ansible-creds option must be specified"
-test ! -f "$credsfile" && die "file $credsfile not found"
+credsfile="$HOME/.dtf/private/os/$opt_openstack_instance.yml"
+test ! -f "$credsfile" && die "file '$credsfile' not found"
-config_os_file="$(readlink -f "$srcdir/config/os/$opt_openstack_instance.sh")"
-test ! -r "$config_os_file" && die "file $config_os_file not found"
+config_os_file="$HOME/.dtf/os/$opt_openstack_instance.sh"
+test ! -r "$config_os_file" && die "file '$config_os_file' not found"
. "$config_os_file"
config_os_id="$opt_distro$opt_distro_ver"
@@ -103,6 +97,7 @@ testsuite_name="$(tarball)" || die "can not create dist tarball"
export ANSIBLE_HOST_KEY_CHECKING=False
ansible-playbook "$run_playbook" \
+ --extra-vars "opt_generated_vars=@ansiblevarsdir@/generated-vars.yml" \
--extra-vars "opt_distro=$opt_distro" \
--extra-vars "opt_distro_ver=$opt_distro_ver" \
--extra-vars "opt_workdir=$opt_workdir" \
diff --git a/controller/build b/controller/build
new file mode 100755
index 0000000..a57f1b9
--- /dev/null
+++ b/controller/build
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+if test ! -f Makefile; then
+ if test ! -f configure; then
+ autoreconf -vfi
+ fi || exit 1
+
+ ./configure --with-git
+fi || exit 1
+
+make
diff --git a/controller/configure.ac b/controller/configure.ac
new file mode 100644
index 0000000..819680a
--- /dev/null
+++ b/controller/configure.ac
@@ -0,0 +1,35 @@
+AC_INIT([dtf-controller], [0.9], [pavel@raiskup.cz])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE([foreign -Wall -Werror])
+AM_SILENT_RULES([yes])
+AC_PROG_CC
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile])
+
+AC_PATH_PROG([SED], [sed])
+m4_define([sed_subst_var_pattern], [ -e 's|@$1[[@]]|\$($1)|g' \\])
+SED_RULES="\\
+sed_subst_var_pattern(ansibleplaybooksdir)
+sed_subst_var_pattern(ansiblevarsdir)
+sed_subst_var_pattern(bindir)
+sed_subst_var_pattern(docdir)
+sed_subst_var_pattern(libdir)
+sed_subst_var_pattern(libexecdir)
+sed_subst_var_pattern(pkgdatadir)
+sed_subst_var_pattern(pkgname)
+sed_subst_var_pattern(prefix)
+sed_subst_var_pattern(sysconfdir)
+sed_subst_var_pattern(top_srcdir)
+ -e 's|@__FILE__[[@]]|\$@|g'"
+SED_CALL="\$(SED) \$(SED_RULES)"
+m4_pattern_allow(AM_V_GEN)
+INSTANTIATE="\$(AM_V_GEN){ test ! -f \$@ || rm -f \$@ ; } && \$(SED_CALL) \$< > \$@ && chmod -w \$@"
+INSTANTIATE_SCRIPT="\$(INSTANTIATE) && chmod +x \$@"
+c_s='$(top_srcdir)/config.status'
+AC_SUBST([SED_RULES])
+AC_SUBST([SED_CALL])
+AC_SUBST([INSTANTIATE])
+AC_SUBST([INSTANTIATE_SCRIPT])
+AC_SUBST([c_s])
+
+AC_OUTPUT
diff --git a/controller/etc/dtf.sh.in b/controller/etc/dtf.sh.in
new file mode 100644
index 0000000..b6c7b15
--- /dev/null
+++ b/controller/etc/dtf.sh.in
@@ -0,0 +1,3 @@
+# test
+
+. @sysconfdir@/dtf.conf.d/*.sh 2>/dev/null || :
diff --git a/controller/ansible_helpers/wait-for-ssh b/controller/libexec/dtf-wait-for-ssh
index eb3880a..eb3880a 100755
--- a/controller/ansible_helpers/wait-for-ssh
+++ b/controller/libexec/dtf-wait-for-ssh
diff --git a/controller/parse_credsfile b/controller/parse_credsfile
deleted file mode 100644
index 4cf8e58..0000000
--- a/controller/parse_credsfile
+++ /dev/null
@@ -1,16 +0,0 @@
-___os_confdir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)
-
-credsfile="$___os_confdir/private/os/$1.yml"
-
-while read line; do
- if [[ "$line" =~ ^([a-zA-Z0-9_]*):\ ?(.*)$ ]]; then
- key="${BASH_REMATCH[1]}"
- if test "$key" = os_nova_password; then
- key=os_password
- fi
- eval set ${BASH_REMATCH[2]}
- eval export "${key^^}"="\"$@\""
- fi
-done < "$credsfile"
-
-# vi: syntax=sh
diff --git a/controller/ansible/dummy-wrapper.yml b/controller/share/dtf-controller/ansible/dummy-wrapper.yml
index 524b0ea..524b0ea 100644
--- a/controller/ansible/dummy-wrapper.yml
+++ b/controller/share/dtf-controller/ansible/dummy-wrapper.yml
diff --git a/controller/ansible/fedora.yml b/controller/share/dtf-controller/ansible/playbooks/fedora.yml
index cc64eac..215e048 100644
--- a/controller/ansible/fedora.yml
+++ b/controller/share/dtf-controller/ansible/playbooks/fedora.yml
@@ -4,6 +4,7 @@
hosts: localhost
vars_files:
- "{{ opt_credsfile }}"
+ - "{{ opt_generated_vars }}"
tasks:
- name: generate builder name
@@ -31,7 +32,7 @@
- name: wait for the host to be hot
local_action: wait_for host={{ machine_ip.stdout }} port=22 delay=5 timeout=600
- - local_action: shell ../ansible_helpers/wait-for-ssh "root@{{ machine_ip.stdout }}"
+ - local_action: shell {{ config_libexecdir }}/dtf-wait-for-ssh "root@{{ machine_ip.stdout }}"
- name: add it to the special group
local_action: add_host hostname={{ machine_ip.stdout }}
@@ -40,15 +41,18 @@
- hosts: temp_group
user: root
gather_facts: False
+ vars_files:
+ - "{{ opt_credsfile }}"
+ - "{{ opt_generated_vars }}"
tasks:
- copy: src={{ opt_workdir }}/{{ opt_testsuite_name }}.tar.gz
dest=/root/{{ opt_testsuite_name }}.tar.gz
- - include: include/beakerlib.yml
+ - include: "{{ config_ansibleplaybooksdir }}/include/beakerlib.yml"
- - include: include/prepare-testenv.yml
+ - include: "{{ config_ansibleplaybooksdir }}/include/prepare-testenv.yml"
- - include: include/additional-packages.yml
+ - include: "{{ config_ansibleplaybooksdir }}/include/additional-packages.yml"
when: dtf_rpm_files_list is defined
- shell: cd /root && tar -xf {{ opt_testsuite_name }}.tar.gz
@@ -57,7 +61,7 @@
register: test_result
ignore_errors: yes
- - include: include/download-results.yml
+ - include: "{{ config_ansibleplaybooksdir }}/include/download-results.yml"
- name: stop the vm
shell: echo "not implemented yet"
diff --git a/controller/ansible/include/additional-packages.yml b/controller/share/dtf-controller/ansible/playbooks/include/additional-packages.yml
index f821255..f821255 100644
--- a/controller/ansible/include/additional-packages.yml
+++ b/controller/share/dtf-controller/ansible/playbooks/include/additional-packages.yml
diff --git a/controller/ansible/include/beakerlib.yml b/controller/share/dtf-controller/ansible/playbooks/include/beakerlib.yml
index 0461f25..0461f25 100644
--- a/controller/ansible/include/beakerlib.yml
+++ b/controller/share/dtf-controller/ansible/playbooks/include/beakerlib.yml
diff --git a/controller/ansible/include/download-results.yml b/controller/share/dtf-controller/ansible/playbooks/include/download-results.yml
index 4404e08..4404e08 100644
--- a/controller/ansible/include/download-results.yml
+++ b/controller/share/dtf-controller/ansible/playbooks/include/download-results.yml
diff --git a/controller/ansible/include/prepare-testenv.yml b/controller/share/dtf-controller/ansible/playbooks/include/prepare-testenv.yml
index a63e51a..a63e51a 100644
--- a/controller/ansible/include/prepare-testenv.yml
+++ b/controller/share/dtf-controller/ansible/playbooks/include/prepare-testenv.yml
diff --git a/controller/ansible/run_include b/controller/share/dtf-controller/ansible/run_include
index 4e84c7d..4e84c7d 100755
--- a/controller/ansible/run_include
+++ b/controller/share/dtf-controller/ansible/run_include
diff --git a/controller/share/dtf-controller/ansible/vars/generated-vars.yml.in b/controller/share/dtf-controller/ansible/vars/generated-vars.yml.in
new file mode 100644
index 0000000..e33e974
--- /dev/null
+++ b/controller/share/dtf-controller/ansible/vars/generated-vars.yml.in
@@ -0,0 +1,4 @@
+---
+config_bindir: @bindir@
+config_libexecdir: @libexecdir@
+config_ansibleplaybooksdir: @ansibleplaybooksdir@
diff --git a/controller/share/dtf-controller/parse_credsfile b/controller/share/dtf-controller/parse_credsfile
new file mode 100644
index 0000000..2379e18
--- /dev/null
+++ b/controller/share/dtf-controller/parse_credsfile
@@ -0,0 +1,31 @@
+___perform_parsing()
+{
+ unset OS_USERNAME
+ local credsfile="$HOME/.dtf/private/os/$1.yml"
+
+ if test -z "$1"; then
+ echo >&2 "argument expected: OpenStack ID"
+ return 1
+ fi
+
+ if test ! -f "$credsfile"; then
+ echo >&2 "file '$credsfile' not found"
+ return 1
+ fi
+
+ while read line; do
+ if [[ "$line" =~ ^([a-zA-Z0-9_]*):\ ?(.*)$ ]]; then
+ key="${BASH_REMATCH[1]}"
+ if test "$key" = os_nova_password; then
+ key=os_password
+ fi
+ eval set ${BASH_REMATCH[2]}
+ eval export "${key^^}"="\"$@\""
+ fi
+ done < "$credsfile"
+}
+
+unset OS_AUTH_URL OS_PASSWORD OS_TENANT_ID OS_TENANT_NAME OS_USERNAME
+___perform_parsing "$@"
+
+# # vi: syntax=sh