Skip to content

Commit

Permalink
Merge branch 'fix-code-submitter-db-creation'
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJCLaw committed Sep 25, 2024
2 parents d143393 + 2680c4f commit 97c2edc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions roles/code-submitter/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,22 @@
notify:
Reload nginx

- name: Check if database exists
shell: test -f "{{ install_dir }}/sqlite.db" || echo "Missing"
register: detect_database
changed_when: detect_database.stdout.startswith("Missing")

- name: Install database # noqa: no-changed-when - We want to always run this (it handles its own idempotency)
shell: # noqa: command-instead-of-shell - We need this to use `environment`
argv:
- "{{ venv_dir }}/bin/alembic"
- upgrade
- head
chdir: /srv/code-submitter
chdir: "{{ install_dir }}"
environment:
PYTHONPATH: /srv/code-submitter
PYTHONPATH: "{{ install_dir }}"
become_user: www-data
when: code_submitter_repo.changed # noqa: no-handler - Use a handler to ensure execution order
when: code_submitter_repo.changed or detect_database.changed # noqa: no-handler - Use a handler to ensure execution order

- name: Enable service
service:
Expand Down

0 comments on commit 97c2edc

Please sign in to comment.