How to use the boto.exception.BotoServerError function in boto

To help you get started, we’ve selected a few boto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Yelp / mrjob / tests / mockboto.py View on Github external
def _check_role_does_not_exist(self, role_name):
        if role_name in self.mock_iam_roles:
            raise boto.exception.BotoServerError(
                409, 'Conflict', body=err_xml(
                    ('Role with name %s already exists.' %
                     role_name), code='EntityAlreadyExists'))
github spulec / moto / tests / test_cloudformation / test_cloudformation_stack_integration.py View on Github external
def test_create_template_without_required_param():
    template_json = json.dumps(single_instance_with_ebs_volume.template)
    conn = boto.cloudformation.connect_to_region("us-west-1")
    conn.create_stack.when.called_with(
        "test_stack",
        template_body=template_json,
    ).should.throw(BotoServerError)
github openstack / tempest / tempest / testboto.py View on Github external
boto_logger.setLevel(logging.CRITICAL)  # suppress logging for these

    def _cred_sub_check(connection_data):
        if not id_matcher.match(connection_data["aws_access_key_id"]):
            raise Exception("Invalid AWS access Key")
        if not secret_matcher.match(connection_data["aws_secret_access_key"]):
            raise Exception("Invalid AWS secret Key")
        raise Exception("Unknown (Authentication?) Error")
    openstack = tempest.clients.Manager()
    try:
        if urlparse.urlparse(config.boto.ec2_url).hostname is None:
            raise Exception("Failed to get hostname from the ec2_url")
        ec2client = openstack.ec2api_client
        try:
            ec2client.get_all_regions()
        except exception.BotoServerError as exc:
                if exc.error_code is None:
                    raise Exception("EC2 target does not looks EC2 service")
                _cred_sub_check(ec2client.connection_data)

    except keystoneclient.exceptions.Unauthorized:
        EC2_CAN_CONNECT_ERROR = "AWS credentials not set," +\
                                " faild to get them even by keystoneclient"
    except Exception as exc:
        EC2_CAN_CONNECT_ERROR = str(exc)

    try:
        if urlparse.urlparse(config.boto.s3_url).hostname is None:
            raise Exception("Failed to get hostname from the s3_url")
        s3client = openstack.s3_client
        try:
            s3client.get_bucket("^INVALID*#()@INVALID.")
github GoogleCloudPlatform / gsutil / gslib / vendored / boto / boto / kinesis / exceptions.py View on Github external
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
from boto.exception import BotoServerError


class ProvisionedThroughputExceededException(BotoServerError):
    pass


class LimitExceededException(BotoServerError):
    pass


class ExpiredIteratorException(BotoServerError):
    pass


class ResourceInUseException(BotoServerError):
    pass


class ResourceNotFoundException(BotoServerError):
github GoogleCloudPlatform / gsutil / gslib / vendored / boto / boto / connection.py View on Github external
raise
                boto.log.debug('encountered %s exception, reconnecting' %
                               e.__class__.__name__)
                connection = self.new_http_connection(request.host, request.port,
                                                      self.is_secure)
                ex = e
            time.sleep(next_sleep)
            i += 1
        # If we made it here, it's because we have exhausted our retries
        # and stil haven't succeeded.  So, if we have a response object,
        # use it to raise an exception.
        # Otherwise, raise the exception that must have already happened.
        if self.request_hook is not None:
            self.request_hook.handle_request_data(request, response, error=True)
        if response:
            raise BotoServerError(response.status, response.reason, body)
        elif ex:
            raise ex
        else:
            msg = 'Please report this exception as a Boto Issue!'
            raise BotoClientError(msg)
github NixOS / nixops / nixops / resources / iam_role.py View on Github external
# Automatic provisioning of AWS IAM roles.

import time
import boto
import boto.iam
import nixops.util
import nixops.resources
import nixops.ec2_utils
from xml.etree import ElementTree
from pprint import pprint
from boto.exception import BotoServerError

class IamPermissionException(BotoServerError):
    pass

class IamNotFound(BotoServerError):
    pass

class IAMRoleDefinition(nixops.resources.ResourceDefinition):
    """Definition of an IAM Role."""

    @classmethod
    def get_type(cls):
        return "iam-role"

    @classmethod
    def get_resource_type(cls):
        return "iamRoles"

    def __init__(self, xml):
        nixops.resources.ResourceDefinition.__init__(self, xml)
        self.role_name = xml.find("attrs/attr[@name='name']/string").get("value")
github boto / boto / boto / awslambda / exceptions.py View on Github external
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
from boto.exception import BotoServerError


class InvalidRequestContentException(BotoServerError):
    pass


class ResourceNotFoundException(BotoServerError):
    pass


class InvalidParameterValueException(BotoServerError):
    pass


class ServiceException(BotoServerError):
    pass
github cloudera / hue / desktop / core / ext-py / boto-2.46.1 / boto / kinesis / exceptions.py View on Github external
pass


class LimitExceededException(BotoServerError):
    pass


class ExpiredIteratorException(BotoServerError):
    pass


class ResourceInUseException(BotoServerError):
    pass


class ResourceNotFoundException(BotoServerError):
    pass


class InvalidArgumentException(BotoServerError):
    pass


class SubscriptionRequiredException(BotoServerError):
    pass
github cloudera / hue / desktop / core / ext-py / boto-2.46.1 / boto / codedeploy / exceptions.py View on Github external
pass


class DeploymentIdRequiredException(BotoServerError):
    pass


class DeploymentConfigDoesNotExistException(BotoServerError):
    pass


class BucketNameFilterRequiredException(BotoServerError):
    pass


class InvalidTimeRangeException(BotoServerError):
    pass


class ApplicationDoesNotExistException(BotoServerError):
    pass


class InvalidRevisionException(BotoServerError):
    pass


class InvalidSortOrderException(BotoServerError):
    pass


class InvalidOperationException(BotoServerError):
github cloudera / hue / desktop / core / ext-py / boto-2.46.1 / boto / cognito / identity / exceptions.py View on Github external
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
from boto.exception import BotoServerError


class LimitExceededException(BotoServerError):
    pass


class ResourceConflictException(BotoServerError):
    pass


class DeveloperUserAlreadyRegisteredException(BotoServerError):
    pass


class TooManyRequestsException(BotoServerError):
    pass


class InvalidParameterException(BotoServerError):
    pass


class ResourceNotFoundException(BotoServerError):