diff options
author | Caroline Tice <cmtice@google.com> | 2015-10-14 11:24:09 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-10-15 18:08:30 -0700 |
commit | 6a00af9872c9d25a685ff5dc8efdaaeef37fc269 (patch) | |
tree | de62c30a0ecba31a2cc19baa8f797fba47fa28d6 /file_lock_machine.py | |
parent | 515533979584c2d763bed2a0f79255c5fa4da5e7 (diff) | |
download | toolchain-utils-6a00af9872c9d25a685ff5dc8efdaaeef37fc269.tar.gz |
Move LOCKS_DIR out of NFS file directory.
This changes the default LOCKS_DIR, for file locking, from the
role account's NFS directory to /google/data. It also updates the
file masks to meet the requirements of the new directory.
BUG=18379210
TEST=Tested from my home account.
Change-Id: I925c9adf589b2c46fc03207ef87ea69fb14ff395
Reviewed-on: https://chrome-internal-review.googlesource.com/234200
Commit-Ready: Caroline Tice <cmtice@google.com>
Tested-by: Caroline Tice <cmtice@google.com>
Reviewed-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'file_lock_machine.py')
-rwxr-xr-x | file_lock_machine.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/file_lock_machine.py b/file_lock_machine.py index 1496a2c7..f67a9bb1 100755 --- a/file_lock_machine.py +++ b/file_lock_machine.py @@ -21,13 +21,17 @@ from utils import logger LOCK_SUFFIX = "_check_lock_liveness" +# The locks file directory REQUIRES that 'group' only has read/write +# privileges and 'world' has no privileges. So the mask must be +# '0027': 0777 - 0027 = 0750. +LOCK_MASK = 0027 def FileCheckName(name): return name + LOCK_SUFFIX def OpenLiveCheck(file_name): - with FileCreationMask(0000): + with FileCreationMask(LOCK_MASK): fd = open(file_name, "a+w") try: fcntl.lockf(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) @@ -127,7 +131,7 @@ class FileLock(object): logger.GetLogger().LogOutput("\n%s" % cls.AsString(file_locks)) def __enter__(self): - with FileCreationMask(0000): + with FileCreationMask(LOCK_MASK): try: self._file = open(self._filepath, "a+") self._file.seek(0, os.SEEK_SET) @@ -244,7 +248,7 @@ class Lock(object): class Machine(object): - LOCKS_DIR = "/home/mobiletc-prebuild/locks" + LOCKS_DIR = "/google/data/rw/users/mo/mobiletc-prebuild/locks" def __init__(self, name, locks_dir=LOCKS_DIR, auto=True): self._name = name |