Skip to content

Commit

Permalink
Added verbose logs
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-avit committed Feb 25, 2021
1 parent 956816d commit 3eccf80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Tasks/AzurePowerShellV2/TryMakingModuleAvailable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,32 @@ param (
$moduleContainerPath = Get-SavedModuleContainerPath

if (-not(Test-Path -Path $moduleContainerPath)) {
Write-Verbose "Folder layout not as per hosted agent, considering self hosted agent skipping module unzip logic."
return;
}

if (!$targetVersion) {
Write-Verbose "Latest module selected which will be available as folder."
return;
}

# value for classic
@($false, $true).ForEach({
$modulePath = Get-SavedModulePath -azurePowerShellVersion $targetVersion -Classic:$_;
if (Test-Path -Path $modulePath) {
Write-Verbose "Module available as folder at $modulePath"
return;
}

$moduleZipPath = $modulePath + ".zip";
if (-not(Test-Path -Path $moduleZipPath)) {
Write-Verbose "Module zip not available to unzip at $moduleZipPath"
return;
}

Write-Verbose "Extracting zip $moduleZipPath"
$parameter = @("x", "-o$moduleContainerPath", "$moduleZipPath")
$command = "$PSScriptRoot\7zip\7z.exe"
&$command @parameter
Write-Verbose "Extraction complete"
})
6 changes: 6 additions & 0 deletions Tasks/AzurePowerShellV3/TryMakingModuleAvailable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,32 @@ param (
$moduleContainerPath = Get-SavedModuleContainerPath

if (-not(Test-Path -Path $moduleContainerPath)) {
Write-Verbose "Folder layout not as per hosted agent, considering self hosted agent skipping module unzip logic."
return;
}

if (!$targetVersion) {
Write-Verbose "Latest module selected which will be available as folder."
return;
}

# value for classic
@($false, $true).ForEach({
$modulePath = Get-SavedModulePath -azurePowerShellVersion $targetVersion -Classic:$_;
if (Test-Path -Path $modulePath) {
Write-Verbose "Module available as folder at $modulePath"
return;
}

$moduleZipPath = $modulePath + ".zip";
if (-not(Test-Path -Path $moduleZipPath)) {
Write-Verbose "Module zip not available to unzip at $moduleZipPath"
return;
}

Write-Verbose "Extracting zip $moduleZipPath"
$parameter = @("x", "-o$moduleContainerPath", "$moduleZipPath")
$command = "$PSScriptRoot\7zip\7z.exe"
&$command @parameter
Write-Verbose "Extraction complete"
})

0 comments on commit 3eccf80

Please sign in to comment.