diff --git a/scripts/run-validation b/scripts/run-validation index 5f1134ca5..d65e9b78f 100755 --- a/scripts/run-validation +++ b/scripts/run-validation @@ -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} diff --git a/tripleo_common/constants.py b/tripleo_common/constants.py index c86658ed8..7d19ebc79 100644 --- a/tripleo_common/constants.py +++ b/tripleo_common/constants.py @@ -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' diff --git a/tripleo_common/tests/utils/test_validations.py b/tripleo_common/tests/utils/test_validations.py index a1c3841c9..31050b7a4 100644 --- a/tripleo_common/tests/utils/test_validations.py +++ b/tripleo_common/tests/utils/test_validations.py @@ -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') diff --git a/tripleo_common/utils/validations.py b/tripleo_common/utils/validations.py index bed5bf6c6..305ffbc7c 100644 --- a/tripleo_common/utils/validations.py +++ b/tripleo_common/utils/validations.py @@ -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 )