aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
236 stars 78 forks source link

Fix AWS.Tools.Installer Get-AvailableModuleVersion Find-Module $findModuleParams splat #75

Closed tlindsay42 closed 4 years ago

tlindsay42 commented 4 years ago

Replaces the improper positional parameter $findModuleParams with a splat

Description

Replaces an improper positional parameter with a splat.

Motivation and Context

Fixes #74

Testing

Force imported the module from source and re-ran. The Find-Module no longer fails due to an unhandled positional parameter error, but now fails due to insufficient logic to handle wildcard requests. Wildcard module handling is not covered by the existing logic, but will be in my upcoming pull request.

PS C:\git\aws-tools-for-powershell\modules\Installer> Import-Module .\AWS.Tools.Installer.psd1 -Force
PS C:\git\aws-tools-for-powershell\modules\Installer> Install-AWSToolsModule -Name 'AWS.Tools.*' -Verbose
VERBOSE: [Install-AWSToolsModule] ConfirmPreference=High WhatIfPreference=False VerbosePreference=Continue Force=False
VERBOSE: [Get-AvailableModuleVersion] ConfirmPreference=High WhatIfPreference=False VerbosePreference=Continue Force=False
VERBOSE: [Get-AvailableModuleVersion] Found multiple modules versions: 1.0.0.0, 4.0.0.0.)
Find-Module : The RequiredVersion, MinimumVersion, MaximumVersion, AllVersions or AllowPrerelease parameters are allowed only when you specify a single name as the value of the Name parameter, without any wildcard characters.
At C:\git\aws-tools-for-powershell\modules\Installer\AWS.Tools.Installer.psm1:250 char:54
+ ... orEach-Object { Find-Module -Name $_ @findModuleParams @proxyParams }
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Find-Module], ArgumentException
+ FullyQualifiedErrorId : VersionParametersAreAllowedOnlyWithSingleName,Find-Module

Screenshots (if appropriate)

Types of changes

Checklist

License