Commit a8df35ce by Clinton Blackburn

Updated country population task for ecommerce

We now make use of the management command's initial-only flag silently exit if the countries table is already populated.

ECOM-7422
parent 3ed5bca7
......@@ -83,19 +83,12 @@
- migrate:db
- name: Populate countries
shell: "DB_MIGRATION_USER={{ COMMON_MYSQL_MIGRATE_USER }} DB_MIGRATION_PASS={{ COMMON_MYSQL_MIGRATE_PASS }} {{ ecommerce_venv_dir }}/bin/python ./manage.py oscar_populate_countries"
shell: "DB_MIGRATION_USER={{ COMMON_MYSQL_MIGRATE_USER }} DB_MIGRATION_PASS={{ COMMON_MYSQL_MIGRATE_PASS }} {{ ecommerce_venv_dir }}/bin/python ./manage.py oscar_populate_countries --initial-only"
args:
chdir: "{{ ecommerce_code_dir }}"
become_user: "{{ ecommerce_user }}"
environment: "{{ ecommerce_environment }}"
when: migrate_db is defined and migrate_db|lower == "yes"
# the `register` and `failed_when` directives below are here to emulate idempotency for this oscar command.
# if and when https://github.com/django-oscar/django-oscar/pull/1841 is merged, the directives can be removed
# in favor of the (proposed) --initial-only command option.
register: command_result
failed_when:
- "'You already have countries in your database' not in command_result.stderr"
- "command_result.rc != 0"
tags:
- migrate
- migrate:db
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment