feat: Remove USERMAP_UID and USERMAP_GID env variables support
This commit is contained in:
@@ -10,6 +10,7 @@ for the list of changes in SaltStack.
|
|||||||
- Change Docker base image to `ubuntu:jammy-20220531`
|
- Change Docker base image to `ubuntu:jammy-20220531`
|
||||||
- Use `python3` default distro version
|
- Use `python3` default distro version
|
||||||
- Install `python3-pygit2` version `1.6.1` from Ubuntu repositories
|
- Install `python3-pygit2` version `1.6.1` from Ubuntu repositories
|
||||||
|
- Remove `USERMAP_UID` and `USERMAP_GID` env variables in favor of `PUID` and `PGID`, respectively.
|
||||||
- CI(tests): Use `python3` version `3.10`
|
- CI(tests): Use `python3` version `3.10`
|
||||||
|
|
||||||
**3004.2**
|
**3004.2**
|
||||||
|
|||||||
@@ -510,6 +510,8 @@ Below you can find a list with the available options that can be used to customi
|
|||||||
| :------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| :------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `DEBUG` | Set this to `True` to enable entrypoint debugging. |
|
| `DEBUG` | Set this to `True` to enable entrypoint debugging. |
|
||||||
| `TIMEZONE` / `TZ` | Set the container timezone. Defaults to `UTC`. Values are expected to be in Canonical format. Example: `Europe/Madrid`. See the list of [acceptable values](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). |
|
| `TIMEZONE` / `TZ` | Set the container timezone. Defaults to `UTC`. Values are expected to be in Canonical format. Example: `Europe/Madrid`. See the list of [acceptable values](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). |
|
||||||
|
| `PUID` | Sets the uid for user `salt` to the specified uid. Default: `1000`. |
|
||||||
|
| `PGID` | Sets the gid for user `salt` to the specified gid. Default: `1000`. |
|
||||||
| `SALT_RESTART_MASTER_ON_CONFIG_CHANGE` | Set this to `True` to restart `salt-master` service when configuration files change. Default: `False` |
|
| `SALT_RESTART_MASTER_ON_CONFIG_CHANGE` | Set this to `True` to restart `salt-master` service when configuration files change. Default: `False` |
|
||||||
| [`SALT_LOG_LEVEL`](https://docs.saltproject.io/en/latest/ref/configuration/master.html#log-level) | The level of messages to send to the console. One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. Default: `warning` |
|
| [`SALT_LOG_LEVEL`](https://docs.saltproject.io/en/latest/ref/configuration/master.html#log-level) | The level of messages to send to the console. One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. Default: `warning` |
|
||||||
| `SALT_LOG_ROTATE_FREQUENCY` | Logrotate frequency for salt logs. Available options are 'daily', 'weekly', 'monthly', and 'yearly'. Default: `weekly` |
|
| `SALT_LOG_ROTATE_FREQUENCY` | Logrotate frequency for salt logs. Available options are 'daily', 'weekly', 'monthly', and 'yearly'. Default: `weekly` |
|
||||||
@@ -528,10 +530,6 @@ Below you can find a list with the available options that can be used to customi
|
|||||||
| `SALT_GITFS_SSH_PUBLIC_KEY` | The name of the ssh public key for gitfs. Default: `gitfs_ssh`.pub` |
|
| `SALT_GITFS_SSH_PUBLIC_KEY` | The name of the ssh public key for gitfs. Default: `gitfs_ssh`.pub` |
|
||||||
| [`SALT_REACTOR_WORKER_THREADS`](https://docs.saltproject.io/en/latest/ref/configuration/master.html#reactor-worker-threads) | The number of workers for the runner/wheel in the reactor. Default: `10`. |
|
| [`SALT_REACTOR_WORKER_THREADS`](https://docs.saltproject.io/en/latest/ref/configuration/master.html#reactor-worker-threads) | The number of workers for the runner/wheel in the reactor. Default: `10`. |
|
||||||
| [`SALT_WORKER_THREADS`](https://docs.saltproject.io/en/latest/ref/configuration/master.html#worker-threads) | The number of threads to start for receiving commands and replies from minions. Default: `5`. |
|
| [`SALT_WORKER_THREADS`](https://docs.saltproject.io/en/latest/ref/configuration/master.html#worker-threads) | The number of threads to start for receiving commands and replies from minions. Default: `5`. |
|
||||||
| `PUID` | Sets the uid for user `salt` to the specified uid. Default: `1000`. |
|
|
||||||
| `PGID` | Sets the gid for user `salt` to the specified gid. Default: `1000`. |
|
|
||||||
| `USERMAP_UID` (**deprecated**) | Same as `PUID`. Support will be removed in Salt 3005 release in favor of `PUID`. |
|
|
||||||
| `USERMAP_GID` (**deprecated**) | Same as `PGID`. Support will be removed in Salt 3005 release in favor of `PGID`. |
|
|
||||||
|
|
||||||
Any parameter not listed in the above table and available in the following [link](https://docs.saltproject.io/en/latest/ref/configuration/examples.html#configuration-examples-master), can be set by creating the directory `config` and adding into it a `.conf` file with the desired parameters:
|
Any parameter not listed in the above table and available in the following [link](https://docs.saltproject.io/en/latest/ref/configuration/examples.html#configuration-examples-master), can be set by creating the directory `config` and adding into it a `.conf` file with the desired parameters:
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
PUID=${PUID:-1000}
|
||||||
|
PGID=${PGID:-1000}
|
||||||
|
|
||||||
DEBUG=${DEBUG:-False}
|
DEBUG=${DEBUG:-False}
|
||||||
TIMEZONE=${TIMEZONE:-${TZ:-UTC}}
|
TIMEZONE=${TIMEZONE:-${TZ:-UTC}}
|
||||||
|
|
||||||
|
|||||||
@@ -57,53 +57,12 @@ function log_error()
|
|||||||
(>&2 echo "[ERROR] - $*")
|
(>&2 echo "[ERROR] - $*")
|
||||||
}
|
}
|
||||||
|
|
||||||
#--- FUNCTION -------------------------------------------------------------------------------------------------------
|
|
||||||
# NAME: __check_puid_pgid_env
|
|
||||||
# DESCRIPTION: Check if the PUID and PGID environment variables are set correctly.
|
|
||||||
#----------------------------------------------------------------------------------------------------------------------
|
|
||||||
function __check_puid_pgid_env
|
|
||||||
{
|
|
||||||
if [[ "${SALT_VERSION}" -ge "3005" ]]; then
|
|
||||||
log_error "The USERMAP_UID and USERMAP_GID environment variables are not supported in Salt >= 3005"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "${USERMAP_UID}" ]]; then
|
|
||||||
log_warn "The USERMAP_UID environment variable is deprecated. Please use PUID instead."
|
|
||||||
log_warn "Support for USERMAP_UID will be removed in Salt 3005 release."
|
|
||||||
if [[ -z "${PUID}" ]]; then
|
|
||||||
log_warn "Setting PUID to USERMAP_UID (${USERMAP_UID})"
|
|
||||||
export PUID="${USERMAP_UID}"
|
|
||||||
else
|
|
||||||
log_error "The PUID and USERMAP_UID environment variables are set. PUID will be used."
|
|
||||||
fi
|
|
||||||
unset USERMAP_UID
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "${USERMAP_GID}" ]]; then
|
|
||||||
log_warn "The USERMAP_GID environment variable is deprecated. Please use PGID instead."
|
|
||||||
log_warn "Support for USERMAP_GID will be removed in Salt 3005 release."
|
|
||||||
if [[ -z "${PGID}" ]]; then
|
|
||||||
log_info "Setting PGID to USERMAP_GID (${USERMAP_GID})"
|
|
||||||
export PGID="${USERMAP_GID}"
|
|
||||||
else
|
|
||||||
log_error "The PGID and USERMAP_GID environment variables are set. PGID will be used."
|
|
||||||
fi
|
|
||||||
unset USERMAP_GID
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#--- FUNCTION -------------------------------------------------------------------------------------------------------
|
#--- FUNCTION -------------------------------------------------------------------------------------------------------
|
||||||
# NAME: map_uidgid
|
# NAME: map_uidgid
|
||||||
# DESCRIPTION: Map salt user with host user.
|
# DESCRIPTION: Map salt user with host user.
|
||||||
#----------------------------------------------------------------------------------------------------------------------
|
#----------------------------------------------------------------------------------------------------------------------
|
||||||
function map_uidgid()
|
function map_uidgid()
|
||||||
{
|
{
|
||||||
__check_puid_pgid_env
|
|
||||||
# Move this into env-defaults.sh
|
|
||||||
[ -z "${PUID}" ] && export PUID=1000
|
|
||||||
[ -z "${PGID}" ] && export PGID=1000
|
|
||||||
|
|
||||||
ORIG_PUID=$(id -u "${SALT_USER}")
|
ORIG_PUID=$(id -u "${SALT_USER}")
|
||||||
ORIG_PGID=$(id -g "${SALT_USER}")
|
ORIG_PGID=$(id -g "${SALT_USER}")
|
||||||
PGID=${PGID:-${PUID:-$ORIG_PGID}}
|
PGID=${PGID:-${PUID:-$ORIG_PGID}}
|
||||||
|
|||||||
Reference in New Issue
Block a user