fix(gpg): Check GPG env variables before exiting if gpgkeys directory is empty
This commit is contained in:
committed by
Carlos D. Álvaro
parent
d2f4f581bb
commit
f133516e14
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -26,7 +26,7 @@ The full log with the outputted error.
|
|||||||
**Version report (please complete the following information):**
|
**Version report (please complete the following information):**
|
||||||
- Host OS: [e.g. `uname -a`]
|
- Host OS: [e.g. `uname -a`]
|
||||||
- Docker: [e.g. `docker --version`]
|
- Docker: [e.g. `docker --version`]
|
||||||
- Image tag: [e.g. `3005.1-2`]
|
- Image tag: [e.g. `3005.1-2_1`]
|
||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context about the problem here.
|
Add any other context about the problem here.
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ This file only reflects the changes that are made in this image.
|
|||||||
Please refer to the [Salt 3005.1 Release Notes](https://docs.saltstack.com/en/latest/topics/releases/3005.1.html)
|
Please refer to the [Salt 3005.1 Release Notes](https://docs.saltstack.com/en/latest/topics/releases/3005.1.html)
|
||||||
for the list of changes in SaltStack.
|
for the list of changes in SaltStack.
|
||||||
|
|
||||||
|
**3005.1-2_1**
|
||||||
|
|
||||||
|
- Fix: check GPG env variables before exiting if `gpgkeys` directory is empty.
|
||||||
|
|
||||||
**3005.1-2**
|
**3005.1-2**
|
||||||
|
|
||||||
- Upgrade `salt-master` to `3005.1-2` *Phosphorus*.
|
- Upgrade `salt-master` to `3005.1-2` *Phosphorus*.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ ARG VCS_REF
|
|||||||
|
|
||||||
# https://github.com/saltstack/salt/releases
|
# https://github.com/saltstack/salt/releases
|
||||||
ENV SALT_VERSION="3005.1-2"
|
ENV SALT_VERSION="3005.1-2"
|
||||||
ENV IMAGE_VERSION="${SALT_VERSION}"
|
ENV IMAGE_VERSION="${SALT_VERSION}_1"
|
||||||
|
|
||||||
ENV SALT_DOCKER_DIR="/etc/docker-salt" \
|
ENV SALT_DOCKER_DIR="/etc/docker-salt" \
|
||||||
SALT_ROOT_DIR="/etc/salt" \
|
SALT_ROOT_DIR="/etc/salt" \
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -18,7 +18,7 @@ build:
|
|||||||
|
|
||||||
release: build
|
release: build
|
||||||
@docker tag cdalvaro/docker-salt-master:latest \
|
@docker tag cdalvaro/docker-salt-master:latest \
|
||||||
cdalvaro/docker-salt-master:$(shell cat VERSION)
|
cdalvaro/docker-salt-master:$(shell cat VERSION)_1
|
||||||
|
|
||||||
quickstart:
|
quickstart:
|
||||||
@echo "Starting docker-salt-master container..."
|
@echo "Starting docker-salt-master container..."
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ Automated builds of the image are available on
|
|||||||
the recommended method of installation.
|
the recommended method of installation.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker pull ghcr.io/cdalvaro/docker-salt-master:3005.1-2
|
docker pull ghcr.io/cdalvaro/docker-salt-master:3005.1-2_1
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also pull the latest tag which is built from the repository `HEAD`
|
You can also pull the latest tag which is built from the repository `HEAD`
|
||||||
|
|||||||
@@ -276,8 +276,11 @@ function _check_and_link_gpgkey() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$(dirname "${TARGET_GPGKEY}")"
|
||||||
|
|
||||||
log_info "Linking '${SOURCE_GPGKEY}' to '${TARGET_GPGKEY}' ..."
|
log_info "Linking '${SOURCE_GPGKEY}' to '${TARGET_GPGKEY}' ..."
|
||||||
ln -sfn "${SOURCE_GPGKEY}" "${TARGET_GPGKEY}"
|
ln -sfn "${SOURCE_GPGKEY}" "${TARGET_GPGKEY}"
|
||||||
|
chown "${SALT_USER}:${SALT_USER}" "${TARGET_GPGKEY}"
|
||||||
}
|
}
|
||||||
|
|
||||||
#--- FUNCTION -------------------------------------------------------------------------------------------------------
|
#--- FUNCTION -------------------------------------------------------------------------------------------------------
|
||||||
@@ -286,15 +289,19 @@ function _check_and_link_gpgkey() {
|
|||||||
#----------------------------------------------------------------------------------------------------------------------
|
#----------------------------------------------------------------------------------------------------------------------
|
||||||
function _setup_gpgkeys()
|
function _setup_gpgkeys()
|
||||||
{
|
{
|
||||||
[[ -d "${SALT_KEYS_GPGKEYS_DIR}" && -n "$(ls -A "${SALT_KEYS_GPGKEYS_DIR}")" ]] || return 0
|
|
||||||
|
|
||||||
log_info " ==> Setting up GPG keys ..."
|
log_info " ==> Setting up GPG keys ..."
|
||||||
|
|
||||||
local private_key="${SALT_KEYS_GPGKEYS_DIR}/private.key"
|
local private_key="${SALT_KEYS_GPGKEYS_DIR}/private.key"
|
||||||
local public_key="${SALT_KEYS_GPGKEYS_DIR}/pubkey.gpg"
|
local public_key="${SALT_KEYS_GPGKEYS_DIR}/pubkey.gpg"
|
||||||
|
|
||||||
_check_and_link_gpgkey 'SALT_GPG_PRIVATE_KEY_FILE' "${private_key}"
|
_check_and_link_gpgkey 'SALT_GPG_PRIVATE_KEY_FILE' "${private_key}"
|
||||||
_check_and_link_gpgkey 'SALT_GPG_PUBLIC_KEY_FILE' "${public_key}"
|
_check_and_link_gpgkey 'SALT_GPG_PUBLIC_KEY_FILE' "${public_key}"
|
||||||
|
|
||||||
|
if [[ ! -d "${SALT_KEYS_GPGKEYS_DIR}" || -z "$(ls -A "${SALT_KEYS_GPGKEYS_DIR}")" ]]; then
|
||||||
|
log_info "Could not find GPG keys. GPG setup skipped."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -f "${private_key}" || ! -f "${public_key}" ]]; then
|
if [[ ! -f "${private_key}" || ! -f "${public_key}" ]]; then
|
||||||
log_error "GPG keys are not valid. Please, check the documentation for more information:"
|
log_error "GPG keys are not valid. Please, check the documentation for more information:"
|
||||||
log_error " - https://github.com/cdalvaro/docker-salt-master#gpg-keys-for-renderers"
|
log_error " - https://github.com/cdalvaro/docker-salt-master#gpg-keys-for-renderers"
|
||||||
|
|||||||
Reference in New Issue
Block a user