Browse Source

feat(config): validate config before applying

tags/v2.6.0
Javier Bértoli 4 years ago
parent
commit
b396b24fe4
3 changed files with 15 additions and 0 deletions
  1. +3
    -0
      nginx/config.sls
  2. +1
    -0
      nginx/map.jinja
  3. +11
    -0
      pillar.example

+ 3
- 0
nginx/config.sls View File

- context: - context:
config: {{ nginx.server.config|json(sort_keys=False) }} config: {{ nginx.server.config|json(sort_keys=False) }}
{% endif %} {% endif %}
{% if nginx.check_config_before_apply %}
- check_cmd: /usr/sbin/nginx -t -c
{% endif %}

+ 1
- 0
nginx/map.jinja View File

'install_from_ppa': False, 'install_from_ppa': False,
'install_from_repo': False, 'install_from_repo': False,
'install_from_phusionpassenger': False, 'install_from_phusionpassenger': False,
'check_config_before_apply': False,
'ppa_version': 'stable', 'ppa_version': 'stable',
'source_version': '1.10.0', 'source_version': '1.10.0',
'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d', 'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d',

+ 11
- 0
pillar.example View File

source_version: '1.10.0' source_version: '1.10.0'
source_hash: '' source_hash: ''


# Check the configuration before applying:
# To prevent applying a configuration that might break nginx, set this
# parameter to true so the configuration is checked BEFORE applying. If
# the check fails, the state will fail and it won't be deployed.
# CAVEAT: As the configuration file is created in a temp dir, it can't
# have relative references or it will fail to check. You'll need to
# specify full paths where required (ie, `include`, `load_module`,
# `snippets`, etc.0
# Defaults to false
check_config_before_apply: false

# These are usually set by grains in map.jinja # These are usually set by grains in map.jinja
# Typically you can comment these out. # Typically you can comment these out.
lookup: lookup:

Loading…
Cancel
Save