Skip to content

Commit

Permalink
Port galaxyproject/ansible-galaxy#152 from standalone role
Browse files Browse the repository at this point in the history
  • Loading branch information
natefoo committed May 31, 2022
1 parent 0940632 commit ac1f89b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions roles/database/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,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 @@ -22,10 +25,18 @@
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"

0 comments on commit ac1f89b

Please sign in to comment.