Skip to content

Commit 3ee337d

Browse files
committed
include parameter to skip install attempt
1 parent d714111 commit 3ee337d

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/ALZ/Private/Tools/Test-Tooling.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ function Test-Tooling {
44
[Parameter(Mandatory = $false)]
55
[switch]$skipAlzModuleVersionCheck,
66
[Parameter(Mandatory = $false)]
7-
[switch]$checkYamlModule
7+
[switch]$checkYamlModule,
8+
[Parameter(Mandatory = $false)]
9+
[switch]$skipYamlModuleInstall
810
)
911

1012
$checkResults = @()
@@ -212,6 +214,13 @@ function Test-Tooling {
212214
message = "powershell-yaml module is installed (version $($yamlModule.Version))."
213215
result = "Success"
214216
}
217+
} elseif ($skipYamlModuleInstall.IsPresent) {
218+
Write-Verbose "powershell-yaml module is not installed, skipping installation attempt"
219+
$checkResults += @{
220+
message = "powershell-yaml module is not installed. Please install it using 'Install-PSResource powershell-yaml -Scope $currentScope'."
221+
result = "Failure"
222+
}
223+
$hasFailure = $true
215224
} else {
216225
Write-Verbose "powershell-yaml module is not installed, attempting installation"
217226
$installResult = Install-PSResource powershell-yaml -TrustRepository -Scope $currentScope 2>&1

src/ALZ/Public/Deploy-Accelerator.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ function Deploy-Accelerator {
162162
[Alias("skipAlzModuleVersionRequirementsCheck")]
163163
[switch] $skip_alz_module_version_requirements_check,
164164

165+
[Parameter(
166+
Mandatory = $false,
167+
HelpMessage = "[OPTIONAL] Determines whether to skip attempting to install the powershell-yaml module if it is not installed."
168+
)]
169+
[Alias("skipYamlModuleInstall")]
170+
[switch] $skip_yaml_module_install,
171+
165172
[Parameter(
166173
Mandatory = $false,
167174
HelpMessage = "[OPTIONAL] Determines whether Clean the bootstrap folder of Terraform meta files. Only use for development purposes."
@@ -204,7 +211,7 @@ function Deploy-Accelerator {
204211
Write-InformationColored "WARNING: Skipping the software requirements check..." -ForegroundColor Yellow -InformationAction Continue
205212
} else {
206213
Write-InformationColored "Checking the software requirements for the Accelerator..." -ForegroundColor Green -InformationAction Continue
207-
Test-Tooling -skipAlzModuleVersionCheck:$skip_alz_module_version_requirements_check.IsPresent -checkYamlModule:$hasYamlFiles
214+
Test-Tooling -skipAlzModuleVersionCheck:$skip_alz_module_version_requirements_check.IsPresent -checkYamlModule:$hasYamlFiles -skipYamlModuleInstall:$skip_yaml_module_install.IsPresent
208215
}
209216

210217
Write-InformationColored "Getting ready to deploy the accelerator with you..." -ForegroundColor Green -NewLineBefore -InformationAction Continue

0 commit comments

Comments
 (0)