Skip to content

Commit 24d86ec

Browse files
committed
Added version check
1 parent 44704ab commit 24d86ec

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

tools/AzureRM/AzureRM.psm1

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
$AzureRMProfileVersion = "0.9.8";
2+
13
$AzureRMModules = @{
24
"Azure.Storage" = "0.9.8";
35
"AzureRM.ApiManagement" = "0.9.8";
@@ -56,18 +58,31 @@ function Update-AzureRM
5658
}
5759

5860
Write-Output "Installing AzureRM modules."
61+
$minVer = $AzureRMProfileVersion
62+
$maxVer = "$($args[1].Split(".")[0]).9999.0"
63+
if ([string]::IsNullOrWhiteSpace($Repository))
64+
{
65+
Install-Module -Name AzureRM.Profile -Scope $Scope -MinimumVersion $minVer -MaximumVersion $maxVer
66+
} else {
67+
Install-Module -Name AzureRM.Profile -Repository $Repository -Scope $Scope -MinimumVersion $minVer -MaximumVersion $maxVer
68+
}
69+
$v = (Get-InstalledModule -Name AzureRM.Profile)[0].Version.ToString()
70+
Write-Output "AzureRM.Profile $v installed..."
5971

60-
$result = $AzureRMModules | ForEach {
72+
$result = $AzureRMModules.Keys | ForEach {
6173
Start-Job -Name $_ -ScriptBlock {
62-
if ([string]::IsNullOrWhiteSpace($args[1]))
74+
$minVer = $args[1]
75+
$maxVer = "$($args[1].Split(".")[0]).9999.0"
76+
77+
if ([string]::IsNullOrWhiteSpace($args[2]))
6378
{
64-
Install-Module -Name $args[0] -Scope $args[2]
79+
Install-Module -Name $args[0] -Scope $args[3] -MinimumVersion $minVer -MaximumVersion $maxVer
6580
} else {
66-
Install-Module -Name $args[0] -Repository $args[1] -Scope $args[2]
81+
Install-Module -Name $args[0] -Repository $args[2] -Scope $args[3] -MinimumVersion $minVer -MaximumVersion $maxVer
6782
}
6883
$v = (Get-InstalledModule -Name $args[0])[0].Version.ToString()
6984
Write-Output "$($args[0]) $v installed..."
70-
} -ArgumentList $_; $Repository; $Scope }
85+
} -ArgumentList $_; $AzureRMModules[$_]; $Repository; $Scope }
7186

7287
$AzureRMModules | ForEach {Get-Job -Name $_ | Wait-Job | Receive-Job }
7388
}

0 commit comments

Comments
 (0)