From 66e0d9c4514d7c40d8c3c2f22d41472b213abda5 Mon Sep 17 00:00:00 2001 From: aknysh Date: Wed, 12 Jan 2022 13:25:39 -0500 Subject: [PATCH] Add `metadata.component` and `metadata.inherits` --- .../stacks/catalog/terraform/test-component-override-3.yaml | 2 +- pkg/stack/stack_processor.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/complete/stacks/catalog/terraform/test-component-override-3.yaml b/examples/complete/stacks/catalog/terraform/test-component-override-3.yaml index aa24097dd..6f2e85a4b 100644 --- a/examples/complete/stacks/catalog/terraform/test-component-override-3.yaml +++ b/examples/complete/stacks/catalog/terraform/test-component-override-3.yaml @@ -32,7 +32,7 @@ components: # 3. `mixin-2` overrides `mixin-1` and its base components (all the way up its inheritance chain). # 4. This `test/test-component-override-3` overrides `mixin-2` and its base components (all the way up its inheritance chain). # Inheritance: test/test-component-override-3 -> mixin-2 -> mixin-1 -> test/test-component-override-2 -> test/test-component-override -> test/test-component - inherit: + inherits: - "test/test-component-override" - "test/test-component-override-2" - "mixin-1" diff --git a/pkg/stack/stack_processor.go b/pkg/stack/stack_processor.go index 64ce60e74..12c335594 100644 --- a/pkg/stack/stack_processor.go +++ b/pkg/stack/stack_processor.go @@ -447,7 +447,7 @@ func ProcessConfig( // It uses a method similar to Method Resolution Order (MRO), which is how Python supports multiple inheritance. // // In the case of multiple base components, it is processed left to right, in the order by which it was declared. - // For example: `metadata.inherit: [componentA, componentB]` + // For example: `metadata.inherits: [componentA, componentB]` // will deep-merge all the base components of `componentA` (each component overriding its base), // then all the base components of `componentB` (each component overriding its base), // then the two results are deep-merged together (`componentB` inheritance chain will override values from `componentA' inheritance chain). @@ -455,13 +455,13 @@ func ProcessConfig( baseComponentName = baseComponentFromMetadata } - if inheritList, inheritListExist := componentMetadata["inherit"].([]interface{}); inheritListExist { + if inheritList, inheritListExist := componentMetadata["inherits"].([]interface{}); inheritListExist { for _, v := range inheritList { base := v.(string) if _, ok2 := allTerraformComponentsMap[base]; !ok2 { errorMessage := fmt.Sprintf("The component '%[1]s' in the stack '%[2]s' inherits from '%[3]s' "+ - "(using 'metadata.inherit'), but '%[3]s' does not exist in the stack '%[2]s'", + "(using 'metadata.inherits'), but '%[3]s' does not exist in the stack '%[2]s'", component, stackName, base,