Mariadb (but possibly other MySQL-like charms) failed relation hook

Bug #1401971 reported by Martijn Evers
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mariadb (Juju Charms Collection)
Fix Released
Undecided
Martijn Evers

Bug Description

Some relation-changed hooks of the 'cs:trusty/mariadb-0' charm (and possibly other MySQL-like charms) exit with a non-zero state if a database is created with a particular name. In my case I was running the 'shared-db-relation-changed' hook with this 'relation-get' output:

acl-test_database: acl-test
acl-test_hostname: my-local-machine-9
acl-test_username: acl-test
cloud-test_database: cloud-test
cloud-test_hostname: my-local-machine-9
cloud-test_username: cloud-test
private-address: 10.0.3.192

This resulted in this python traceback:
Traceback (most recent call last):
  File "hooks/shared-db-relation-changed", line 140, in <module>
    utils.do_hooks(hooks)
  File "/var/lib/juju/agents/unit-mariadb-0/charm/hooks/lib/utils.py", line 28, in do_hooks
    hook_func()
  File "hooks/shared-db-relation-changed", line 128, in shared_db_changed
    databases[db]['username'])
  File "hooks/shared-db-relation-changed", line 61, in configure_db
    create_database(database)
  File "/var/lib/juju/agents/unit-mariadb-0/charm/hooks/common.py", line 79, in create_database
    cursor.execute("CREATE DATABASE {}".format(db_name))
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-test' at line 1")

As seen here, on line 79 of 'common.py' a database is created without quoting the identifier. Both database names have an minus sign before 'test' and must be quoted.

Revision history for this message
Review Queue (review-queue) wrote : Automated Test Results: Mariadb (but possibly other MySQL-like charms) failed relation hook

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-10806-results

Revision history for this message
Martijn Evers (mevers) wrote :

Can we run the automated test again? It seems like the test failed because of this:
The environment did not setup in 1200 seconds.

Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-10851-results

Revision history for this message
Martijn Evers (mevers) wrote :

I think there is a problem with the "10-deploy-test.py" test. The report Review Queue posted on 20 December failed on a single point; the environment wasn't spinning up or was too slow. But all other tests succeed. Now it seems all "10-deploy-test.py" failed while no code was changed. Is this a bug in 10-deploy-test.py?

Marco Ceppi (marcoceppi)
affects: charms → mariadb (Juju Charms Collection)
Marco Ceppi (marcoceppi)
Changed in mariadb (Juju Charms Collection):
status: New → Fix Released
assignee: nobody → tuXzero (martijn4evers)
Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-10866-results

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.