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 bb4947f + be8f01e commit 15a5328
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions roles/code-submitter/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
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")
stat:
path: "{{ install_dir }}/sqlite.db"
register: database_file

- 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`
Expand All @@ -91,7 +91,10 @@
environment:
PYTHONPATH: "{{ install_dir }}"
become_user: www-data
when: code_submitter_repo.changed or detect_database.changed # noqa: no-handler - Use a handler to ensure execution order
when: |
code_submitter_repo.changed or
database_file.stat.isreg is not defined or
not database_file.stat.isreg
- name: Enable service
service:
Expand Down

0 comments on commit 15a5328

Please sign in to comment.