Use OutputDefinition to generate attributes schema
We have the OutputDefinition API now, and no longer need to treat templates like CFN JSON blobs to obtain information about outputs. Change-Id: I8dfea1e9855a56fb85d2e3af40996d5f337d7859
This commit is contained in:
parent
bb3ddcf573
commit
85eff5fc3d
@ -200,11 +200,9 @@ class Attributes(collections.Mapping):
|
|||||||
return outp
|
return outp
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def schema_from_outputs(json_snippet):
|
def schema_from_outputs(outputs):
|
||||||
if json_snippet:
|
return dict((o.name, Schema(o.description()))
|
||||||
return dict((k, Schema(v.get("Description")))
|
for o in outputs.values())
|
||||||
for k, v in json_snippet.items())
|
|
||||||
return {}
|
|
||||||
|
|
||||||
def _validate_type(self, attrib, value):
|
def _validate_type(self, attrib, value):
|
||||||
if attrib.schema.type == attrib.schema.STRING:
|
if attrib.schema.type == attrib.schema.STRING:
|
||||||
|
@ -92,8 +92,8 @@ class StackResource(resource.Resource):
|
|||||||
|
|
||||||
return "nested_stack"
|
return "nested_stack"
|
||||||
|
|
||||||
def _outputs_to_attribs(self, json_snippet):
|
def _outputs_to_attribs(self, parsed_template):
|
||||||
outputs = json_snippet.get('Outputs')
|
outputs = parsed_template.outputs(None)
|
||||||
if not self.attributes and outputs:
|
if not self.attributes and outputs:
|
||||||
self.attributes_schema = (
|
self.attributes_schema = (
|
||||||
attributes.Attributes.schema_from_outputs(outputs))
|
attributes.Attributes.schema_from_outputs(outputs))
|
||||||
|
@ -108,7 +108,7 @@ class TemplateResource(stack_resource.StackResource):
|
|||||||
return ((properties.Properties.schema_from_params(
|
return ((properties.Properties.schema_from_params(
|
||||||
tmpl.param_schemata(param_defaults))),
|
tmpl.param_schemata(param_defaults))),
|
||||||
(attributes.Attributes.schema_from_outputs(
|
(attributes.Attributes.schema_from_outputs(
|
||||||
tmpl[tmpl.OUTPUTS])))
|
tmpl.outputs(None))))
|
||||||
|
|
||||||
def _generate_schema(self):
|
def _generate_schema(self):
|
||||||
self._parsed_nested = None
|
self._parsed_nested = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user