From 776bfa2f4fd6eb8f8ab0484c7b6a60067fb6e5b9 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Tue, 7 Jul 2015 15:38:42 +0200 Subject: [PATCH] password_command failures are now fatal --- CHANGELOG.rst | 6 ++++++ vdirsyncer/utils/password.py | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8797d04..b9a4874 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,12 @@ Package maintainers and users who have to manually update their installation may want to subscribe to `GitHub's tag feed `_. +Version 0.5.3 +============= + +- ``password_command`` invocations with non-zero exit code are now fatal (and + will abort synchronization) instead of just producing a warning. + Version 0.5.2 ============= diff --git a/vdirsyncer/utils/password.py b/vdirsyncer/utils/password.py index 9f22848..492866d 100644 --- a/vdirsyncer/utils/password.py +++ b/vdirsyncer/utils/password.py @@ -4,7 +4,7 @@ import threading from . import expand_path from .compat import urlparse -from .. import log +from .. import exceptions, log from ..doubleclick import click, ctx logger = log.get(__name__) @@ -115,7 +115,7 @@ def _password_from_command(username, host): try: stdout = subprocess.check_output(command + [username, host], universal_newlines=True) - return stdout.strip() + return stdout.strip('\n') or None except OSError as e: - logger.warning('Failed to execute command: {}\n{}'. - format(' '.join(command), str(e))) + raise exceptions.UserError('Failed to execute command: {}\n{}'. + format(' '.join(command), str(e)))