def get_swift_hash():
if os.path.isfile(SWIFT_HASH_FILE):
with open(SWIFT_HASH_FILE, 'r') as hashfile:
swift_hash = hashfile.read().strip()
elif config('swift-hash'):
swift_hash = config('swift-hash')
with open(SWIFT_HASH_FILE, 'w') as hashfile:
hashfile.write(swift_hash)
else:
model_uuid = os.environ.get("JUJU_ENV_UUID",
os.environ.get("JUJU_MODEL_UUID"))
swift_hash = str(uuid.uuid3(uuid.UUID(model_uuid),
service_name()))
with open(SWIFT_HASH_FILE, 'w') as hashfile:
hashfile.write(swift_hash)
return swift_hash
评论列表
文章目录