-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception calling Install-AWSToolsModule with -Cleanup #161
Comments
On further investigation this issue is actually caused by #162. The broken module installations mean the internal |
This should be fixed once fix for #194 is implemented. |
This should be fixed in |
This issue is still present for |
@ThisIsArnab This behaviour is sometimes seen on Windows PowerShell 5.0 and we cannot control this behaviour. The issue disappears after certain number of retries. |
Expected Behavior
Invoking
Install-AWSToolsModule
with the-Cleanup
parameter should always work, even if no clean-up needs to be performed, or noAWS.Tools
modules have been installed (excluding the Installer).Current Behavior
In some circumstances invoking
Install-AWSToolsModule
with the-Cleanup
parameter can result in an unhandled exception:This appears to be due to the internal
Get-AWSToolsModule
function not returning any objects if there are noAWS.Tools
modules installed. The function filters out theAWS.Tools.Installer
module.The absence of any returned objects means the subsequent code operates on a
null
object. While the variable is explicitly typed as aPSModuleInfo
array, as no objects are ever returned from the function it's never initialised. The subsequent code attempts to iterate anull
object and access non-existent properties on the array members.Possible Solution
Either explicitly check that the array variable isn't
null
or ensure it's always initialised.Steps to Reproduce (for bugs)
On a system which does not have any existing
AWS.Tools.*
modules installed:Context
Habitually using the
-Cleanup
parameter inInstall-AWSToolsModule
invocations as well as various script logic in continuous integration scenarios. Manually checking for the presence of any existingAWS.Tools.*
modules (minus the installer itself) should not be required.Your Environment
AWS.Tools.Installer
Get-AWSPowerShellVersion
: 4.0.5.0$PSVersionTable.OS
: Property not present on PowerShell 5.1 (Windows Server 2016)$PSVersionTable.PSEdition
: DesktopThe text was updated successfully, but these errors were encountered: