コード例 #1
0
    def describe_stack_resource(self, cnxt, stack_identity, resource_name):
        s = self._get_stack(cnxt, stack_identity)
        stack = parser.Stack.load(cnxt, stack=s)

        if cfg.CONF.heat_stack_user_role in cnxt.roles:
            if not self._authorize_stack_user(cnxt, stack, resource_name):
                logger.warning("Access denied to resource %s" % resource_name)
                raise exception.Forbidden()

        if resource_name not in stack:
            raise exception.ResourceNotFound(resource_name=resource_name,
                                             stack_name=stack.name)

        resource = stack[resource_name]
        if resource.id is None:
            raise exception.ResourceNotAvailable(resource_name=resource_name)

        return api.format_stack_resource(stack[resource_name])
コード例 #2
0
ファイル: test_api_aws.py プロジェクト: p0i0/openstack-heat
 def test_map_remote_error_denied_error(self):
     ex = common_exception.Forbidden()
     expected = aws_exception.HeatAccessDeniedError
     self.assertIsInstance(aws_exception.map_remote_error(ex), expected)