Fix various typos and styling errors in __consul_agent, conf-dir

explorer
This commit is contained in:
fnux 2020-01-26 15:13:12 +01:00
parent f595664924
commit 31ad1bdaad
2 changed files with 22 additions and 20 deletions

View file

@ -49,7 +49,7 @@ distribution_setup () {
debian)
# consul is only available starting Debian 10 (buster).
# See https://packages.debian.org/buster/consul
if [ $release -lt 10 ]; then
if [ "$release" -lt 10 ]; then
echo "Consul is not available for your debian release." >&2
echo "Please use the 'manual' (i.e. non-package) installation or \
upgrade the target system." >&2
@ -59,7 +59,7 @@ distribution_setup () {
# Override previously defined environment to match debian packaging.
conf_dir='/etc/consul.d'
user='consul'
grou='consul'
group='consul'
;;
*)
echo "Your operating system ($os) is currently not supported with the \
@ -71,7 +71,7 @@ distribution_setup () {
esac
# Install consul package.
__package consul --state $state
__package consul --state "$state"
export config_deployment_requires="__package/consul"
}
@ -202,8 +202,23 @@ else
manual_setup
fi
###
# Install TLS certificates.
if [ -f "$__object/parameter/ca-file-source" ] || \
[ -f "$__object/parameter/cert-file-source" ] || \
[ -f "$__object/parameter/key-file-source" ]; then
requires="$config_deployment_requires" __directory $tls_dir \
--owner root --group "$group" --mode 750 --state "$state"
# Append to service restart requirements.
restart_requires="$restart_requires __directory/$conf_dir/tls"
fi
###
# Generate and deploy configuration.
json_configuration=$(
echo "{"
@ -216,8 +231,8 @@ json_configuration=$(
state|user|group|json-config|use-distribution-package) continue ;;
ca-file-source|cert-file-source|key-file-source)
source="$(cat "$__object/parameter/$param")"
destination="/etc/consul/ssl/${source##*/}"
require="__directory/etc/consul/ssl" \
destination="$tls_dir/${source##*/}"
require="__directory/$tls_dir" \
__file "$destination" \
--owner root --group consul --mode 640 \
--source "$source" \
@ -276,19 +291,6 @@ echo "$json_configuration" | require="$config_deployment_requires" \
# Set configuration deployment as requirement for service restart.
restart_requires="__file/$conf_dir/$conf_file"
###
# Install TLS certificates.
if [ -f "$__object/parameter/ca-file-source" ] || \
[ -f "$__object/parameter/cert-file-source" ] || \
[ -f "$__object/parameter/key-file-source" ]; then
requires="__file/$conf_dir/$conf_file" __directory $conf_dir/tls \
--owner root --group "$group" --mode 750 --state "$state"
# Append to service restart requirements.
restart_requires="$restart_requires __directory/$conf_dir/tls"
fi
###
# Restart consul agent after everything else.
require="$restart_requires" __service consul --action restart

View file

@ -2,7 +2,7 @@
check_dir () {
if [ -d "$1" ]; then
echo -n "$1"
printf '%s' "$1"
exit
fi
}