Replace lockfile by oslo_concurrency

This drops lockfile in favor of oslo_concurrency in order to unify
Horizon with the rest of the OpenStack projects.

Change-Id: I245fa3ca3926c279cb760f1d4530c511b140a8ea
This commit is contained in:
Julien Danjou 2015-01-20 14:08:47 +01:00
parent 27ccf91997
commit 366f9527e6
2 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ import os
import random
import string
import lockfile
from oslo_concurrency import lockutils
class FilePermissionError(Exception):
@ -48,7 +48,9 @@ def generate_or_read_from_file(key_file='.secret_key', key_length=64):
environment). Also checks if file permissions are set correctly and
throws an exception if not.
"""
lock = lockfile.FileLock(key_file)
abspath = os.path.abspath(key_file)
lock = lockutils.external_lock(key_file + ".lock",
lock_path=os.path.dirname(abspath))
with lock:
if not os.path.exists(key_file):
key = generate_key(key_length)

View File

@ -19,10 +19,8 @@ eventlet>=0.15.2
httplib2>=0.7.5
iso8601>=0.1.9
kombu>=2.5.0
# Horizon Utility Requirements
# for SECURE_KEY generation
lockfile>=0.8
netaddr>=0.7.12
oslo.concurrency>=1.4.1 # Apache-2.0
oslo.config>=1.6.0 # Apache-2.0
oslo.i18n>=1.0.0 # Apache-2.0
oslo.serialization>=1.2.0 # Apache-2.0