Fix underlying exception reporting for CommandTimeout exceptions #1228

wants to merge 1 commit into


None yet

2 participants

Kami commented Dec 8, 2014

Currently if you run tasks in parallel mode and one of the hosts throws CommandTimeout, fabric.utils.error will return underlying exception as an empty string.

For example:

Fatal error: One or more hosts failed while executing task 'local'

Underlying exception:


The reason for that is that CommandTimeout class doesn't have message attribute so calling str() on it will return an empty string.

In [1]: from fabric.exceptions import CommandTimeout

In [2]: str(CommandTimeout())
Out[2]: ''

In this pull request I've added message attribute to the class so the underlying exception is now reported correctly.

In [1]: from fabric.exceptions import CommandTimeout

In [2]: str(CommandTimeout(1))
Out[2]: 'Command failed to finish in 1 seconds'

@Kami Kami referenced this pull request in StackStorm/st2 Dec 8, 2014

Make "timeout" fabric runner argument user-configurble #878

@Kami Kami Add message attribute to CommandTimeout class so __str__ method retur…
…ns a

message and not an empty string.

Also add timeout attribute so we have access to the original timeout argument.
@bitprophet bitprophet added this to the 1.8.6/1.9.2 milestone Dec 12, 2014

Thanks, good catch. Looks reasonable offhand, adding to next bugfix release.

@bitprophet bitprophet added a commit that closed this pull request Dec 19, 2014
@bitprophet bitprophet Changelog closes #1228 e858447
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment