Skip to content

Commit cce9f1f

Browse files
committed
fix: trim space and remove redundant variables
1 parent f6c8601 commit cce9f1f

File tree

2 files changed

+12
-26
lines changed

2 files changed

+12
-26
lines changed

src/ALZ/Private/Deploy-Accelerator-Helpers/New-Bootstrap.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,16 @@ function New-Bootstrap {
9898
throw "No starter module has been specified. Please supply the starter module you wish to deploy..."
9999
}
100100

101-
$chosenStarterConfig = $starterConfig.starter_modules.Value.$($inputConfig.starter_module_name.Value)
101+
$starter_module_name = $inputConfig.starter_module_name.Value.Trim()
102102

103-
Write-Verbose "Selected Starter: $($inputConfig.starter_module_name.Value))"
103+
$chosenStarterConfig = $starterConfig.starter_modules.Value.$($starter_module_name)
104+
105+
if($null -eq $chosenStarterConfig ) {
106+
Write-InformationColored "The starter module name '$($starter_module_name)' does not exist in the starter configuration. Please check your input and try again." -ForegroundColor Red -InformationAction Continue
107+
throw "The starter module name '$($starter_module_name)' does not exist in the starter configuration. Please check your input and try again."
108+
}
109+
110+
Write-Verbose "Selected Starter: $starter_module_name"
104111
$starterModulePath = (Resolve-Path (Join-Path -Path $starterPath -ChildPath $chosenStarterConfig.location)).Path
105112
$starterRootModuleFolderPath = $starterModulePath
106113
Write-Verbose "Starter Module Path: $starterModulePath"

src/ALZ/Public/Deploy-Accelerator.ps1

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,6 @@ function Deploy-Accelerator {
2020
[Alias("inputConfigFilePath")]
2121
[string[]] $inputConfigFilePaths = @(),
2222

23-
[Parameter(
24-
Mandatory = $false,
25-
HelpMessage = "[REQUIRED] The infrastructure as code type to target. Supported options are 'bicep', 'bicep-classic', 'terraform' or 'local'. Environment variable: ALZ_iac_type. Config file input: iac_type.")]
26-
[Alias("i")]
27-
[Alias("iac")]
28-
[string] $iac_type = "",
29-
30-
[Parameter(
31-
Mandatory = $false,
32-
HelpMessage = "[REQUIRED] The bootstrap module to deploy. Environment variable: ALZ_bootstrap_module_name. Config file input: bootstrap_module_name."
33-
)]
34-
[Alias("b")]
35-
[Alias("bootstrap")]
36-
[string] $bootstrap_module_name = "",
37-
38-
[Parameter(
39-
Mandatory = $false,
40-
HelpMessage = "[REQUIRED] The starter module to deploy. Environment variable: ALZ_starter_module_name. Config file input: starter_module_name."
41-
)]
42-
[Alias("s")]
43-
[Alias("starter")]
44-
[string] $starter_module_name = "",
45-
4623
[Parameter(
4724
Mandatory = $false,
4825
HelpMessage = "[OPTIONAL] The additional files or folders to be copied directly to the starter module root folder. Environment variable: ALZ_starter_additional_files. Config file input: starter_additional_files."
@@ -306,9 +283,11 @@ function Deploy-Accelerator {
306283
throw "No bootstrap module has been specified. Please supply the bootstrap module you wish to deploy..."
307284
}
308285

286+
$bootstrap_module_name = $inputConfig.bootstrap_module_name.Value.Trim()
287+
309288
$bootstrapAndStarterConfig = Get-BootstrapAndStarterConfig `
310289
-iac $inputConfig.iac_type.Value `
311-
-bootstrap $inputConfig.bootstrap_module_name.Value `
290+
-bootstrap $bootstrap_module_name `
312291
-bootstrapPath $bootstrapPath `
313292
-bootstrapConfigPath $inputConfig.bootstrap_config_path.Value `
314293
-toolsPath $toolsPath

0 commit comments

Comments
 (0)