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
This commit is contained in:
parent
edb258dbb6
commit
1edfc4d44a
|
@ -4,9 +4,6 @@
|
|||
#
|
||||
# TODO(sdague): once we have a few of these I imagine the download
|
||||
# step can probably be factored out to something nicer
|
||||
TOP_DIR=$(cd $DEST/devstack && pwd)
|
||||
FILES=$TOP_DIR/files
|
||||
source $TOP_DIR/stackrc
|
||||
|
||||
# Package source and version, all pkg files are expected to have
|
||||
# something like this, as well as a way to override them.
|
||||
|
@ -17,17 +14,17 @@ ELASTICSEARCH_BASEURL=${ELASTICSEARCH_BASEURL:-https://download.elasticsearch.or
|
|||
function wget_elasticsearch {
|
||||
local file=${1}
|
||||
|
||||
if [ ! -f ${FILES}/${file} ]; then
|
||||
wget $ELASTICSEARCH_BASEURL/${file} -O ${FILES}/${file}
|
||||
if [ ! -f ${FREEZER_API_FILES}/${file} ]; then
|
||||
wget $ELASTICSEARCH_BASEURL/${file} -O ${FREEZER_API_FILES}/${file}
|
||||
fi
|
||||
|
||||
if [ ! -f ${FILES}/${file}.sha1.txt ]; then
|
||||
wget $ELASTICSEARCH_BASEURL/${file}.sha1.txt -O ${FILES}/${file}.sha1.txt
|
||||
if [ ! -f ${FREEZER_API_FILES}/${file}.sha1.txt ]; then
|
||||
wget $ELASTICSEARCH_BASEURL/${file}.sha1.txt -O ${FREEZER_API_FILES}/${file}.sha1.txt
|
||||
fi
|
||||
|
||||
pushd ${FILES}; sha1sum ${file} > ${file}.sha1.gen; popd
|
||||
pushd ${FREEZER_API_FILES}; sha1sum ${file} > ${file}.sha1.gen; popd
|
||||
|
||||
if ! diff ${FILES}/${file}.sha1.gen ${FILES}/${file}.sha1.txt; then
|
||||
if ! diff ${FREEZER_API_FILES}/${file}.sha1.gen ${FREEZER_API_FILES}/${file}.sha1.txt; then
|
||||
echo "Invalid elasticsearch download. Could not install."
|
||||
return 1
|
||||
fi
|
||||
|
@ -90,16 +87,16 @@ function install_elasticsearch {
|
|||
if is_ubuntu; then
|
||||
is_package_installed default-jre-headless || install_package default-jre-headless
|
||||
|
||||
sudo dpkg -i ${FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.deb
|
||||
sudo dpkg -i ${FREEZER_API_FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.deb
|
||||
sudo update-rc.d elasticsearch defaults 95 10
|
||||
elif is_fedora; then
|
||||
is_package_installed java-1.8.0-openjdk-headless || install_package java-1.8.0-openjdk-headless
|
||||
yum_install ${FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.noarch.rpm
|
||||
yum_install ${FREEZER_API_FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.noarch.rpm
|
||||
sudo /bin/systemctl daemon-reload
|
||||
sudo /bin/systemctl enable elasticsearch.service
|
||||
elif is_suse; then
|
||||
is_package_installed java-1_8_0-openjdk-headless || install_package java-1_8_0-openjdk-headless
|
||||
zypper_install --no-gpg-checks ${FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.noarch.rpm
|
||||
zypper_install --no-gpg-checks ${FREEZER_API_FILES}/elasticsearch-${ELASTICSEARCH_VERSION}.noarch.rpm
|
||||
sudo /usr/bin/systemctl daemon-reload
|
||||
sudo /usr/bin/systemctl enable elasticsearch.service
|
||||
else
|
||||
|
@ -145,4 +142,4 @@ case $PHASE in
|
|||
uninstall)
|
||||
uninstall_elasticsearch
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue