Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle pulp_settings merging better #25

Open
rooftopcellist opened this issue Feb 13, 2024 · 0 comments
Open

Handle pulp_settings merging better #25

rooftopcellist opened this issue Feb 13, 2024 · 0 comments

Comments

@rooftopcellist
Copy link
Member

Is your feature request related to a problem? Please describe.

Currently, there is a potential for the tasks that combine pulp_settings to fail if the common role has not completed. This is because in pulp.yml, we reference pg variables that are not set until the postgres_configuration_secret is read in. This results in an error like this:

TASK [pulp-web : Combining pulp_settings] **************************************\r\n\u001b[1;30mtask path: /opt/ansible/roles/pulp-web/tasks/main.yml:9\u001b[0m\n\u001b[0;31mfatal: [localhost]: FAILED! => {\"msg\": \"The task includes an option with an undefined variable. The error was: {'api_root': '/api/galaxy/pulp/', 'cache_enabled': True, 'db_encryption_key': '/etc/pulp/keys/database_fields.symmetric.key', 'galaxy_collection_signing_service': 'ansible-default', 'galaxy_container_signing_service': 'container-default', 'ansible_certs_dir': '/etc/pulp/keys/', 'databases': {'default': {'HOST': '{{ postgres_host }}', 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': '{{ postgres_database }}', 'USER': '{{ postgres_user }}', 'PASSWORD': '{{ postgres_pass }}', 'PORT': '{{ postgres_port }}', 'CONN_MAX_AGE': 0, 'OPTIONS': {'sslmode': '{{ postgres_sslmode }}'}}}, 'static_root': '/app/galaxy_ng/app/static/', 'redis_host': '{{ ansible_operator_meta.name }}-redis-svc', 'redis_port': 6379, 'redis_password': ''}: 'postgres_host' is undefined

Describe the solution you'd like

We should combine these variables after the postgres configuration secret is set inside the common role rather than templating them like this:

      databases:
        default:
          HOST: "{{ postgres_host }}"
          ENGINE: django.db.backends.postgresql_psycopg2
          NAME: "{{ postgres_database }}"
          USER: "{{ postgres_user }}"
          PASSWORD: "{{ postgres_pass }}"
          PORT: "{{ postgres_port }}"
          CONN_MAX_AGE: 0
          OPTIONS:
            sslmode: '{{ postgres_sslmode }}'

Describe alternatives you've considered
We could re-order the roles so that the likelyhood that this is hit is lower. That is what I have done for now.

Additional context

Follow-up work after #24 merges

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant