~charmers/charms/precise/rabbitmq-server/trunk

« back to all changes in this revision

Viewing changes to hooks/lib/openstack_common.py

[ahasenack]

Use CHARM_DIR instead of a hardcoded path for the local charm directory.
This makes this charm compatible with both pyjuju and juju-core, where it was broken before.

Show diffs side-by-side

added added

removed removed

Lines of Context:
221
221
    updated config information necessary to perform health checks or
222
222
    service changes.
223
223
    """
224
 
    unit_name = os.getenv('JUJU_UNIT_NAME').replace('/', '-')
225
 
    juju_rc_path = "/var/lib/juju/units/%s/charm/%s" % (unit_name, script_path)
 
224
    charm_dir = os.getenv('CHARM_DIR')
 
225
    juju_rc_path = "%s/%s" % (charm_dir, script_path)
226
226
    with open(juju_rc_path, 'wb') as rc_script:
227
227
        rc_script.write(
228
228
            "#!/bin/bash\n")