Document password_command behavior in keyring.rst

This commit is contained in:
Markus Unterwaditzer 2015-07-16 15:18:31 +02:00
parent 0e11d2ea0e
commit 60a7778cea
2 changed files with 5 additions and 1 deletions

View file

@ -15,6 +15,10 @@ Custom command
A custom command/binary can be specified to retrieve the password for a A custom command/binary can be specified to retrieve the password for a
username/hostname combination. See :ref:`general_config`. username/hostname combination. See :ref:`general_config`.
.. versionchanged:: 0.6.0
Setting a custom command now disables all other methods.
netrc netrc
===== =====

View file

@ -118,7 +118,7 @@ def _password_from_command(username, host):
try: try:
stdout = subprocess.check_output(command + [username, host], stdout = subprocess.check_output(command + [username, host],
universal_newlines=True) universal_newlines=True)
return stdout.strip('\n') or None return stdout.strip('\n')
except OSError as e: except OSError as e:
raise exceptions.UserError('Failed to execute command: {}\n{}'. raise exceptions.UserError('Failed to execute command: {}\n{}'.
format(' '.join(command), str(e))) format(' '.join(command), str(e)))