summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgengchc2 <geng.changcai2@zte.com.cn>2018-12-28 21:12:57 -0800
committergengchc2 <geng.changcai2@zte.com.cn>2018-12-28 21:12:57 -0800
commit1edfc4d44a2d2554b291c4325a33acd5976db867 (patch)
tree014c322496249d5880a368d4db1ff79b028df87e
parentedb258dbb6bcdb3bdf414ecd26cefa2d9fe55dbc (diff)
Fix bug for Download, and install elasticsearch server
If devstack is not in the $DEST directory, The elasticsearch package will fail when downloading and installing in freezer-api. Change-Id: Iec29c2885b53756564a0bf23c7518f6cf848851a
Notes
Notes (review): Code-Review+2: gecong <ge.cong@zte.com.cn> Workflow+1: gecong <ge.cong@zte.com.cn> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Sat, 29 Dec 2018 06:52:13 +0000 Reviewed-on: https://review.openstack.org/627762 Project: openstack/freezer-api Branch: refs/heads/master
-rwxr-xr-xdevstack/lib/elasticsearch.sh23
1 files changed, 10 insertions, 13 deletions
diff --git a/devstack/lib/elasticsearch.sh b/devstack/lib/elasticsearch.sh
index c943e3e..f7196a6 100755
--- a/devstack/lib/elasticsearch.sh
+++ b/devstack/lib/elasticsearch.sh
@@ -4,9 +4,6 @@
4# 4#
5# TODO(sdague): once we have a few of these I imagine the download 5# TODO(sdague): once we have a few of these I imagine the download
6# step can probably be factored out to something nicer 6# step can probably be factored out to something nicer
7TOP_DIR=$(cd $DEST/devstack && pwd)
8FILES=$TOP_DIR/files
9source $TOP_DIR/stackrc
10 7
11# Package source and version, all pkg files are expected to have 8# Package source and version, all pkg files are expected to have
12# something like this, as well as a way to override them. 9# something like this, as well as a way to override them.
@@ -17,17 +14,17 @@ ELASTICSEARCH_BASEURL=${ELASTICSEARCH_BASEURL:-https://download.elasticsearch.or
17function wget_elasticsearch { 14function wget_elasticsearch {
18 local file=${1} 15 local file=${1}
19 16
20 if [ ! -f ${FILES}/${file} ]; then 17 if [ ! -f ${FREEZER_API_FILES}/${file} ]; then
21 wget $ELASTICSEARCH_BASEURL/${file} -O ${FILES}/${file} 18 wget $ELASTICSEARCH_BASEURL/${file} -O ${FREEZER_API_FILES}/${file}
22 fi 19 fi
23 20
24 if [ ! -f ${FILES}/${file}.sha1.txt ]; then 21 if [ ! -f ${FREEZER_API_FILES}/${file}.sha1.txt ]; then
25 wget $ELASTICSEARCH_BASEURL/${file}.sha1.txt -O ${FILES}/${file}.sha1.txt 22 wget $ELASTICSEARCH_BASEURL/${file}.sha1.txt -O ${FREEZER_API_FILES}/${file}.sha1.txt
26 fi 23 fi
27 24
28 pushd ${FILES}; sha1sum ${file} > ${file}.sha1.gen; popd 25 pushd ${FREEZER_API_FILES}; sha1sum ${file} > ${file}.sha1.gen; popd
29 26
30 if ! diff ${FILES}/${file}.sha1.gen ${FILES}/${file}.sha1.txt; then 27 if ! diff ${FREEZER_API_FILES}/${file}.sha1.gen ${FREEZER_API_FILES}/${file}.sha1.txt; then
31 echo "Invalid elasticsearch download. Could not install." 28 echo "Invalid elasticsearch download. Could not install."
32 return 1 29 return 1
33 fi 30 fi
@@ -90,16 +87,16 @@ function install_elasticsearch {
90 if is_ubuntu; then 87 if is_ubuntu; then
91 is_package_installed default-jre-headless || install_package default-jre-headless 88 is_package_installed default-jre-headless || install_package default-jre-headless
92 89
93 sudo dpkg -i ${FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.deb 90 sudo dpkg -i ${FREEZER_API_FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.deb
94 sudo update-rc.d elasticsearch defaults 95 10 91 sudo update-rc.d elasticsearch defaults 95 10
95 elif is_fedora; then 92 elif is_fedora; then
96 is_package_installed java-1.8.0-openjdk-headless || install_package java-1.8.0-openjdk-headless 93 is_package_installed java-1.8.0-openjdk-headless || install_package java-1.8.0-openjdk-headless
97 yum_install ${FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.noarch.rpm 94 yum_install ${FREEZER_API_FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.noarch.rpm
98 sudo /bin/systemctl daemon-reload 95 sudo /bin/systemctl daemon-reload
99 sudo /bin/systemctl enable elasticsearch.service 96 sudo /bin/systemctl enable elasticsearch.service
100 elif is_suse; then 97 elif is_suse; then
101 is_package_installed java-1_8_0-openjdk-headless || install_package java-1_8_0-openjdk-headless 98 is_package_installed java-1_8_0-openjdk-headless || install_package java-1_8_0-openjdk-headless
102 zypper_install --no-gpg-checks ${FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.noarch.rpm 99 zypper_install --no-gpg-checks ${FREEZER_API_FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.noarch.rpm
103 sudo /usr/bin/systemctl daemon-reload 100 sudo /usr/bin/systemctl daemon-reload
104 sudo /usr/bin/systemctl enable elasticsearch.service 101 sudo /usr/bin/systemctl enable elasticsearch.service
105 else 102 else
@@ -145,4 +142,4 @@ case $PHASE in
145 uninstall) 142 uninstall)
146 uninstall_elasticsearch 143 uninstall_elasticsearch
147 ;; 144 ;;
148esac \ No newline at end of file 145esac