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

Create the code-submitter database if missing #76

Merged
merged 4 commits into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions roles/code-submitter/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,25 @@
notify:
Reload nginx

- name: Check if database exists
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`
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
database_file.stat.isreg is not defined or
RealOrangeOne marked this conversation as resolved.
Show resolved Hide resolved
not database_file.stat.isreg

- name: Enable service
service:
Expand Down
Loading