From ba01db0de795b5e7c78cdd3c14db83d21a09b03f Mon Sep 17 00:00:00 2001 From: Bitnami Bot Date: Tue, 17 Sep 2019 03:45:28 +0000 Subject: [PATCH] 4.0.3-ol-7-r17 release --- bitnami/postgresql-repmgr/4/ol-7/Dockerfile | 4 +-- .../4/ol-7/rootfs/libpostgresql.sh | 34 ++++++++----------- .../4/ol-7/rootfs/librepmgr.sh | 21 +++++++----- bitnami/postgresql-repmgr/README.md | 2 +- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/bitnami/postgresql-repmgr/4/ol-7/Dockerfile b/bitnami/postgresql-repmgr/4/ol-7/Dockerfile index f619e342dc3a..15f3ddebc8b7 100644 --- a/bitnami/postgresql-repmgr/4/ol-7/Dockerfile +++ b/bitnami/postgresql-repmgr/4/ol-7/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/oraclelinux-extras-base:7-r419 +FROM bitnami/oraclelinux-extras-base:7-r420 LABEL maintainer "Bitnami " ENV BITNAMI_PKG_CHMOD="-R g+rwX" \ @@ -15,7 +15,7 @@ COPY rootfs / RUN rpm -Uvh --nodeps $(repoquery --location nss_wrapper) RUN /postunpack.sh ENV BITNAMI_APP_NAME="postgresql-repmgr" \ - BITNAMI_IMAGE_VERSION="4.0.3-ol-7-r16" \ + BITNAMI_IMAGE_VERSION="4.0.3-ol-7-r17" \ NAMI_PREFIX="/.nami" \ NSS_WRAPPER_LIB="/usr/lib64/libnss_wrapper.so" \ PATH="/opt/bitnami/postgresql-repmgr/bin:/opt/bitnami/repmgr/bin:/opt/bitnami/postgresql/bin:$PATH" diff --git a/bitnami/postgresql-repmgr/4/ol-7/rootfs/libpostgresql.sh b/bitnami/postgresql-repmgr/4/ol-7/rootfs/libpostgresql.sh index a8df3ef16aa2..7518880f724e 100644 --- a/bitnami/postgresql-repmgr/4/ol-7/rootfs/libpostgresql.sh +++ b/bitnami/postgresql-repmgr/4/ol-7/rootfs/libpostgresql.sh @@ -178,58 +178,54 @@ EOF ######################### postgresql_validate() { postgresql_info "Validating settings in POSTGRESQL_* env vars.." + local error_code=0 # Auxiliary functions + print_validation_error() { + postgresql_error "$1" + error_code=1 + } + empty_password_enabled_warn() { postgresql_warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment." } empty_password_error() { - postgresql_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." - exit 1 + print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development." } if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then empty_password_enabled_warn else if [[ -z "$POSTGRESQL_PASSWORD" ]]; then empty_password_error "POSTGRESQL_PASSWORD" - exit 1 fi if (( ${#POSTGRESQL_PASSWORD} > 100 )); then - postgresql_error "The password cannot be longer than 100 characters. Set the environment variable POSTGRESQL_PASSWORD with a shorter value" - exit 1 + print_validation_error "The password cannot be longer than 100 characters. Set the environment variable POSTGRESQL_PASSWORD with a shorter value" fi if [[ -n "$POSTGRESQL_USERNAME" ]] && [[ -z "$POSTGRESQL_PASSWORD" ]]; then empty_password_error "POSTGRESQL_PASSWORD" - exit 1 fi if [[ -n "$POSTGRESQL_USERNAME" ]] && [[ "$POSTGRESQL_USERNAME" != "postgres" ]] && [[ -n "$POSTGRESQL_PASSWORD" ]] && [[ -z "$POSTGRESQL_DATABASE" ]]; then - postgresql_error "In order to use a custom PostgreSQL user you need to set the environment variable POSTGRESQL_DATABASE as well" - exit 1 + print_validation_error "In order to use a custom PostgreSQL user you need to set the environment variable POSTGRESQL_DATABASE as well" fi fi if [[ -n "$POSTGRESQL_REPLICATION_MODE" ]]; then if [[ "$POSTGRESQL_REPLICATION_MODE" = "master" ]]; then if (( POSTGRESQL_NUM_SYNCHRONOUS_REPLICAS < 0 )); then - postgresql_error "The number of synchronous replicas cannot be less than 0. Set the environment variable POSTGRESQL_NUM_SYNCHRONOUS_REPLICAS" - exit 1 + print_validation_error "The number of synchronous replicas cannot be less than 0. Set the environment variable POSTGRESQL_NUM_SYNCHRONOUS_REPLICAS" fi elif [[ "$POSTGRESQL_REPLICATION_MODE" = "slave" ]]; then if [[ -z "$POSTGRESQL_MASTER_HOST" ]]; then - postgresql_error "Slave replication mode chosen without setting the environment variable POSTGRESQL_MASTER_HOST. Use it to indicate where the Master node is running" - exit 1 + print_validation_error "Slave replication mode chosen without setting the environment variable POSTGRESQL_MASTER_HOST. Use it to indicate where the Master node is running" fi if [[ -z "$POSTGRESQL_REPLICATION_USER" ]]; then - postgresql_error "Slave replication mode chosen without setting the environment variable POSTGRESQL_REPLICATION_USER. Make sure that the master also has this parameter set" - exit 1 + print_validation_error "Slave replication mode chosen without setting the environment variable POSTGRESQL_REPLICATION_USER. Make sure that the master also has this parameter set" fi else - postgresql_error "Invalid replication mode. Available options are 'master/slave'" - exit 1 + print_validation_error "Invalid replication mode. Available options are 'master/slave'" fi # Common replication checks if [[ -n "$POSTGRESQL_REPLICATION_USER" ]] && [[ -z "$POSTGRESQL_REPLICATION_PASSWORD" ]]; then empty_password_error "POSTGRESQL_REPLICATION_PASSWORD" - exit 1 fi else if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then @@ -237,14 +233,14 @@ postgresql_validate() { else if [[ -z "$POSTGRESQL_PASSWORD" ]]; then empty_password_error "POSTGRESQL_PASSWORD" - exit 1 fi if [[ -n "$POSTGRESQL_USERNAME" ]] && [[ -z "$POSTGRESQL_PASSWORD" ]]; then empty_password_error "POSTGRESQL_PASSWORD" - exit 1 fi fi fi + + [[ "$error_code" -eq 0 ]] || exit "$error_code" } ######################## diff --git a/bitnami/postgresql-repmgr/4/ol-7/rootfs/librepmgr.sh b/bitnami/postgresql-repmgr/4/ol-7/rootfs/librepmgr.sh index a0789af82be3..0855a2b6b4c8 100644 --- a/bitnami/postgresql-repmgr/4/ol-7/rootfs/librepmgr.sh +++ b/bitnami/postgresql-repmgr/4/ol-7/rootfs/librepmgr.sh @@ -129,34 +129,37 @@ repmgr_get_node_id() { ######################### repmgr_validate() { repmgr_info "Validating settings in REPMGR_* env vars..." + local error_code=0 # Auxiliary functions - print_error_exit() { + print_validation_error() { repmgr_error "$1" - exit 1 + error_code=1 } if [[ -z "$REPMGR_PARTNER_NODES" ]]; then - print_error_exit "The list of partner nodes cannot be empty. Set the environment variable REPMGR_PARTNER_NODES with a comma separated list of partner nodes." + print_validation_error "The list of partner nodes cannot be empty. Set the environment variable REPMGR_PARTNER_NODES with a comma separated list of partner nodes." fi if [[ -z "$REPMGR_PRIMARY_HOST" ]]; then - print_error_exit "The initial primary host is required. Set the environment variable REPMGR_PRIMARY_HOST with the initial primary host." + print_validation_error "The initial primary host is required. Set the environment variable REPMGR_PRIMARY_HOST with the initial primary host." fi if [[ -z "$REPMGR_NODE_NAME" ]]; then - print_error_exit "The node name is required. Set the environment variable REPMGR_NODE_NAME with the node name." + print_validation_error "The node name is required. Set the environment variable REPMGR_NODE_NAME with the node name." elif [[ ! "$REPMGR_NODE_NAME" =~ ^.*+-[0-9]+$ ]]; then - print_error_exit "The node name does not follow the required format. Valid format: ^.*+-[0-9]+$" + print_validation_error "The node name does not follow the required format. Valid format: ^.*+-[0-9]+$" fi if [[ -z "$(repmgr_get_node_id)" ]]; then - print_error_exit "The node id is required. Set the environment variable REPMGR_NODE_ID with the node id." + print_validation_error "The node id is required. Set the environment variable REPMGR_NODE_ID with the node id." fi if [[ -z "$REPMGR_NODE_NETWORK_NAME" ]]; then - print_error_exit "The node network name is required. Set the environment variable REPMGR_NODE_NETWORK_NAME with the node network name." + print_validation_error "The node network name is required. Set the environment variable REPMGR_NODE_NETWORK_NAME with the node network name." fi # Credentials validations if [[ -z "$REPMGR_USERNAME" ]] || [[ -z "$REPMGR_PASSWORD" ]]; then - print_error_exit "The repmgr credentials are mandatory. Set the environment variables REPMGR_USERNAME and REPMGR_PASSWORD with the repmgr credentials." + print_validation_error "The repmgr credentials are mandatory. Set the environment variables REPMGR_USERNAME and REPMGR_PASSWORD with the repmgr credentials." fi + + [[ "$error_code" -eq 0 ]] || exit "$error_code" } ######################## diff --git a/bitnami/postgresql-repmgr/README.md b/bitnami/postgresql-repmgr/README.md index e4b3b762fc9d..c53ed4c587c0 100644 --- a/bitnami/postgresql-repmgr/README.md +++ b/bitnami/postgresql-repmgr/README.md @@ -43,7 +43,7 @@ Bitnami containers can be used with [Kubeapps](https://kubeapps.com/) for deploy Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/). -* [`4-ol-7`, `4.0.3-ol-7-r16` (4/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql-repmgr/blob/4.0.3-ol-7-r16/4/ol-7/Dockerfile) +* [`4-ol-7`, `4.0.3-ol-7-r17` (4/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql-repmgr/blob/4.0.3-ol-7-r17/4/ol-7/Dockerfile) * [`4-debian-9`, `4.0.3-debian-9-r18`, `4`, `4.0.3`, `4.0.3-r18`, `latest` (4/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql-repmgr/blob/4.0.3-debian-9-r18/4/debian-9/Dockerfile) * [`4-centos-7`, `4.0.3-centos-7-r19` (4/centos-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql-repmgr/blob/4.0.3-centos-7-r19/4/centos-7/Dockerfile)