Browse Source

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
gengchc2 3 months ago
parent
commit
1edfc4d44a
1 changed files with 10 additions and 13 deletions
  1. 10
    13
      devstack/lib/elasticsearch.sh

+ 10
- 13
devstack/lib/elasticsearch.sh View File

@@ -4,9 +4,6 @@
4 4
 #
5 5
 # TODO(sdague): once we have a few of these I imagine the download
6 6
 # step can probably be factored out to something nicer
7
-TOP_DIR=$(cd $DEST/devstack && pwd)
8
-FILES=$TOP_DIR/files
9
-source $TOP_DIR/stackrc
10 7
 
11 8
 # Package source and version, all pkg files are expected to have
12 9
 # something like this, as well as a way to override them.
@@ -17,17 +14,17 @@ ELASTICSEARCH_BASEURL=${ELASTICSEARCH_BASEURL:-https://download.elasticsearch.or
17 14
 function wget_elasticsearch {
18 15
     local file=${1}
19 16
 
20
-    if [ ! -f ${FILES}/${file} ]; then
21
-        wget $ELASTICSEARCH_BASEURL/${file} -O ${FILES}/${file}
17
+    if [ ! -f ${FREEZER_API_FILES}/${file} ]; then
18
+        wget $ELASTICSEARCH_BASEURL/${file} -O ${FREEZER_API_FILES}/${file}
22 19
     fi
23 20
 
24
-    if [ ! -f ${FILES}/${file}.sha1.txt ]; then
25
-        wget $ELASTICSEARCH_BASEURL/${file}.sha1.txt -O ${FILES}/${file}.sha1.txt
21
+    if [ ! -f ${FREEZER_API_FILES}/${file}.sha1.txt ]; then
22
+        wget $ELASTICSEARCH_BASEURL/${file}.sha1.txt -O ${FREEZER_API_FILES}/${file}.sha1.txt
26 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 28
         echo "Invalid elasticsearch download. Could not install."
32 29
         return 1
33 30
     fi
@@ -90,16 +87,16 @@ function install_elasticsearch {
90 87
     if is_ubuntu; then
91 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 91
         sudo update-rc.d elasticsearch defaults 95 10
95 92
     elif is_fedora; then
96 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 95
         sudo /bin/systemctl daemon-reload
99 96
         sudo /bin/systemctl enable elasticsearch.service
100 97
     elif is_suse; then
101 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 100
         sudo /usr/bin/systemctl daemon-reload
104 101
         sudo /usr/bin/systemctl enable elasticsearch.service
105 102
     else
@@ -145,4 +142,4 @@ case $PHASE in
145 142
     uninstall)
146 143
         uninstall_elasticsearch
147 144
         ;;
148
-esac
145
+esac

Loading…
Cancel
Save