Skip to content
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

[Bug] Get-DbaBuildReference warns about incorrect parameters when run with -Update #6438

Closed
nvarscar opened this issue Mar 24, 2020 · 3 comments
Closed
Labels

Comments

@nvarscar
Copy link
Contributor

@nvarscar nvarscar commented Mar 24, 2020

Environmental information

#### PowerShell version:

Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Darwin 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan  9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0



#### dbatools Module version:

Name    : dbatools
Path    : /Users/kkravtsov/.local/share/powershell/Modules/dbatools/1.0.97/dbatools.psd1
Version : 1.0.97

Name    : dbatools
Path    : /Users/kkravtsov/.local/share/powershell/Modules/dbatools/1.0.88/dbatools.psd1
Version : 1.0.88

Name    : dbatools
Path    : /Users/kkravtsov/.local/share/powershell/Modules/dbatools/0.9.822/dbatools.psd1
Version : 0.9.822



LCID             Name             DisplayName
----             ----             -----------
4105             en-CA            English (Canada)

Report

WARNING: [17:11:15][Get-DbaBuildReferenceIndex] Index is stale, last update on: 2019-06-03T00:00:00, try the -Update parameter to fetch the most up to date index
[ PS7.0 ] Users/kkravtsov> Get-DbaBuildReference -Update
[15:02:05][Get-DbaBuildReferenceIndex] Index updated correctly, last update on: 2020-02-26T00:00:00, was 2020-02-11T00:00:00
WARNING: [15:02:05][Get-DbaBuildReference] You need to choose at least one parameter.

Host used

  • /usr/local/bin/pwsh
  • ISE
  • VS Code
  • Other (please specify)

If anything other than powershell.exe was used, please confirm that you can duplicate the issue with powershell.exe

  • Still buggy in /usr/local/bin/pwsh

Errors Received

@{PSMessageDetails=; Exception=System.Exception: You need to choose at least one parameter.; TargetObject=; CategoryInfo=InvalidArgument: (:) [Write-Error], Exception; FullyQualifiedErrorId=dbatools_Get-DbaBuildReference,Stop-Function; ErrorDetails=You need to choose at least one parameter.; InvocationInfo=System.Management.Automation.InvocationInfo; ScriptStackTrace=at Stop-Function, /Users/kkravtsov/.local/share/powershell/Modules/dbatools/1.0.97/allcommands.ps1: line 82614
at Get-DbaBuildReference<Process>, /Users/kkravtsov/.local/share/powershell/Modules/dbatools/1.0.97/allcommands.ps1: line 20426
at <ScriptBlock>, <No file>: line 1; PipelineIterationInfo=System.Collections.ObjectModel.ReadOnlyCollection`1[System.Int32]}

Steps to Reproduce

Get-DbaBuildReference -Update

Expected Behavior

Update BuildRef

Actual Behavior

Show warning

@nvarscar nvarscar added the bugs_life label Mar 24, 2020
wsmelton added a commit that referenced this issue Mar 24, 2020
wsmelton added a commit that referenced this issue Mar 24, 2020
@nvarscar

This comment has been minimized.

Copy link
Contributor Author

@nvarscar nvarscar commented Mar 25, 2020

I just checked the fix - it seems to me that now the -Update switch is mutually exclusive with any other switch, which might break previously allowed things like

Get-DbaBuildReference -Update -SqlInstance localhost

Also, the section where the index is updated is executed before this exclusivity check is performed, which seems a little backwards.

@wsmelton

This comment has been minimized.

Copy link
Member

@wsmelton wsmelton commented Mar 25, 2020

So this warning is not acceptable?

image

@wsmelton

This comment has been minimized.

Copy link
Member

@wsmelton wsmelton commented Mar 25, 2020

Only reason that seems to have been done was for piping...

#4869

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.