azure-powershell
azure-powershell copied to clipboard
[SQL] Rework confirmation prompt usage in sql base class
Description
before:

after:

Most of our cmdlets do explicitly check ShouldProcess, but the base cmdlet class also does the similar thing - so we end up prompting twice for the same thing. Base class's ExecuteCmdlet doesn't really support ShouldContinue logic, so here I'm switching it up a little bit to enable that (hopefully without breaking existing cmdlet logic)
Also, base ExecuteCmdlet would write output even if the action was not performed (i.e. prompt declined) - and would write the 'updated' model which IMO is quite confusing so that's also fixed.
This PR though doesn't attempt to clean up the double-prompts (that can be done separately) In addition to that, we could work on the docs to avoid further prompt duplication in sql module cmdlets
Checklist
- [ ] Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:
- SHOULD select appropriate branch. Cmdlets from Autorest.PowerShell should go to
generationbranch. - SHOULD make the title of PR clear and informative, and in the present imperative tense.
- SHOULD update
ChangeLog.mdfile(s) appropriately- For any service, the
ChangeLog.mdfile can be found atsrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md - A snippet outlining the change(s) made in the PR should be written under the
## Upcoming Releaseheader in the past tense. Add changelog in description section if PR goes intogenerationbranch. - Should not change
ChangeLog.mdif no new release is required, such as fixing test case only.
- For any service, the
- SHOULD have approved design review for the changes in this repository (Microsoft internal only) with following situations
- Create new module from the scratch
- Create new resource types which are not easy to conform to Azure PowerShell Design Guidelines
- Create new resource type which name doesn't use module name as prefix
- Have design question before implementation
- SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
- SHOULD have proper test coverage for changes in pull request.
- SHOULD NOT introduce breaking changes in Az minor release except preview version.
- SHOULD NOT change version of module in pull request