From c0f8ce886e09ddc7a705052ad8730c9155dd93e6 Mon Sep 17 00:00:00 2001 From: Bitnami Bot Date: Tue, 17 Sep 2019 03:13:15 +0000 Subject: [PATCH] 4.0.3-centos-7-r19 release --- .../postgresql-repmgr/4/centos-7/Dockerfile | 4 +-- .../4/centos-7/rootfs/libpostgresql.sh | 34 ++++++++----------- .../4/centos-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/centos-7/Dockerfile b/bitnami/postgresql-repmgr/4/centos-7/Dockerfile index 952d59bd2e30..a277bd198317 100644 --- a/bitnami/postgresql-repmgr/4/centos-7/Dockerfile +++ b/bitnami/postgresql-repmgr/4/centos-7/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/centos-extras-base:7-r143 +FROM bitnami/centos-extras-base:7-r144 LABEL maintainer "Bitnami " ENV BITNAMI_PKG_CHMOD="-R g+rwX" \ @@ -15,7 +15,7 @@ COPY rootfs / RUN yum --enablerepo base,updates,extras -y install epel-release && yum --enablerepo base,updates,extras -y update && yum --enablerepo base,updates -y install nss_wrapper RUN /postunpack.sh ENV BITNAMI_APP_NAME="postgresql-repmgr" \ - BITNAMI_IMAGE_VERSION="4.0.3-centos-7-r18" \ + BITNAMI_IMAGE_VERSION="4.0.3-centos-7-r19" \ 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/centos-7/rootfs/libpostgresql.sh b/bitnami/postgresql-repmgr/4/centos-7/rootfs/libpostgresql.sh index a8df3ef16aa2..7518880f724e 100644 --- a/bitnami/postgresql-repmgr/4/centos-7/rootfs/libpostgresql.sh +++ b/bitnami/postgresql-repmgr/4/centos-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/centos-7/rootfs/librepmgr.sh b/bitnami/postgresql-repmgr/4/centos-7/rootfs/librepmgr.sh index a0789af82be3..0855a2b6b4c8 100644 --- a/bitnami/postgresql-repmgr/4/centos-7/rootfs/librepmgr.sh +++ b/bitnami/postgresql-repmgr/4/centos-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 2bb2e0095cdf..e4b3b762fc9d 100644 --- a/bitnami/postgresql-repmgr/README.md +++ b/bitnami/postgresql-repmgr/README.md @@ -45,7 +45,7 @@ Learn more about the Bitnami tagging policy and the difference between rolling t * [`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-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-r18` (4/centos-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql-repmgr/blob/4.0.3-centos-7-r18/4/centos-7/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) Subscribe to project updates by watching the [bitnami/postgresql-repmgr GitHub repo](https://github.com/bitnami/bitnami-docker-postgresql-repmgr).