Exceptions

APIs of tower_cli raise exceptions defined in tower_cli.exceptions module. Check raise list of resource public method documentation for possible exceptions.

exception tower_cli.exceptions.TowerCLIError(message)[source]

Base exception class for problems raised within Tower CLI. This class adds coloring to exceptions.

exception tower_cli.exceptions.UsageError(message)[source]

An exception class for reporting usage errors.

This uses an exit code of 2 in order to match click (which matters more than following the erstwhile “standard” of using 64).

exception tower_cli.exceptions.BadRequest(message)[source]

An exception class for reporting unexpected error codes from Ansible Tower such that 400 <= code < 500.

In theory, we should never, ever get these.

exception tower_cli.exceptions.AuthError(message)[source]

An exception class for reporting when a request failed due to an authorization failure.

exception tower_cli.exceptions.Forbidden(message)[source]

An exception class for reporting when a user doesn’t have permission to do something.

exception tower_cli.exceptions.NotFound(message)[source]

An exception class for reporting when a request went through without incident, but the requested content could not be found.

exception tower_cli.exceptions.MethodNotAllowed(message)[source]

An exception class for sending a request to a URL where the URL doesn’t accept that method at all.

exception tower_cli.exceptions.MultipleResults(message)[source]

An exception class for reporting when a request that expected one and exactly one result got more than that.

exception tower_cli.exceptions.ServerError(message)[source]

An exception class for reporting server-side errors which are expected to be ephemeral.

exception tower_cli.exceptions.Found(message)[source]

An exception class for when a record already exists, and we were explicitly told that it shouldn’t.

exception tower_cli.exceptions.RelatedError(message)[source]

An exception class for errors where we can’t find related objects that we expect to find.

exception tower_cli.exceptions.MultipleRelatedError(message)[source]

An exception class for errors where we try to find a single related object, and get more than one.

exception tower_cli.exceptions.ValidationError(message)[source]

An exception class for invalid values being sent as option switches to Tower CLI.

exception tower_cli.exceptions.CannotStartJob(message)[source]

An exception class for jobs that cannot be started within Tower for whatever reason.

exception tower_cli.exceptions.Timeout(message)[source]

An exception class for timeouts encountered within Tower CLI, usually for monitoring.

exception tower_cli.exceptions.JobFailure(message)[source]

An exception class for job failures that require error codes within the Tower CLI.

exception tower_cli.exceptions.ConnectionError(message)[source]

An exception class to bubble requests errors more nicely, and communicate connection issues to the user.