RamblingCookieMonster / BuildHelpers

Helper functions for PowerShell CI/CD scenarios
MIT License
214 stars 47 forks source link

Strange error when using Set-ModuleFunctions during AppVeyor build #121

Open tomer-ds opened 4 years ago

tomer-ds commented 4 years ago

Hi... got the error below when attempting to update the module functions during my appveyor build.

At C:\projects\mp-infra\psake.ps1:49 char:5 + Set-ModuleFunctions -Name $Manifest -Debug + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: Exception calling "ShouldProcess" with "1" argument(s): "The method or operation is not implemented." --> The method or operation is not implemented. Command executed with exception: Exception calling "ShouldProcess" with "1" argument(s): "The method or operation is not implemented."

I can only imagine it has something to do with the usage of SupportsShouldProcess in your functions. Is it possilble that the lack of an explicit $true is causing this?

Anyway I have a branch where this has been changed... I can attempt to fix it if you want, but would be great if you could take a look.

Edit: The issue only appears when I pass a specific path for the manifest. Will add the output in a comment below

tomer-ds commented 4 years ago

VERBOSE: Loading module from path 'C:\projects\mp-infra\BuildOutput\Essentials\MPPowerShell\MPPowerShell.psd1'. VERBOSE: Loading module from path 'C:\projects\mp-infra\BuildOutput\Essentials\MPPowerShell\MPPowerShell.psm1'. VERBOSE: Importing function 'Add-CustomDns'. VERBOSE: Importing function 'Add-RegistryKeyOrValue'. VERBOSE: Importing function 'Confirm-WinUserName'. VERBOSE: Importing function 'ConvertTo-Hashtable'. VERBOSE: Importing function 'Export-MPInstancesWithTags'. VERBOSE: Importing function 'Format-Json'. VERBOSE: Importing function 'Get-CurrentLbDetails'. VERBOSE: Importing function 'Get-CurrentTargets'. VERBOSE: Importing function 'Get-DotNetVersion'. VERBOSE: Importing function 'Get-Dump'. VERBOSE: Importing function 'Get-DynamoDBItem'. VERBOSE: Importing function 'Get-InstanceIdFromMetadata'. VERBOSE: Importing function 'Get-InstanceList'. VERBOSE: Importing function 'Get-InstanceRegionFromMetadata'. VERBOSE: Importing function 'Get-InstanceTagByTagKey'. VERBOSE: Importing function 'Get-IpFromInstanceId'. VERBOSE: Importing function 'Get-IPGeolocation'. VERBOSE: Importing function 'Get-ListenerRules'. VERBOSE: Importing function 'Get-MPCachedInstances'. VERBOSE: Importing function 'Get-MPInstanceState'. VERBOSE: Importing function 'Get-ScmLeader'. VERBOSE: Importing function 'Get-SecretsCredentials'. VERBOSE: Importing function 'Get-TagValueByInstanceId'. VERBOSE: Importing function 'Get-ZabbixHostID'. VERBOSE: Importing function 'Get-ZabbixItems'. VERBOSE: Importing function 'Get-ZabbixItemTrends'. VERBOSE: Importing function 'Initialize-AwsSession'. VERBOSE: Importing function 'Install-Chocolatey'. VERBOSE: Importing function 'Invoke-Lambda'. VERBOSE: Importing function 'Invoke-TCPing'. VERBOSE: Importing function 'Invoke-ZabbixAgentD'. VERBOSE: Importing function 'New-DynamoDbSession'. VERBOSE: Importing function 'New-MPScheduledTask'. VERBOSE: Importing function 'New-ZabbixSession'. VERBOSE: Importing function 'Read-DynamoDbTable'. VERBOSE: Importing function 'Register-NewWinUser'. VERBOSE: Importing function 'Remove-AWSProfileName'. VERBOSE: Importing function 'Remove-DynamoDbItem'. VERBOSE: Importing function 'Remove-ZabbixItemsByID'. VERBOSE: Importing function 'Restart-MPServices'. VERBOSE: Importing function 'Send-Zabbix4'. VERBOSE: Importing function 'Set-AutoScalingDesired'. VERBOSE: Importing function 'Set-DynamoDbItem'. VERBOSE: Importing function 'Set-MPPreprod'. VERBOSE: Importing function 'Set-MPSites'. VERBOSE: Importing function 'Set-ServiceLogOnUser'. VERBOSE: Importing function 'Set-ServiceRecovery'. VERBOSE: Importing function 'Set-StandbyInstanceStates'. VERBOSE: Importing function 'Set-ZabbixHostsExternal'. VERBOSE: Importing function 'Set-ZabbixHostStatus'. VERBOSE: Importing function 'Start-CheckMPServices'. VERBOSE: Importing function 'Start-FeatureToggler'. VERBOSE: Importing function 'Start-MPInstances'. VERBOSE: Importing function 'Start-MPServices'. VERBOSE: Importing function 'Start-RedisCli'. VERBOSE: Importing function 'Start-ScmLeaderAcquisition'. VERBOSE: Importing function 'Start-SelectedScmLeaderAcquisition'. VERBOSE: Importing function 'Start-ServiceWithTimeout'. VERBOSE: Importing function 'Stop-MPInstances'. VERBOSE: Importing function 'Stop-MPServices'. VERBOSE: Importing function 'Stop-ScmLeaderAcquisition'. VERBOSE: Importing function 'Stop-ServiceWithTimeout'. VERBOSE: Importing function 'Switch-BlueGreen'. VERBOSE: Importing function 'Switch-ScmLeader'. VERBOSE: Importing function 'Test-APISessionExist'. VERBOSE: Importing function 'Test-MPInstanceState'. VERBOSE: Importing function 'Test-MPInstanceStatus'. VERBOSE: Importing function 'Test-RegistryKeyOrValue'. VERBOSE: Importing function 'Test-Services'. VERBOSE: Importing function 'Test-SQLDatabase'. VERBOSE: Importing function 'Update-DynamoDbItem'. VERBOSE: Importing function 'Update-RegistryKeyValue'. VERBOSE: Importing function 'Wait-ForScmNewLeader'. VERBOSE: Importing function 'Wait-MPInstanceToPassStatusChecks'. VERBOSE: Importing function 'Wait-MPInstanceToReachState'. VERBOSE: Importing function 'Write-Log'. VERBOSE: Importing function 'Write-ToHostsFile'. Updating functions for manifest: C:\projects\mp-infra\BuildOutput\Essentials\MPPowerShell\MPPowerShell.psd1 Error: 3/26/2020 8:01:10 AM: At C:\projects\mp-infra\psake.ps1:50 char:5 + Set-ModuleFunctions -Path $ModuleManifest -Verbose -Debug -ErrorA ... + ~~~~~~~~~~~~~ [<<==>>] Exception: Exception calling "ShouldProcess" with "1" argument(s): "The method or operation is not implemented." --> The method or operation is not implemented. Command executed with exception: Exception calling "ShouldProcess" with "1" argument(s): "The method or operation is not implemented."

tomer-ds commented 4 years ago

Tried it again from a different location. I figured maybe if it updated the functions before I move the file, but stils no luck, and this is without specifying path to manifest

Done. Loading modules and setting build environment with BuildHelpers Done. Making directories and moving files and folders Updating functions for manifest: Exception calling "ShouldProcess" with "1" argument(s): "The method or operation is not implemented." At C:\Users\appveyor\Documents\WindowsPowerShell\Modules\BuildHelpers\2.0.11\Public\Set-ModuleFunction.ps1:77 char:13 If ($PSCmdlet.ShouldProcess("Updating list of exported functi ...


     CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
     FullyQualifiedErrorId : NotImplementedException

Essentials created