Skip to content

Commit

Permalink
Fix encoding issues of lock debug logging
Browse files Browse the repository at this point in the history
Change-Id: I655a8c8af4f6ce6898d8cb09283b06bd3b6e7819
  • Loading branch information
LarsMichelsen committed Jun 12, 2019
1 parent 013b9d7 commit 698fde2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmk/utils/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def aquire_lock(path, blocking=True):
if have_lock(path):
return True # No recursive locking

logger.debug("Try aquire lock on %s", path)
logger.debug("Try aquire lock on %s", path.decode("utf-8"))

# Create file (and base dir) for locking if not existant yet
if not os.path.exists(os.path.dirname(path)):
Expand All @@ -304,7 +304,7 @@ def aquire_lock(path, blocking=True):
fd = fd_new

_acquired_locks[path] = fd
logger.debug("Got lock on %s", path)
logger.debug("Got lock on %s", path.decode("utf-8"))


def try_aquire_lock(path):
Expand All @@ -320,7 +320,7 @@ def try_aquire_lock(path):
def release_lock(path):
if not have_lock(path):
return # no unlocking needed
logger.debug("Releasing lock on %s", path)
logger.debug("Releasing lock on %s", path.decode("utf-8"))
fd = _acquired_locks.get(path)
if fd is None:
return
Expand All @@ -330,7 +330,7 @@ def release_lock(path):
if e.errno != errno.EBADF: # Bad file number
raise
_acquired_locks.pop(path, None)
logger.debug("Released lock on %s", path)
logger.debug("Released lock on %s", path.decode("utf-8"))


def have_lock(path):
Expand Down

0 comments on commit 698fde2

Please sign in to comment.