EC2ResponseError: 400 Bad Request <?xml version='1.0' encoding='UTF-8'?> <Response><RequestID>842485b9-b64d-4f45-ba5a-ffbfd306cb34</RequestID><Errors><Error><Code>AuthFailure</Code><Message>User not authorized.</Message></Error></Errors></Response> search by Google
/usr/local/lib/python3.7/unittest/case.py in testPartExecutor (arguments ▶)
- @contextlib.contextmanager
- def testPartExecutor(self, test_case, isTest=False):
- old_success = self.success
- self.success = True
- try:
- yield
- except KeyboardInterrupt:
- raise
- except SkipTest as e:
- self.success = False
/usr/local/lib/python3.7/unittest/case.py in run (arguments ▶)
- outcome = _Outcome(result)
- try:
- self._outcome = outcome
- with outcome.testPartExecutor(self):
- self.setUp()
- if outcome.success:
- outcome.expecting_failure = expecting_failure
- with outcome.testPartExecutor(self, isTest=True):
- testMethod()
/root/c2tests/.venv/lib/python3.7/site-packages/c2tests/__init__.py in setUp (arguments ▶)
- self.entities[resources.VPC_VPCS] = self.get_all_vpcs()
- self.entities[resources.VPC_DHCP_OPTIONS] = self.get_all_dhcp_options()
- def setUp(self):
- self._default_vpcs = dict([(i, None) for i in profile.AVAILABLE_PROJECTS])
- super(VPCTestCase, self).setUp()
- zones = self.get_all_zones()
- def _setup():
- # ensure that default VPC exists
/root/c2tests/.venv/lib/python3.7/site-packages/c2tests/__init__.py in setUp (arguments ▶)
- """
- return self.profile.get_connection(profile.EC2Connection)
- def setUp(self):
- super(_EC2TestCase, self).setUp()
- self._default_acls = {i: None for i in profile.AVAILABLE_PROJECTS}
- self._default_groups = {i: None for i in profile.AVAILABLE_PROJECTS}
- self._default_subnets = {i: {} for i in profile.AVAILABLE_PROJECTS}
- self._default_keypair = None
/root/c2tests/.venv/lib/python3.7/site-packages/c2tests/__init__.py in setUp (arguments ▶)
- self.log.warning(message, *args, **kwargs)
- def setUp(self):
- self.report("Cleaning up before the test")
- self.cleanup()
- self.report("Cleaning up finished")
- self.log.warning("Running testcase: {0}".format(self._testMethodName))
- def tearDown(self):
/root/c2tests/.venv/lib/python3.7/site-packages/c2tests/__init__.py in cleanup (arguments ▶)
- for project in projects or profile.AVAILABLE_PROJECTS:
- with self.switch_project(project):
- self.report("Filling up {0} project entities...".format(project))
- self._fill_entities()
- self.report("Cleaning up {0} project entities...".format(project))
- self._cleanup()
- def cleanup_prod(self):
- """Cleans up all data created by the test in production environment."""
/root/c2tests/.venv/lib/python3.7/site-packages/c2tests/__init__.py in _cleanup (arguments ▶)
- _setup()
- with self.switch_project(profile.P2_PROJECT):
- _setup()
- def _cleanup(self):
- super(VPCTestCase, self)._cleanup()
- self._delete_vpn_connections()
- self._delete_subnets()
- self._delete_route_tables()
/root/c2tests/.venv/lib/python3.7/site-packages/c2tests/__init__.py in _cleanup (arguments ▶)
- def _cleanup(self):
- super(_EC2TestCase, self)._cleanup()
- self._delete_addresses()
- self._delete_instances()
- self._delete_network_interfaces()
- self._delete_placement_groups()
- self._delete_security_groups()
- self._detach_external_networks()
/root/c2tests/.venv/lib/python3.7/site-packages/c2tests/__init__.py in _delete_instances (arguments ▶)
- [instance.id],
- [
- constants.INSTANCE_STATE_RUNNING,
- constants.INSTANCE_STATE_STOPPED,
- ],
- check_for_errors=False,
- )
- try:
- self.log.warning("1. Deleting: {0}".format(instance))
/root/c2tests/.venv/lib/python3.7/site-packages/c2tests/utils.py in wait_for_instance_states (arguments ▶)
- raise Error("Instance {0} has disappeared.",
- set(instance_ids).difference(got_ids).pop())
- return True
- wait(10 * constants.MINUTE_SECONDS, check_state)
- def wait_for_extnet_attached(conn, *extnets):
- """Wait for External Network attached state."""
/root/c2tests/.venv/lib/python3.7/site-packages/c2tests/utils.py in wait (arguments ▶)
- def wait(timeout, func, *args, **kwargs):
- """Fail unless func return success within specified number of seconds"""
- endtime = time.time() + float(timeout)
- while time.time() < endtime:
- result = func(*args, **kwargs)
- if result:
- return result
- time.sleep(min(timeout, 0.1))
/root/c2tests/.venv/lib/python3.7/site-packages/c2tests/utils.py in check_state (arguments ▶)
- for state in constants.ERROR_INSTANCE_STATES]
- def check_state():
- got_ids = set()
- for reservation in conn.get_all_instances(instance_ids):
- for instance in reservation.instances:
- got_ids.add(instance.id)
- if check_for_errors and instance.state in aws_error_states:
- raise Error("Instance {0} got {1} state.",
/root/c2tests/.venv/src/boto/boto/ec2/connection.py in get_all_instances (arguments ▶)
- warnings.warn(('The current get_all_instances implementation will be '
- 'replaced with get_all_reservations.'),
- PendingDeprecationWarning)
- return self.get_all_reservations(instance_ids=instance_ids,
- filters=filters, dry_run=dry_run,
- max_results=max_results)
- def get_only_instances(self, instance_ids=None, filters=None,
- dry_run=False, max_results=None):
- # A future release should rename this method to get_all_instances
/root/c2tests/.venv/src/boto/boto/ec2/connection.py in get_all_reservations (arguments ▶)
- if max_results is not None:
- params['MaxResults'] = max_results
- if next_token:
- params['NextToken'] = next_token
- return self.get_list('DescribeInstances', params,
- [('item', Reservation)], verb='POST')
- def get_all_instance_status(self, instance_ids=None,
- max_results=None, next_token=None,
- filters=None, dry_run=False,
/root/c2tests/.venv/src/boto/boto/connection.py in get_list (arguments ▶)
- xml.sax.parseString(body, h)
- return rs
- else:
- boto.log.error('%s %s' % (response.status, response.reason))
- boto.log.error('%s' % body)
- raise self.ResponseError(response.status, response.reason, body)
- def get_object(self, action, params, cls, path='/',
- parent=None, verb='GET'):
- if not parent: