Skip to content

Commit

Permalink
Fix handling in case no secret key has been defined or it is null in …
Browse files Browse the repository at this point in the history
…the current config
  • Loading branch information
Thulium-Drake committed Sep 7, 2023
1 parent 32eede7 commit 5fd69b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions roles/ara_api/tasks/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@
ara_api_secret_key: "{{ config[ara_api_env]['SECRET_KEY'] }}"
no_log: "{{ ara_api_secure_logging }}"

# If no secret key has been provided and this is the first time we are
# running, generate a new random secret key that will be persisted in the
# If no secret key has been provided or it is not present in the current
# configuration, generate a new random secret key that will be persisted in the
# configuration file.
- when:
- ara_api_secret_key is none
- not settings_stat.stat.exists
- ara_api_secret_key is none or ara_api_secret_key == ''
block:
- name: Generate a random secret key
command: tr -dc A-Za-z0-9 </dev/urandom | head -c 50 ; echo ''
shell: |
set -o pipefail
tr -dc A-Za-z0-9 </dev/urandom | head -c 50 ; echo ''
no_log: "{{ ara_api_secure_logging }}"
register: generated_key

Expand Down
1 change: 1 addition & 0 deletions roles/ara_api/tasks/install/podman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
You seem to have ARA-API installed via PyPI in the past, if you like
this role can clean up that installation and migrate your data to the Podman
installation, by setting ara_api_migrate_to_podman to true
when: existing_pypi_install['stat']['exists']

- name: 'Remove PyPI installation and migrate data'
when: ara_api_migrate_to_podman
Expand Down

0 comments on commit 5fd69b9

Please sign in to comment.