Promenade Endpoint Fix
Required for Promenade validateDesign for Shipyard Change-Id: Ie7eadf50b64eaae323c4997be86087ccdbb47f37 PS: https://review.gerrithub.io/#/c/400327/
This commit is contained in:
parent
6f3371bf1a
commit
9d20704fa5
|
@ -49,14 +49,18 @@ class ValidateDesignResource(base.BaseResource):
|
||||||
|
|
||||||
@policy.ApiEnforcer('kubernetes_provisioner:post_validatedesign')
|
@policy.ApiEnforcer('kubernetes_provisioner:post_validatedesign')
|
||||||
def on_post(self, req, resp):
|
def on_post(self, req, resp):
|
||||||
href = req.get_param('href', required=True)
|
|
||||||
try:
|
try:
|
||||||
|
json_data = self.req_json(req)
|
||||||
|
href = json_data.get('href', None)
|
||||||
config = Configuration.from_design_ref(
|
config = Configuration.from_design_ref(
|
||||||
href, allow_missing_substitutions=False)
|
href, allow_missing_substitutions=False)
|
||||||
validation.check_design(config)
|
validation.check_design(config)
|
||||||
msg = "Promenade validations succeeded"
|
msg = "Promenade validations succeeded"
|
||||||
return self._return_msg(resp, falcon.HTTP_200, message=msg)
|
return self._return_msg(resp, falcon.HTTP_200, message=msg)
|
||||||
|
except exceptions.InvalidFormatError as e:
|
||||||
|
msg = "Invalid JSON Format: %s" % str(e)
|
||||||
except exceptions.ValidationException as e:
|
except exceptions.ValidationException as e:
|
||||||
msg = "Promenade validations failed: %s" % str(e)
|
msg = "Promenade validations failed: %s" % str(e)
|
||||||
return self._return_msg(
|
return self._return_msg(
|
||||||
resp, falcon.HTTP_400, status="Invalid", message=msg)
|
resp, falcon.HTTP_400, status="Invalid", message=msg)
|
||||||
|
|
Loading…
Reference in New Issue