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

Check for both alembic and SQLAlchemy Migrate errors #152

Merged
merged 2 commits into from
Apr 15, 2022
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
17 changes: 14 additions & 3 deletions tasks/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
chdir: "{{ galaxy_server_dir }}"
register: current_db_version
changed_when: no
failed_when: current_db_version.rc != 0 and 'migrate.exceptions.DatabaseNotControlledError' not in current_db_version.stderr
failed_when:
- current_db_version.rc != 0
- "'migrate.exceptions.DatabaseNotControlledError' not in current_db_version.stderr"
- "'galaxy.model.migrations.NoVersionTableError' not in current_db_version.stderr"
when: not ansible_check_mode

- name: Get maximum Galaxy DB version
Expand All @@ -25,13 +28,21 @@
debug:
msg: "Current database version is {{ current_db_version.stdout }} and the maximum version is {{ max_db_version.stdout }}."
changed_when: True
when: "(not ansible_check_mode) and (current_db_version.stdout != max_db_version.stdout and 'migrate.exceptions.DatabaseNotControlledError' not in current_db_version.stderr)"
when:
- not ansible_check_mode
- current_db_version.stdout != max_db_version.stdout
- "'migrate.exceptions.DatabaseNotControlledError' not in current_db_version.stderr"
- "'galaxy.model.migrations.NoVersionTableError' not in current_db_version.stderr"

- name: Upgrade Galaxy DB
command: "{{ galaxy_venv_dir }}/bin/python {{ galaxy_server_dir }}/scripts/manage_db.py -c {{ galaxy_config_file }} upgrade"
args:
chdir: "{{ galaxy_server_dir }}"
when: "(not ansible_check_mode) and current_db_version.stdout != max_db_version.stdout and 'migrate.exceptions.DatabaseNotControlledError' not in current_db_version.stderr"
when:
- not ansible_check_mode
- current_db_version.stdout != max_db_version.stdout
- "'migrate.exceptions.DatabaseNotControlledError' not in current_db_version.stderr"
- "'galaxy.model.migrations.NoVersionTableError' not in current_db_version.stderr"

remote_user: "{{ galaxy_remote_users.galaxy | default(__galaxy_remote_user) }}"
become: "{{ true if galaxy_become_users.galaxy is defined else __galaxy_become }}"
Expand Down