Azure / Azure/azure-functions-powershell-worker

[Managed Dependencies] Remove empty spaces for entries in requirements.psd1

Open
#863 1 comment 1 reaction 1 assignee Claimed by @Francisco-Gamino View on GitHub
P3
Dominant language
C#
Stars
215
Forks
61
Avg merge
21h 4m
Merged PRs (30d)
6

Description

Remove empty spaces for entries in requirements.psd1.

In the example below, the module `'Az.Aks '` will not be installed because it has empty spaces to the right. We should trim the entries in the requirmenets.psd1 to avoid issues like this in the future.
``` powershell
PS C:\modules> $modulesToInstall = @{
# For latest supported version, go to 'https://www.powershellgallery.com/packages/Az'.
'Az.Accounts' = '2.10.0'
'Az.Aks ' = '4.3.0'
'Az.ContainerInstance' = '1.0.3'
'Az.Compute' = '4.9.0'
'Az.KeyVault' = '2.1.0'
'Az.Network' = '4.18.0'
'Az.Resources' = '5.4.0'
'Az.Sql' = '3.8.0'
'Az.Storage' = '3.6.0'
}
```
Output of Save-Module when trying to install the modules define in `requirements.psd1`:
``` powershell
PS C:\modules> $modulesToInstall.Keys | % { Save-Module -Path . -Name $_ -RequiredVersion $modulesToInstall[$_] -WhatIf }
What if: Performing the operation "Save Package" on target "'Az.Accounts' to location 'C:\modules'".
What if: Performing the operation "Save Package" on target "'Az.Storage' to location 'C:\modules'".
Save-Package: No match was found for the specified search criteria and module name 'Az.Aks '. Try Get-PSRepository to see all available registered module repositories.

What if: Performing the operation "Save Package" on target "'Az.ContainerInstance' to location 'C:\modules'".
What if: Performing the operation "Save Package" on target "'Az.Resources' to location 'C:\modules'".
What if: Performing the operation "Save Package" on target "'Az.Sql' to location 'C:\modules'".
What if: Performing the operation "Save Package" on target "'Az.Compute' to location 'C:\modules'".
What if: Performing the operation "Save Package" on target "'Az.KeyVault' to location 'C:\modules'".
What if: Performing the operation "Save Package" on target "'Az.Network' to location 'C:\modules'".
PS C:\modules>
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.