From 223fe988aa0c31f64dc6f2c67fbc4ce9e4bf7640 Mon Sep 17 00:00:00 2001 From: Yanis Guenane Date: Tue, 25 May 2021 15:25:03 +0200 Subject: [PATCH] Do not shadow other variables --- .../installer/tasks/admin_password_configuration.yml | 4 ++-- .../tasks/broadcast_websocket_configuration.yml | 4 ++-- roles/installer/tasks/database_configuration.yml | 2 +- roles/installer/tasks/secret_key_configuration.yml | 4 ++-- roles/installer/tasks/update_status.yml | 4 ++-- roles/installer/templates/postgres.yaml.j2 | 12 ++++++------ 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/roles/installer/tasks/admin_password_configuration.yml b/roles/installer/tasks/admin_password_configuration.yml index c32b91ba..7de3c0fa 100644 --- a/roles/installer/tasks/admin_password_configuration.yml +++ b/roles/installer/tasks/admin_password_configuration.yml @@ -35,8 +35,8 @@ - name: Set admin password secret set_fact: - admin_password_secret: '{{ _generated_admin_password["resources"] | default([]) | length | ternary(_generated_admin_password, _admin_password_secret) }}' + __admin_password_secret: '{{ _generated_admin_password["resources"] | default([]) | length | ternary(_generated_admin_password, _admin_password_secret) }}' - name: Store admin password set_fact: - admin_password: "{{ admin_password_secret['resources'][0]['data']['password'] | b64decode }}" + admin_password: "{{ __admin_password_secret['resources'][0]['data']['password'] | b64decode }}" diff --git a/roles/installer/tasks/broadcast_websocket_configuration.yml b/roles/installer/tasks/broadcast_websocket_configuration.yml index 415affe4..4060a382 100644 --- a/roles/installer/tasks/broadcast_websocket_configuration.yml +++ b/roles/installer/tasks/broadcast_websocket_configuration.yml @@ -37,8 +37,8 @@ - name: Set broadcast websocket secret set_fact: # yamllint disable-line rule:line-length - broadcast_websocket_secret: '{{ _generated_broadcast_websocket["resources"] | default([]) | length | ternary(_generated_broadcast_websocket, _broadcast_websocket_secret) }}' # noqa 204 + __broadcast_websocket_secret: '{{ _generated_broadcast_websocket["resources"] | default([]) | length | ternary(_generated_broadcast_websocket, _broadcast_websocket_secret) }}' # noqa 204 - name: Store broadcast websocket secret name set_fact: - broadcast_websocket_secret_value: "{{ broadcast_websocket_secret['resources'][0]['data']['secret'] | b64decode }}" + broadcast_websocket_secret_value: "{{ __broadcast_websocket_secret['resources'][0]['data']['secret'] | b64decode }}" diff --git a/roles/installer/tasks/database_configuration.yml b/roles/installer/tasks/database_configuration.yml index 667f1ae6..167d4589 100644 --- a/roles/installer/tasks/database_configuration.yml +++ b/roles/installer/tasks/database_configuration.yml @@ -66,7 +66,7 @@ - name: Set actual postgres configuration secret used set_fact: - postgres_configuration_secret: "{{ pg_config['resources'][0]['metadata']['name'] }}" + __postgres_configuration_secret: "{{ pg_config['resources'][0]['metadata']['name'] }}" - block: - name: Create Database if no database is specified diff --git a/roles/installer/tasks/secret_key_configuration.yml b/roles/installer/tasks/secret_key_configuration.yml index b517a56b..eeefa8eb 100644 --- a/roles/installer/tasks/secret_key_configuration.yml +++ b/roles/installer/tasks/secret_key_configuration.yml @@ -35,8 +35,8 @@ - name: Set secret key secret set_fact: - secret_key_secret: '{{ _generated_secret_key["resources"] | default([]) | length | ternary(_generated_secret_key, _secret_key_secret) }}' + __secret_key_secret: '{{ _generated_secret_key["resources"] | default([]) | length | ternary(_generated_secret_key, _secret_key_secret) }}' - name: Store secret key secret name set_fact: - secret_key_secret_name: "{{ secret_key_secret['resources'][0]['metadata']['name'] }}" + secret_key_secret_name: "{{ __secret_key_secret['resources'][0]['metadata']['name'] }}" diff --git a/roles/installer/tasks/update_status.yml b/roles/installer/tasks/update_status.yml index 4753fe21..bb0a2d3f 100644 --- a/roles/installer/tasks/update_status.yml +++ b/roles/installer/tasks/update_status.yml @@ -6,7 +6,7 @@ name: "{{ meta.name }}" namespace: "{{ meta.namespace }}" status: - adminPasswordSecret: "{{ admin_password_secret['resources'][0]['metadata']['name'] }}" + adminPasswordSecret: "{{ __admin_password_secret['resources'][0]['metadata']['name'] }}" - name: Update admin user status operator_sdk.util.k8s_status: @@ -33,7 +33,7 @@ name: "{{ meta.name }}" namespace: "{{ meta.namespace }}" status: - broadcastWebsocketSecret: "{{ broadcast_websocket_secret['resources'][0]['metadata']['name'] }}" + broadcastWebsocketSecret: "{{ __broadcast_websocket_secret['resources'][0]['metadata']['name'] }}" - name: Update secret key status operator_sdk.util.k8s_status: diff --git a/roles/installer/templates/postgres.yaml.j2 b/roles/installer/templates/postgres.yaml.j2 index c5994b77..d5b5ee1c 100644 --- a/roles/installer/templates/postgres.yaml.j2 +++ b/roles/installer/templates/postgres.yaml.j2 @@ -42,34 +42,34 @@ spec: - name: POSTGRESQL_DATABASE valueFrom: secretKeyRef: - name: '{{ postgres_configuration_secret }}' + name: '{{ __postgres_configuration_secret }}' key: database - name: POSTGRESQL_USER valueFrom: secretKeyRef: - name: '{{ postgres_configuration_secret }}' + name: '{{ __postgres_configuration_secret }}' key: username - name: POSTGRESQL_PASSWORD valueFrom: secretKeyRef: - name: '{{ postgres_configuration_secret }}' + name: '{{ __postgres_configuration_secret }}' key: password # For postgres_image based on postgres - name: POSTGRES_DB valueFrom: secretKeyRef: - name: '{{ postgres_configuration_secret }}' + name: '{{ __postgres_configuration_secret }}' key: database - name: POSTGRES_USER valueFrom: secretKeyRef: - name: '{{ postgres_configuration_secret }}' + name: '{{ __postgres_configuration_secret }}' key: username - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: - name: '{{ postgres_configuration_secret }}' + name: '{{ __postgres_configuration_secret }}' key: password - name: PGDATA value: '{{ postgres_data_path }}'