Adding support for the new validation framework

* Uploads now the contents of tripleo-validations/playbooks directory
  instead of tripleo-validations/validations ones.
* Adds a new parameter to run-validation script to be able to properly
  export Ansible variables:
  - ANSIBLE_CALLBACK_PLUGINS
  - ANSIBLE_LOOKUP_PLUGINS
  - ANSIBLE_ROLES_PATH
  - ANSIBLE_LIBRARY

Change-Id: I43cf796b0147a9b2054d3ff7941274a7497a14d9
Implements: blueprint validation-framework
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2019-04-02 13:46:56 +02:00
parent 0bb3d90540
commit cbc0bfdb44
4 changed files with 24 additions and 3 deletions

View File

@ -27,6 +27,7 @@ done
VALIDATION_FILE=$1
IDENTITY_FILE=$2
PLAN_NAME=$3
VALIDATIONS_BASEDIR=$4
if [[ -z "$VALIDATION_FILE" ]]; then
echo "Missing required validation file"
@ -52,6 +53,15 @@ else
exit 1
fi
if [[ -z "$VALIDATIONS_BASEDIR" ]]; then
echo "Missing required tripleo-validations basedir"
exit 1
fi
if [[ ! -d "$VALIDATIONS_BASEDIR" ]]; then
echo "Can not find tripleo-validations basedir at $VALIDATION_BASEDIR"
exit 1
fi
# Make sure ssh is not asking interactively for hosts it can't check the key
# authenticity
export ANSIBLE_HOST_KEY_CHECKING=False
@ -69,6 +79,11 @@ export ANSIBLE_INVENTORY=$(which tripleo-ansible-inventory)
# Use the custom validation-specific formatter
export ANSIBLE_STDOUT_CALLBACK=validation_output
export ANSIBLE_CALLBACK_PLUGINS="${VALIDATIONS_BASEDIR}/callback_plugins"
export ANSIBLE_ROLES_PATH="${VALIDATIONS_BASEDIR}/roles"
export ANSIBLE_LOOKUP_PLUGINS="${VALIDATIONS_BASEDIR}/lookup_plugins"
export ANSIBLE_LIBRARY="${VALIDATIONS_BASEDIR}/library"
# Environment variable is the easiest way to pass variables to an Ansible
# dynamic inventory script
export TRIPLEO_PLAN_NAME=${PLAN_NAME}

View File

@ -56,9 +56,13 @@ DEFAULT_PLAN_ENV_KEY = 'parameter_defaults'
#: The path to the tripleo heat templates installed on the undercloud
DEFAULT_TEMPLATES_PATH = '/usr/share/openstack-tripleo-heat-templates/'
#: The path to the base directory of tripleo-validations
DEFAULT_VALIDATIONS_BASEDIR = \
'/usr/share/openstack-tripleo-validations'
# The path to the tripleo validations installed on the undercloud
DEFAULT_VALIDATIONS_PATH = \
'/usr/share/openstack-tripleo-validations/validations/'
DEFAULT_VALIDATIONS_BASEDIR + '/playbooks/'
# The path to the local CA certificate installed on the undercloud
LOCAL_CACERT_PATH = '/etc/pki/ca-trust/source/anchors/cm-local-ca.pem'

View File

@ -261,7 +261,8 @@ class RunValidationTest(base.TestCase):
'--inputs', 'inputs_file',
'validation_path',
'identity_file',
'plan'
'plan',
'/usr/share/openstack-tripleo-validations'
)
mock_download_validation.assert_called_once_with(
mock_get_object_client(), 'plan', 'validation')

View File

@ -152,7 +152,8 @@ def run_validation(swift, validation, identity_file,
'--inputs', inputs_file,
download_validation(swift, plan, validation),
identity_file,
plan
plan,
constants.DEFAULT_VALIDATIONS_BASEDIR
)