Skip to content

Commit

Permalink
fix: use loaded providers as definitive providers (#1623)
Browse files Browse the repository at this point in the history
* fix: use loaded providers as definitive providers

We currently have 2 ways of defining the providers used in a solution
the command line options using the -p flag and the CMDB approach which
defines the plugins to load which also act as providers

This loaded providers are based on what is found in the plguins along
with the command line options used. This moves to using the loader input
list of providers instead of the command line options

* fix: use helper function
  • Loading branch information
roleyfoley authored Apr 8, 2021
1 parent ea1228b commit e65f3d2
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions engine/entrance.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
[#macro invokeEntranceMacro type ]

[#local macroOptions = []]
[#list getCLODeploymentProviders() as provider ]
[#list getLoaderProviders() as provider ]
[#local macroOptions +=
[
[ provider, "entrance", type ]
Expand All @@ -124,16 +124,16 @@
[@fatal
message="Could not find entrance macro with provided options"
context=macroOptions
enabled=false
enabled=true
stop=true
/]
[#stop "HamletFatal: Unable to find an entrance macro: ${type}" ]
[/#if]
[/#macro]

[#macro addEntranceInputSteps type ]

[#local macroOptions = []]
[#list getCLODeploymentProviders() as provider ]
[#list getLoaderProviders() as provider ]
[#local macroOptions +=
[
[ provider, "entrance", type, "inputsteps" ]
Expand Down
2 changes: 1 addition & 1 deletion engine/inputdata/blueprint.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
[#-- Components --]
[@includeAllComponentDefinitionConfiguration
SHARED_PROVIDER
getCLODeploymentProviders()
getLoaderProviders()
/]

[#local componentChildren = []]
Expand Down
4 changes: 3 additions & 1 deletion engine/inputdata/inputsource.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ to filter the data returned
[#return getInputState()[LOADER_CONFIG_INPUT_CLASS]!{} ]
[/#function]

[#function getLoaderProviders ]
[#return (getLoader().Providers)![]]
[/#function]
[#--
Get the value for a point within the state
--]
Expand Down Expand Up @@ -1021,4 +1024,3 @@ as processing is typically centred around the initially provided filter values
[#assign inputStateRefreshRequired = false]
[/#if]
[/#macro]

6 changes: 3 additions & 3 deletions engine/output.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@

[#local outputMappings = getGenerationContractStepOutputMapping(
combineEntities(
getCLODeploymentProviders(),
getLoaderProviders(),
[ SHARED_PROVIDER],
UNIQUE_COMBINE_BEHAVIOUR
),
Expand All @@ -448,7 +448,7 @@
[#function getGenerationContractStepParameters subset alternative ]
[#local outputMappings = getGenerationContractStepOutputMapping(
combineEntities(
getCLODeploymentProviders(),
getLoaderProviders(),
[ SHARED_PROVIDER],
UNIQUE_COMBINE_BEHAVIOUR
),
Expand All @@ -464,7 +464,7 @@
[#return {
"entrance" : getCLOEntranceType(),
"flows" : getCLOFlows()?join(","),
"providers" : (getCLODeploymentProviders()?join(","))!SHARED_PROVIDER,
"providers" : (getLoaderProviders()?join(","))!SHARED_PROVIDER,
"deploymentFramework" : getCLODeploymentFramework(),
"outputType" : outputMappings["OutputType"],
"outputFormat" : outputMappings["OutputFormat"],
Expand Down
2 changes: 1 addition & 1 deletion engine/output_writer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
[#break]
[/#if]

[#list combineEntities( getCLODeploymentProviders(), [ SHARED_PROVIDER ], UNIQUE_COMBINE_BEHAVIOUR) as provider ]
[#list combineEntities( getLoaderProviders(), [ SHARED_PROVIDER ], UNIQUE_COMBINE_BEHAVIOUR) as provider ]
[#local handlerFunctionOptions = [
[ provider, "outputhandler", handler ]
]]
Expand Down
10 changes: 4 additions & 6 deletions engine/setContext.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[@includeSharedComponentConfiguration component="baseline" /]

[#-- Temporary AWS stuff --]
[#if getCLODeploymentProviders()?seq_contains("aws") ]
[#if getLoaderProviders()?seq_contains("aws") ]
[@includeProviderComponentDefinitionConfiguration provider="aws" component="baseline" /]
[@includeProviderComponentConfiguration provider="aws" component="baseline" services="baseline" /]
[@includeProviderComponentDefinitionConfiguration provider="aws" component="s3" /]
Expand Down Expand Up @@ -130,7 +130,7 @@
[#assign accountId = accountObject.Id ]
[#assign accountName = accountObject.Name ]

[#if getCLODeploymentProviders()?seq_contains("aws")]
[#if getLoaderProviders()?seq_contains("aws")]
[#assign credentialsBucket = getExistingReference(formatAccountS3Id("credentials"))]
[#assign credentialsBucketRegion = getExistingReference(formatAccountS3Id("credentials"), REGION_ATTRIBUTE_TYPE)]

Expand Down Expand Up @@ -204,7 +204,7 @@

[/#if]

[#if getCLODeploymentProviders()?seq_contains("aws")]
[#if getLoaderProviders()?seq_contains("aws")]
[#assign segmentSeed = getExistingReference(formatSegmentSeedId()) ]

[#assign legacyVpc = getExistingReference(formatVPCId())?has_content ]
Expand All @@ -226,7 +226,7 @@
[#assign sshEnabled = segmentObject.Bastion.Enabled ]
[#assign sshActive = sshEnabled && segmentObject.Bastion.Active ]

[#if getCLODeploymentProviders()?seq_contains("aws")]
[#if getLoaderProviders()?seq_contains("aws")]
[#assign sshFromProxySecurityGroup = getExistingReference(formatSSHFromProxySecurityGroupId())]
[/#if]

Expand Down Expand Up @@ -695,5 +695,3 @@
[/#list]
[#return codes]
[/#function]


2 changes: 1 addition & 1 deletion providers/shared/components/shared/setup.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
[#local testCase = testCases[testCaseName] ]

[#local outputProviders = combineEntities(
getCLODeploymentProviders(),
getLoaderProviders(),
[ SHARED_PROVIDER],
UNIQUE_COMBINE_BEHAVIOUR
)]
Expand Down
2 changes: 1 addition & 1 deletion providers/shared/flows/views/flow.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
view=getCLOView()
/]

[#local primaryProvider = (getCLODeploymentProviders()[0])!SHARED_PROVIDER ]
[#local primaryProvider = (getLoaderProviders()[0])!SHARED_PROVIDER ]

[@includeProviderViewDefinitionConfiguration
provider=primaryProvider
Expand Down
2 changes: 1 addition & 1 deletion providers/shared/provider.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
deploymentUnit=resourceSet["deployment:Unit"]
deploymentGroup=deploymentGroupDetails.Name
deploymentPriority=priority?has_content?then(priority, resourceSet["deployment:Priority"])
deploymentProvider=getCLODeploymentProviders()[0]
deploymentProvider=getLoaderProviders()[0]
currentState=currentState
deploymentMode=deploymentMode
/]
Expand Down
2 changes: 1 addition & 1 deletion providers/shared/views/info/setup.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[#macro shared_view_default_info ]

[#-- Load sections which are dynamically loaded through discovery --]
[#local providersList = asFlattenedArray( [ SHARED_PROVIDER, getCLODeploymentProviders() ] ) ]
[#local providersList = asFlattenedArray( [ SHARED_PROVIDER, getLoaderProviders() ] ) ]
[@includeAllComponentDefinitionConfiguration providersList /]
[@includeAllViewConfiguration providersList /]

Expand Down
6 changes: 3 additions & 3 deletions providers/shared/views/schema/setup.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
[#break]
[#else]

[#local schemaLayerConfig =
[#local schemaLayerConfig =
getLayerConfiguration(schema?capitalize)]

[#local schemaLayerAttributes = schemaLayerConfig.Attributes![]]
Expand Down Expand Up @@ -56,7 +56,7 @@

[@includeAllComponentDefinitionConfiguration
SHARED_PROVIDER
getCLODeploymentProviders()
getLoaderProviders()
/]
[#local configuration = componentConfiguration[schema] ]

Expand Down Expand Up @@ -199,4 +199,4 @@
/]
[/#if]

[/#macro]
[/#macro]
4 changes: 2 additions & 2 deletions providers/shared/views/schemaset/setup.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
[#case "component" ]
[@includeAllComponentDefinitionConfiguration
SHARED_PROVIDER
getCLODeploymentProviders()
getLoaderProviders()
/]
[#local schemas = componentConfiguration?keys ]
[#break]
Expand All @@ -40,7 +40,7 @@
[#local outputMappings =
getGenerationContractStepOutputMapping(
combineEntities(
getCLODeploymentProviders(),
getLoaderProviders(),
[ SHARED_PROVIDER],
UNIQUE_COMBINE_BEHAVIOUR
),
Expand Down
2 changes: 1 addition & 1 deletion providers/shared/views/unitlist/setup.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
deploymentUnit=deploymentUnit
deploymentPriority=999
deploymentGroup=deploymentGroup
deploymentProvider=(getCLODeploymentProviders()[0])!SHARED_PROVIDER
deploymentProvider=(getLoaderProviders()[0])!SHARED_PROVIDER
currentState="orphaned"
deploymentMode="_orphan"
/]
Expand Down

0 comments on commit e65f3d2

Please sign in to comment.