From 39dd91e65f2f55c46ac134263928113824f02921 Mon Sep 17 00:00:00 2001 From: alexz Date: Tue, 28 Jun 2016 11:29:36 +0300 Subject: [PATCH] [tools] Allow possibility to load packages_list from file * add default_packages_list.sh .sh with list of packages, to be uploaded into murano.This allow to configure ci-tests behavior Change-Id: Icff722c9fddb7637e2c68c72fa299954049766cb --- tools/default_packages_list.sh | 1 + tools/prepare_packages.sh | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 tools/default_packages_list.sh diff --git a/tools/default_packages_list.sh b/tools/default_packages_list.sh new file mode 100644 index 0000000..4a8b0fc --- /dev/null +++ b/tools/default_packages_list.sh @@ -0,0 +1 @@ +export DEFAULT_PACKAGES_LIST="Puppet SystemConfig CiCdUtils OpenLDAP Gerrit Jenkins Zuul Nodepool CiCdEnvironment" diff --git a/tools/prepare_packages.sh b/tools/prepare_packages.sh index 9eef35f..5a8a6f6 100755 --- a/tools/prepare_packages.sh +++ b/tools/prepare_packages.sh @@ -13,7 +13,7 @@ function check_dir () { fi } -default_packages="Puppet SystemConfig CiCdUtils OpenLDAP Gerrit Jenkins Zuul Nodepool CiCdEnvironment" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source_dir="murano-apps" destination_dir="." refresh_existing_packages=false @@ -30,7 +30,7 @@ where: -r flag to update existing packages, if these files are already in the destination directory. Without this flag old packages will be removed. -s set the path to directory with list of source packages. (default is: $source_dir) -d set the path to output directory, where zipped packages should be placed. (default is: $destination_dir) - -p set package name, which need to archive. (default is: $default_packages) + -p set package name, which need to archive. (default is: $DEFAULT_PACKAGES_LIST) upload packages options (they require muranoclient installation): -U upload new packages to specified tenant from directory specified with -d option @@ -87,10 +87,21 @@ while getopts ':hUSs:d:p:e:' option; do esac done +# import default packages_list, if exist +if [ -f "${DIR}/default_packages_list.sh" ]; then + if [ -z "${DEFAULT_PACKAGES_LIST}" ]; then + source "${DIR}/default_packages_list.sh" + echo "Packages list has been imported from default_packages_list.sh file" + fi +fi # set default value for packages if [ ${#packages[@]} -eq 0 ]; then - packages=$default_packages + if [ ${#DEFAULT_PACKAGES_LIST[@]} -eq 0 ]; then + echo -e "ERROR: No Packages list has been passed!Please check help\n${help_string}" + exit 1 + fi + packages="${DEFAULT_PACKAGES_LIST}" fi # make sure, that we need upload or build packages