Allow more generic overrides for placement

With this patch we allow for a more easy way of overriding some
of the values that may be used in other distros while maintainting
the default values if those values are not overriden.

The following values are introduced to be overriden:
conf:
  security:
  software:
    apache2:
      binary:
      start_flags:
      a2enmod:
      a2dismod:

On which:
 * binary: the binary to use for launching apache
 * start_flags: any flags that will be passed to the apache binary call
 * a2enmod: mods to enable
 * a2dismod: mods to disable

Notice that if there is no overrides given, it should not affect anything
and the templates will not be changed as the default values are set to what
they used to be as to not disrupt existing deployments.

Change-Id: I77940ff847fc5785178ee5cf84cb77bed9f1ec71
Signed-off-by: Zhipeng Liu <zhipengs.liu@intel.com>
This commit is contained in:
Zhipeng Liu 2020-04-22 00:41:02 +08:00 committed by zhipeng liu
parent 8f7b486b97
commit bdbea96326
2 changed files with 29 additions and 4 deletions

View File

@ -24,19 +24,32 @@ function start () {
cp -a $(type -p placement-api) /var/www/cgi-bin/placement/
if [ -f /etc/apache2/envvars ]; then
# Loading Apache2 ENV variables
source /etc/apache2/envvars
# Loading Apache2 ENV variables
source /etc/apache2/envvars
# The directory below has to be created due to the fact that
# libapache2-mod-wsgi-py3 doesn't create it in contrary by libapache2-mod-wsgi
mkdir -p ${APACHE_RUN_DIR}
fi
# Get rid of stale pid file if present.
rm -f /var/run/apache2/*.pid
# Start Apache2
exec apache2ctl -DFOREGROUND
{{- if .Values.conf.software.apache2.a2enmod }}
{{- range .Values.conf.software.apache2.a2enmod }}
a2enmod {{ . }}
{{- end }}
{{- end }}
{{- if .Values.conf.software.apache2.a2dismod }}
{{- range .Values.conf.software.apache2.a2dismod }}
a2dismod {{ . }}
{{- end }}
{{- end }}
exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }}
}
function stop () {
apache2ctl -k graceful-stop
{{ .Values.conf.software.apache2.binary }} -k graceful-stop
}
$COMMAND

View File

@ -65,6 +65,18 @@ conf:
segregation: 'rule:context_is_admin'
admin_or_owner: 'rule:context_is_admin or project_id:%(project_id)s'
default: 'rule:admin_or_owner'
software:
apache2:
binary: apache2
start_parameters: -DFOREGROUND
# Enable/Disable modules
# a2enmod:
# - headers
# - rewrite
# a2dismod:
# - status
a2enmod: null
a2dismod: null
placement:
DEFAULT:
debug: false