Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/ALZ/Private/Config-Helpers/Get-ALZConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ function Get-ALZConfig {
$extension = (Get-Item -Path $configFilePath).Extension.ToLower()
$config = $null
if ($extension -eq ".yml" -or $extension -eq ".yaml") {
if (!(Get-Module -ListAvailable -Name powershell-Yaml)) {
Write-Host "Installing YAML module"
Install-Module powershell-Yaml -Force
}
try {
$config = [PSCustomObject](Get-Content -Path $configFilePath | ConvertFrom-Yaml -Ordered)
} catch {
Expand Down
26 changes: 20 additions & 6 deletions src/ALZ/Private/Tools/Test-Tooling.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function Test-Tooling {
if ($null -ne $alzModuleCurrentVersion) {
if ($alzModuleCurrentVersion.Version -lt $alzModuleLatestVersion.Version) {
$checkResults += @{
message = "ALZ module is not the latest version. Your version: $($alzModuleCurrentVersion.Version), Latest version: $($alzModuleLatestVersion.Version). Please update to the latest version using 'Update-Module ALZ'."
message = "ALZ module is not the latest version. Your version: $($alzModuleCurrentVersion.Version), Latest version: $($alzModuleLatestVersion.Version). Please update to the latest version using 'Update-PSResource -Name ALZ'."
result = "Failure"
}
$hasFailure = $true
Expand All @@ -191,18 +191,32 @@ function Test-Tooling {
# Check if powershell-yaml module is installed (only when YAML files are being used)
if ($checkYamlModule.IsPresent) {
Write-Verbose "Checking powershell-yaml module installation"
$yamlModule = Get-Module -ListAvailable -Name powershell-yaml
$yamlModule = Get-InstalledPSResource -Name powershell-yaml 2> $null
if ($yamlModule) {
$checkResults += @{
message = "powershell-yaml module is installed (version $($yamlModule.Version))."
result = "Success"
}
} else {
$checkResults += @{
message = "powershell-yaml module is not installed. Please install it using 'Install-Module powershell-yaml -Force'."
result = "Failure"
$installSuccessful = $false
try {
Install-PSResource powershell-yaml -TrustRepository
$installSuccessful = $true
} catch {
Write-Verbose "Failed to install powershell-yaml module"
}
if($installSuccessful) {
$checkResults += @{
message = "powershell-yaml module was not installed, but has been successfully installed (version $((Get-InstalledPSResource -Name powershell-yaml).Version))."
result = "Success"
}
} else {
$checkResults += @{
message = "powershell-yaml module is not installed. Please install it using 'Install-PSResource powershell-yaml'."
result = "Failure"
}
$hasFailure = $true
}
$hasFailure = $true
}
}

Expand Down
Loading