~openstack-charmers-next/charms/wily/swift-proxy/trunk

« back to all changes in this revision

Viewing changes to lib/swift_context.py

  • Committer: James Page
  • Date: 2016-05-23 09:08:57 UTC
  • Revision ID: james.page@ubuntu.com-20160523090857-857yk8sjk9atjmb0
Use JUJU_MODEL_UUID for Juju 2.0

Juju 2.0 renames the environment variable JUJU_ENV_UUID
to JUJU_MODEL_UUID; use this environment variable as a
fallback if JUJU_ENV_UUID is not set to support Juju 2.0,
whilst continuing to provide support for Juju < 2.0.

Change-Id: I26ae366c84d3cd9a9c2471385effd2a6202e9314
Closes-Bug: 1572575

Show diffs side-by-side

added added

removed removed

Lines of Context:
202
202
        with open(SWIFT_HASH_FILE, 'w') as hashfile:
203
203
            hashfile.write(swift_hash)
204
204
    else:
205
 
        swift_hash = str(uuid.uuid3(uuid.UUID(os.environ.get("JUJU_ENV_UUID")),
 
205
        model_uuid = os.environ.get("JUJU_ENV_UUID",
 
206
                                    os.environ.get("JUJU_MODEL_UUID"))
 
207
        swift_hash = str(uuid.uuid3(uuid.UUID(model_uuid),
206
208
                                    service_name()))
207
209
        with open(SWIFT_HASH_FILE, 'w') as hashfile:
208
210
            hashfile.write(swift_hash)