##############################################################################
PARSER_CI_DEBUG=${CI_DEBUG:-false}
+PRASER_WORK_DIR=$(cd $(dirname $0) && pwd)
+
[[ "${PARSER_CI_DEBUG}" == "true" ]] && {
set -x
debug="--debug"
set +x
debug=""
}
+LOCAL_IMAGE_FILE=${1:-""}
+
+# Install parser
+echo "Prepare parser ..."
+echo "==================="
+echo ""
+${PRASER_WORK_DIR}/parser_install.sh ${PRASER_WORK_DIR}/../..
+echo ""
+echo "Prepare result: $?"
+echo "==================="
-if [ -n $1 ]; then
- PARSER_IMAGE_URL_FILE=$1
+if [ -e "${LOCAL_IMAGE_FILE}" ]; then
+ echo "Input local image file: ${LOCAL_IMAGE_FILE}"
+ PARSER_IMAGE_URL_FILE=${LOCAL_IMAGE_FILE}
else
+ echo "No local image file or the file(${LOCAL_IMAGE_FILE}) doesn't exsit!"
+
PARSER_IMAGE_URL_FILE=cirros-0.3.5-x86_64-disk.img
+ PARSER_IMAGE_VERSION=$(echo ${PARSER_IMAGE_URL_FILE} | awk -F- '{print $2}')
+ # PARSER_IMAGE_URL=https://launchpad.net/cirros/trunk/0.3.0/+download/${PARSER_IMAGE_URL_FILE}
+ PARSER_IMAGE_URL=http://download.cirros-cloud.net/${PARSER_IMAGE_VERSION}/${PARSER_IMAGE_URL_FILE}
+ echo "so will download image(${PARSER_IMAGE_URL_FILE}) from ${PARSER_IMAGE_URL}."
fi
-# PARSER_IMAGE_URL=https://launchpad.net/cirros/trunk/0.3.0/+download/${PARSER_IMAGE_URL_FILE}
-PARSER_IMAGE_URL=http://download.cirros-cloud.net/0.3.2/${PARSER_IMAGE_URL_FILE}
+
# PARSER_IMAGE_NAME=rhel-6.5-test-image
+# fiexd image name according to the translator default vlaue of images
PARSER_IMAGE_NAME=cirros-0.3.2-x86_64-uec
PARSER_IMAGE_FILE="${PARSER_IMAGE_NAME}.img"
PARSER_IMAGE_FORMAT=qcow2
##############################################################################
set +e
+BASE_WORK_DIR=$(cd $(dirname $0) && pwd)
-parser_repos_dir=$1
+OPNFV_REPO_DIR=${1:-""}
# start syslog for loghander
service rsyslog restart && echo "syslog start successfully"
# install requirements for parser
-pip install -r ${parser_repos_dir}/parser/tosca2heat/tosca-parser/requirements.txt
-pip install -r ${parser_repos_dir}/parser/tosca2heat/heat-translator/requirements.txt
+if [ -n "${OPNFV_REPO_DIR}" ]; then
+ echo " OPNFV repository directory is ${OPNFV_REPO_DIR}"
+ pip install -r ${OPNFV_REPO_DIR}/parser/tosca2heat/tosca-parser/requirements.txt
+ pip install -r ${OPNFV_REPO_DIR}/parser/tosca2heat/heat-translator/requirements.txt
+else
+ echo "No input for OPNFV repository directory, will use local directory"
+ pip install -r ${BASE_WORK_DIR}/../tosca2heat/tosca-parser/requirements.txt
+ pip install -r ${BASE_WORK_DIR}/../tosca2heat/heat-translator/requirements.txt
+fi
# uninstall other tosca-parser and heat-translator for parser
pip uninstall -y tosca-parser
pip uninstall -y heat-translator
# install parser
-cd ${parser_repos_dir}/parser/tosca2heat/tosca-parser && python setup.py install
-cd ${parser_repos_dir}/parser/tosca2heat/heat-translator && python setup.py install
+if [ -n "${OPNFV_REPO_DIR}" ]; then
+ cd ${OPNFV_REPO_DIR}/parser/tosca2heat/tosca-parser && python setup.py install
+ cd ${OPNFV_REPO_DIR}/parser/tosca2heat/heat-translator && python setup.py install
+else
+ cd ${BASE_WORK_DIR}/../tosca2heat/tosca-parser && python setup.py install
+ cd ${BASE_WORK_DIR}/../tosca2heat/heat-translator && python setup.py install
+fi
\ No newline at end of file