From 83076cf49ebd8ded4d5d5e9667fcd8e9e9be4172 Mon Sep 17 00:00:00 2001 From: Carlos Goncalves Date: Wed, 16 Nov 2016 09:55:01 +0000 Subject: Refactor installers support code Restructuring tests directory to become more modular, and adding installer helper functions. JIRA: DOCTOR-71 Change-Id: Ib3846c35485cfa4f0a0881beb69811cdc0b8f66f Signed-off-by: Carlos Goncalves --- tests/lib/installer | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/lib/installer (limited to 'tests/lib/installer') diff --git a/tests/lib/installer b/tests/lib/installer new file mode 100644 index 00000000..cdde6eff --- /dev/null +++ b/tests/lib/installer @@ -0,0 +1,34 @@ +#!/bin/bash + +INSTALLER_TYPE=${INSTALLER_TYPE:-local} +INSTALLER_IP=${INSTALLER_IP:-none} +ssh_opts_cpu="$ssh_opts" + +function is_installer_supported { + local installer="$1" + [[ -f $TOP_DIR/lib/installers/$installer ]] +} + +function is_installer { + local installer="$1" + [[ $installer == $INSTALLER_TYPE ]] +} + +function setup_installer { + if ! is_installer_supported $INSTALLER_TYPE; then + die $LINENO"INSTALLER_TYPE=$INSTALLER_TYPE is not supported." + fi + + source $TOP_DIR/lib/installers/$INSTALLER_TYPE + + if ! is_set INSTALLER_IP; then + get_installer_ip + fi + + installer_get_ssh_keys + installer_apply_patches +} + +function cleanup_installer { + cleanup_installer_$INSTALLER_TYPE +} -- cgit 1.2.3-korg