def lookup(self, req, stack_name, path='', body=None): """ Redirect to the canonical URL for a stack """ try: identity = dict(identifier.HeatIdentifier.from_arn(stack_name)) except ValueError: identity = self.engine.identify_stack(req.context, stack_name) location = util.make_url(req, identity) if path: location = '/'.join([location, path]) raise exc.HTTPFound(location=location)
def lookup(self, req, stack_name, path="", body=None): """ Redirect to the canonical URL for a stack """ try: identity = dict(identifier.HeatIdentifier.from_arn(stack_name)) except ValueError: identity = self.rpc_client.identify_stack(req.context, stack_name) location = util.make_url(req, identity) if path: location = "/".join([location, path]) raise exc.HTTPFound(location=location)
def create(self, req, body): """ Create a new stack """ data = InstantiationData(body) try: result = self.engine.create_stack(req.context, data.stack_name(), data.template(), data.user_params(), data.args()) except rpc_common.RemoteError as ex: return util.remote_error(ex) raise exc.HTTPCreated(location=util.make_url(req, result))
def lookup(self, req, stack_name, path='', body=None): """Redirect to the canonical URL for a stack.""" try: identity = dict(identifier.HeatIdentifier.from_arn(stack_name)) except ValueError: identity = self.rpc_client.identify_stack(req.context, stack_name) location = util.make_url(req, identity) if path: location = '/'.join([location, path]) params = req.params if params: location += '?%s' % parse.urlencode(params, True) raise exc.HTTPFound(location=location)
def lookup(self, req, stack_name, path='', body=None): """ Redirect to the canonical URL for a stack """ try: identity = self.engine_rpcapi.identify_stack( req.context, stack_name) except rpc_common.RemoteError as ex: return util.remote_error(ex) location = util.make_url(req, identity) if path: location = '/'.join([location, path]) raise exc.HTTPFound(location=location)
def lookup(self, req, stack_name, path='', body=None): """ Redirect to the canonical URL for a stack """ try: identity = self.engine.identify_stack(req.context, stack_name) except rpc_common.RemoteError as ex: return util.remote_error(ex) location = util.make_url(req, identity) if path: location = '/'.join([location, path]) raise exc.HTTPFound(location=location)
def create(self, req, body): """ Create a new stack """ data = InstantiationData(body) try: result = self.engine_rpcapi.create_stack(req.context, data.stack_name(), data.template(), data.user_params(), data.args()) except rpc_common.RemoteError as ex: return util.remote_error(ex, True) if 'Description' in result: raise exc.HTTPBadRequest(explanation=result['Description']) raise exc.HTTPCreated(location=util.make_url(req, result))