Skip to content

Commit

Permalink
Create the code-submitter database if missing
Browse files Browse the repository at this point in the history
This ensures that the database can be re-created if it's been
removed (as we do between SR years), even if the code hasn't changed.

Fixes #58.
  • Loading branch information
PeterJCLaw committed Sep 23, 2024
1 parent c06715e commit 2798286
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion roles/code-submitter/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
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:
Expand All @@ -86,7 +91,7 @@
environment:
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

Check warning on line 94 in roles/code-submitter/tasks/main.yml

View workflow job for this annotation

GitHub Actions / ansible

94:64 [comments] too few spaces before comment

- name: Enable service
service:
Expand Down

0 comments on commit 2798286

Please sign in to comment.