From 3626799a84d142923dd53c69f72dedba9a25f3a8 Mon Sep 17 00:00:00 2001 From: Timid Robot Zehta Date: Thu, 8 Oct 2020 16:57:58 +0000 Subject: [PATCH] update stage pod logic to use startswith --- states/nginx/cclicdev.sls | 4 ++-- states/nginx/dispatch.sls | 4 ++-- states/nginx/files/cclicdev_tls_template | 2 +- states/nginx/files/dispatch_tls_template | 2 +- states/postfix/files/main.cf | 2 +- states/postfix/init.sls | 4 ++-- states/wordpress/files/composer-wp-config.php | 2 +- states/wordpress/init.sls | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/states/nginx/cclicdev.sls b/states/nginx/cclicdev.sls index c52662e4..1a8d5ab4 100644 --- a/states/nginx/cclicdev.sls +++ b/states/nginx/cclicdev.sls @@ -22,7 +22,7 @@ include: - service: nginx service -{%- if pillar.pod == "stage" %} +{%- if pillar.pod.startswith("stage") %} {{ sls }} installed packages: @@ -67,7 +67,7 @@ include: SLS: {{ sls }} - require: - pkg: nginx installed packages -{%- if pillar.pod == "stage" %} +{%- if pillar.pod.startswith("stage") %} - webutil: {{ sls }} basic authentication user exists {%- endif %} - watch_in: diff --git a/states/nginx/dispatch.sls b/states/nginx/dispatch.sls index f793f18c..4e9475fa 100644 --- a/states/nginx/dispatch.sls +++ b/states/nginx/dispatch.sls @@ -24,7 +24,7 @@ include: - service: nginx service -{%- if pillar.pod == "stage" %} +{%- if pillar.pod.startswith("stage") %} {{ sls }} installed packages: @@ -68,7 +68,7 @@ include: SLS: {{ sls }} - require: - pkg: nginx installed packages -{%- if pillar.pod == "stage" %} +{%- if pillar.pod.startswith("stage") %} - webutil: {{ sls }} basic authentication user exists {%- endif %} - watch_in: diff --git a/states/nginx/files/cclicdev_tls_template b/states/nginx/files/cclicdev_tls_template index d0f0e573..ee53a3e2 100644 --- a/states/nginx/files/cclicdev_tls_template +++ b/states/nginx/files/cclicdev_tls_template @@ -12,7 +12,7 @@ server { server_name {{ CERT_NAME }}; ssl_certificate /etc/letsencrypt/live/{{ CERT_NAME }}/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/{{ CERT_NAME }}/privkey.pem; -{%- if pillar.pod == "stage" %} +{%- if pillar.pod.startswith("stage") %} auth_basic "Staging Environment Restricted"; auth_basic_user_file /etc/nginx/htpasswd; {%- endif %} diff --git a/states/nginx/files/dispatch_tls_template b/states/nginx/files/dispatch_tls_template index 3e84b655..0c432de7 100644 --- a/states/nginx/files/dispatch_tls_template +++ b/states/nginx/files/dispatch_tls_template @@ -11,7 +11,7 @@ server { json_debug buffer=32k flush=2s; ssl_certificate /etc/letsencrypt/live/{{ CERT_NAME }}/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/{{ CERT_NAME }}/privkey.pem; -{%- if pillar.pod == "stage" %} +{%- if pillar.pod.startswith("stage") %} auth_basic "Staging Environment Restricted"; auth_basic_user_file /etc/nginx/htpasswd; {%- endif %} diff --git a/states/postfix/files/main.cf b/states/postfix/files/main.cf index 88fffafb..34d180af 100644 --- a/states/postfix/files/main.cf +++ b/states/postfix/files/main.cf @@ -34,6 +34,6 @@ smtpd_helo_required = yes smtpd_tls_ciphers = $smtp_tls_ciphers smtpd_tls_dh1024_param_file = /etc/ssl/private/dhparams.pem smtpd_tls_exclude_ciphers = $smtp_tls_exclude_ciphers -{%- if pillar.pod == "stage" %} +{%- if pillar.pod.startswith("stage") %} transport_maps = hash:/etc/postfix/transport {%- endif %} diff --git a/states/postfix/init.sls b/states/postfix/init.sls index ac895838..9ced453e 100644 --- a/states/postfix/init.sls +++ b/states/postfix/init.sls @@ -37,9 +37,9 @@ include: {{ pf.install_alias(sls, "0444", "/etc/aliases", "aliases") -}} {{ pf.install_map(sls, "0400", "/etc/postfix/sasl_passwd", "sasl_passwd") -}} -{% if pillar.hst == "cclicdev" and pillar.pod == "stage" -%} +{% if pillar.hst == "cclicdev" and pillar.pod.startswith("stage") -%} {{ pf.install_map(sls, "0400", "/etc/postfix/transport", "transport_stage_caktus") -}} -{% elif pillar.pod == "stage" -%} +{% elif pillar.pod.startswith("stage") -%} {{ pf.install_map(sls, "0400", "/etc/postfix/transport", "transport_stage") -}} {% endif -%} diff --git a/states/wordpress/files/composer-wp-config.php b/states/wordpress/files/composer-wp-config.php index 991e7241..78f06d74 100644 --- a/states/wordpress/files/composer-wp-config.php +++ b/states/wordpress/files/composer-wp-config.php @@ -74,7 +74,7 @@ #define('DISALLOW_FILE_MODS', True); # Plugin: Jetpack -{%- if POD == "stage" %} +{%- if POD.startswith("stage") %} define( 'JETPACK_DEV_DEBUG', True ); {%- else %} define( 'JETPACK_DEV_DEBUG', False ); diff --git a/states/wordpress/init.sls b/states/wordpress/init.sls index 8dd50c49..436b16c2 100644 --- a/states/wordpress/init.sls +++ b/states/wordpress/init.sls @@ -172,7 +172,7 @@ include: - composer: /usr/local/bin/composer - php: /usr/bin/php - optimize: True -{%- if POD == "stage" %} +{%- if POD.startswith("stage") %} - no_dev: False {%- else %} - no_dev: True