Upgrade to Vault 0.6.0.

fixes gh-9
This commit is contained in:
Mark Paluch
2016-06-18 10:17:10 +02:00
parent 8302e662eb
commit 7a27b605f7
2 changed files with 15 additions and 12 deletions

View File

@@ -20,8 +20,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.cloud.vault.VaultProperties.AppIdProperties;
import org.springframework.cloud.vault.VaultProperties.AuthenticationMethod;
import org.springframework.http.HttpEntity;
@@ -81,7 +79,8 @@ public class VaultClient {
Exception error = null;
String errorBody = null;
URI uri = this.rest.getUriTemplateHandler().expand(url, secureBackendAccessor.variables());
URI uri = this.rest.getUriTemplateHandler().expand(url,
secureBackendAccessor.variables());
log.info(String.format("Fetching config from server at: %s", uri));
try {
@@ -96,12 +95,16 @@ public class VaultClient {
}
}
}
catch (HttpServerErrorException e) {
error = e;
catch (HttpServerErrorException | HttpClientErrorException e) {
if (MediaType.APPLICATION_JSON
.includes(e.getResponseHeaders().getContentType())) {
errorBody = e.getResponseBodyAsString();
}
if (e.getStatusCode() != HttpStatus.NOT_FOUND) {
error = e;
}
}
catch (Exception e) {
error = e;

View File

@@ -6,24 +6,22 @@
###########################################################################
VAULT_VER="0.5.2"
VAULT_VER="0.6.0"
UNAME=$(uname -s | tr '[:upper:]' '[:lower:]')
VAULT_ZIP="vault_${VAULT_VER}_${UNAME}_amd64.zip"
IGNORE_CERTS="${IGNORE_CERTS:-no}"
# cleanup
mkdir -p vault/download
cd vault
mkdir -p vault
if [[ ! -f "download/${VAULT_ZIP}" ]] ; then
cd download
# install Vault
if [[ "${IGNORE_CERTS}" == "no" ]] ; then
echo "Downloading consul with certs verification"
echo "Downloading Vault with certs verification"
wget "https://releases.hashicorp.com/vault/${VAULT_VER}/${VAULT_ZIP}"
else
echo "WARNING... Downloading consul WITHOUT certs verification"
echo "WARNING... Downloading Vault WITHOUT certs verification"
wget "https://releases.hashicorp.com/vault/${VAULT_VER}/${VAULT_ZIP}" --no-check-certificate
fi
@@ -34,11 +32,13 @@ if [[ ! -f "download/${VAULT_ZIP}" ]] ; then
cd ..
fi
cd vault
if [[ -f vault ]] ; then
rm vault
fi
unzip download/${VAULT_ZIP}
unzip ../download/${VAULT_ZIP}
chmod a+x vault
# check