From 4f3430ebebc4bfb2bacb76ec505497e9f71ab33d Mon Sep 17 00:00:00 2001 From: Will Thames Date: Sun, 15 Nov 2015 10:45:24 +1000 Subject: [PATCH] Handle unexpected database presence Check for database presence in a nice way, rather than dropping the database. Thankfully there was a syntax error in the previous version, so no database would have been dropped. There was no check for whether it succeeded or not. --- test/integration/roles/test_mysql_db/tasks/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/integration/roles/test_mysql_db/tasks/main.yml b/test/integration/roles/test_mysql_db/tasks/main.yml index a059cd212a8..1c2adcce8eb 100644 --- a/test/integration/roles/test_mysql_db/tasks/main.yml +++ b/test/integration/roles/test_mysql_db/tasks/main.yml @@ -19,8 +19,9 @@ # ============================================================ - name: make sure the test database is not there - command: mysql "-e drop database '{{db_name}}';" - ignore_errors: True + command: mysql {{db_name}} + register: mysql_db_check + failed_when: "'1049' not in mysql_db_check.stderr" - name: test state=present for a database name (expect changed=true) mysql_db: name={{ db_name }} state=present