Created
September 20, 2017 18:56
-
-
Save anonymous/74ad1b4c08545a42c24a0c8e562dea64 to your computer and use it in GitHub Desktop.
Liquibase computed map variables.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# liquibase.sls (pillar) | |
######################## | |
liquibase: | |
version: 3.1.1 | |
checksum: 91c237126ad37703e8e04bb49235044c | |
url: 'https://github.com/liquibase/liquibase/releases/download/liquibase-parent-{0}/liquibase-{0}-bin.tar.gz' | |
install_root: /opt | |
jdbc_drivers: | |
postgres: | |
url: https://jdbc.postgresql.org/download/postgresql-42.1.4.jar | |
checksum: 412b760d4a114aff550a0374f09f15f9 | |
# map.jinja | |
########### | |
# vim: ft=jinja | |
# This file handles the merging of pillar data with the data from defaults | |
{# Start with defaults from defaults.yml #} | |
{% import_yaml 'liquibase/defaults.yml' as default_settings %} | |
{# | |
Setup variable using grains['os_family'] based logic, only add key:values here | |
that differ from whats in defaults.yml | |
#} | |
{% set os_family_map = salt['grains.filter_by']({ | |
'Debian': {}, | |
'Suse': {}, | |
'Arch': {}, | |
'RedHat': {}, | |
} | |
, grain="os_family" | |
, merge=salt['pillar.get']('liquibase:lookup')) | |
%} | |
{# Merge the flavor_map to the default settings #} | |
{% do default_settings.liquibase.update(os_family_map) %} | |
{% do default_settings.liquibase.update(computed_vars) %} | |
{# Merge in template:lookup pillar #} | |
{% set liquibase = salt['pillar.get']( | |
'liquibase', | |
default=default_settings.liquibase, | |
merge=True | |
) | |
%} | |
{# | |
Computed variables should go here | |
#} | |
{% do liquibase.install_path = '{0}/liquibase-{1}'.format(liquibase.install_root, liquibase.version) %} | |
{% if 'postgres' in liquibase.get('jdbc_drivers', {}) %} | |
{% do liquibase.jdbc_drivers.postgres.postgres_jar = salt.file.basename(liquibase.jdbc_drivers.postgres.url) %} | |
{% endif %} | |
# error | |
####### | |
minion_50: | |
Data failed to compile: | |
---------- | |
Rendering SLS 'base:liquibase' failed: Jinja syntax error: expected token 'end of statement block', got '=' | |
/var/cache/salt/minion/files/base/liquibase/map.jinja(38): | |
--- | |
[...] | |
{# | |
Computed variables should go here | |
#} | |
{% do liquibase.install_path = '{0}/liquibase-{1}'.format(liquibase.install_root, liquibase.version) %} <====================== | |
{% if 'postgres' in liquibase.get('jdbc_drivers', {}) %} | |
{% do liquibase.jdbc_drivers.postgres.postgres_jar = salt.file.basename(liquibase.jdbc_drivers.postgres.url)%} | |
{% endif %} | |
--- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment