unit addresses

Kapil Thangavelu kapil.thangavelu at canonical.com
Wed Oct 5 00:07:09 UTC 2011


Hi Folks,

I wanted inform the charm developer community about some important (and 
backwards compatible) changes to handling addresses in units and charms that 
came out from the local provider work.

0) Units now have public and private addresses associated to them.

1) Unit relation settings are now prepopulated with the unit's 'private-address'
   Hooks no longer need to populate this information explicitly to communicate
   to a related service. As an example a  wordpress charm can get the address 
   for its associated mysql service by simply doing (assuming mysql just joined 
   the relation)
   
   via.

    db_address=`relation-get private-address`

   in its db relation hooks. This obviates a common usage of 'relation-get' or 
   'relation-set' in hooks. These values are populated before the unit joins the 
   relation.

2) Hooks now have access to their unit's public and private address in a 
provider independent fashion through a new hook cli api, called unit-get

  A wordpress charm for example can obtain public address (for an apache vhost) 
  via.

    public_address=`unit-get public-address`

  The unit-get command also returns values for  'private-address'.

The example formulas have been updated to use these new mechanisms.


cheers,

Kapil



More information about the Juju mailing list