Drupal Charm from documentation should exit 0 when related host is not up

Bug #885297 reported by Danny Tamez
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyjuju
Triaged
Low
Unassigned
Juju Charms Collection
Invalid
Undecided
Unassigned

Bug Description

When the relationship is created between drupal and mysql drupal should fail if the mysql host is not yet available. This is similar to other charms that exit 0 when this condition is encountered. The log below shows that the drupal charm continued even though there was no host.

2011-11-02 10:44:06,592 unit:drupal/0: hook.output ERROR: + hooksdir=/var/lib/juju/units/drupal-0/charm

2011-11-02 10:44:06,593 unit:drupal/0: hook.output ERROR: ++ relation-get user

2011-11-02 10:44:06,785 unit:drupal/0: hook.output ERROR: + user=drupal

2011-11-02 10:44:06,786 unit:drupal/0: hook.output ERROR: ++ relation-get password

2011-11-02 10:44:06,961 unit:drupal/0: hook.output ERROR: + password=sahbeeghos

2011-11-02 10:44:06,961 unit:drupal/0: hook.output ERROR: ++ relation-get host

2011-11-02 10:44:07,135 unit:drupal/0: hook.output ERROR: + host=

2011-11-02 10:44:07,136 unit:drupal/0: hook.output ERROR: ++ relation-get database

2011-11-02 10:44:07,310 unit:drupal/0: hook.output ERROR: + database=drupal
+ '[' -z drupal ']'

2011-11-02 10:44:07,312 unit:drupal/0: hook.output ERROR: ++ grep -q users

2011-11-02 10:44:07,312 unit:drupal/0: hook.output ERROR: ++ mysql -u drupal --password=sahbeeghos -h -e 'use drupal; show tables;'

2011-11-02 10:44:07,392 unit:drupal/0: hook.output ERROR: ERROR 2005 (HY000): Unknown MySQL server host '-e' (1)

2011-11-02 10:44:07,394 unit:drupal/0: hook.output ERROR: + juju-log 'Setting up Drupal for the first time'

Revision history for this message
Danny Tamez (zematynnad) wrote :

Here is the url for the docs: https://juju.ubuntu.com/docs/write-charm.html

summary: - Drupal Charm should exit 0 when related host is not up
+ Drupal Charm from documentation should exit 0 when related host is not
+ up
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

I was watching as Danny ran into this, while deploying the example drupal charm from the docs, it failed because it did not handle the situation where it hadn't received the remote host name yet from mysql.

Changed in charm:
status: New → Invalid
Changed in juju:
status: New → Triaged
importance: Undecided → Medium
milestone: none → florence
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

This isn't a juju bug but a charm bug afaics.

Changed in juju:
status: Triaged → Invalid
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Kapil, the charm in question is *in the official documentation*.

Changed in juju:
status: Invalid → Confirmed
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

ah.. thanks clint, looks like it needs
s/host=`relation-get host`/host=`relation-get private-address`

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Thats one way to look at it, though it may also need to convey that some values may not be set, and that should be handled gracefully by exitting.. I haven't looked at the charm in a while so I'm not sure if the other values are handled properly.

Changed in juju:
milestone: florence → galapagos
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

This is only docs related, so no milestone needed.

Changed in juju:
milestone: galapagos → none
Curtis Hovey (sinzui)
Changed in juju:
status: Confirmed → Triaged
Curtis Hovey (sinzui)
Changed in juju:
importance: Medium → Low
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.