Skip to content

Commit

Permalink
Apply code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneZsng committed Feb 12, 2018
1 parent 561671b commit 4b876f1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions docker_volume_watcher/container_notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
from watchdog.events import PatternMatchingEventHandler

class NonZeroExitError(RuntimeError):
def __init__(self,exit_code):
"""
A non-zero exit code error from the command execution in docker.
"""

def __init__(self, exit_code):
super(NonZeroExitError, self).__init__()
self.exit_code = exit_code

class ContainerNotifier(object):
Expand Down Expand Up @@ -65,7 +70,7 @@ def notify(self, absolute_path):
absolute_path)
try:
permissions = self.container.exec_run(
['stat', '-c', '%a', absolute_path], privileged=True)
['stat', '-c', '%a', absolute_path], privileged=True)
if permissions.exit_code != 0:
raise NonZeroExitError(permissions.exit_code)
permissions = permissions.output.decode('utf-8').strip()
Expand All @@ -80,10 +85,10 @@ def notify(self, absolute_path):
'Failed to notify container %s about change in %s',
self.container.name,
absolute_path, exc_info=True)
except NonZeroExitError as e:
except NonZeroExitError as exception:
logging.error(
'Exec run returned non-zero exit code: %s',
e.exit_code)
exception.exit_code)

def stop(self):
"""
Expand Down

0 comments on commit 4b876f1

Please sign in to comment.