Hi~ Currently I use fabric api to develop a server administrator management system. I hope to capture the exception or error message, but abory() and error() does not provide a method.
Is there any good way? More thanks. def run_with_exceptions(command, **kwargs): try: output = run(command, **kwargs) except SystemExit: # capture abort message at here except CommandTimeout: raise CommandExecuteTimeout except SSHException, e: if 'Invalid key' in e: raise SshBadHostKeyException except IOError, e: if 'No such file or directory' in e: raise SshBadPrivateKeyPath except NetworkError, e: if 'Timed out trying to connect to' in e or 'Low level socket error connecting' in e: raise SshConnectionTimeout elif 'Name lookup failed for' in e: raise IncorrectNodeAddress else: raise except Exception: raise finally: return output if output else None Nothing is Sound.
_______________________________________________ Fab-user mailing list Fab-user@nongnu.org https://lists.nongnu.org/mailman/listinfo/fab-user