azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

[SQL] Rework confirmation prompt usage in sql base class

Open ostojicb opened this issue 3 years ago • 0 comments

Description

before: image

after: image

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.md and reviewed the following information:
  • SHOULD select appropriate branch. Cmdlets from Autorest.PowerShell should go to generation branch.
  • SHOULD make the title of PR clear and informative, and in the present imperative tense.
  • SHOULD update ChangeLog.md file(s) appropriately
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense. Add changelog in description section if PR goes into generation branch.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • 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

ostojicb avatar Jul 26 '22 15:07 ostojicb