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

Fix the bug that warning message cannot be suppressed #13005

Merged
merged 9 commits into from
Sep 29, 2020

Conversation

Youri970410
Copy link
Contributor

@Youri970410 Youri970410 commented Sep 18, 2020

Description

Fixed bug that always displayed warning Message when executing cmdlet based on MonitorCmdletBase.
#12889

Checklist

  • I have read the Submitting Changes section of CONTRIBUTING.md
  • The title of the PR is clear and informative
  • The appropriate ChangeLog.md file(s) has been updated:
    • 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 -- no new version header should be added
  • The PR does not introduce breaking changes
  • If applicable, the changes made in the PR have proper test coverage
  • For public API changes to cmdlets:
    • a cmdlet design review was approved for the changes in this repository (Microsoft internal only)
    • the markdown help files have been regenerated using the commands listed here

Fixed bug that always displayed warning Message when executing cmdlet based on MonitorCmdletBase
@ghost
Copy link

ghost commented Sep 18, 2020

CLA assistant check
All CLA requirements met.

@@ -89,8 +89,12 @@ public override void ExecuteCmdlet()

try
{
WriteWarningWithTimestamp("*** The namespace for all the model classes will change from Microsoft.Azure.Management.Monitor.Management.Models to Microsoft.Azure.Management.Monitor.Models in future releases.");
WriteWarningWithTimestamp("*** The namespace for output classes will be uniform for all classes in future releases to make it independent of modifications in the model classes.");
var isWarning = bool.Parse(System.Environment.GetEnvironmentVariable("SuppressAzurePowerShellBreakingChangeWarnings"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldSuppress is more accurate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen if Environment is not set?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test case is failed due to above reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it,thanks

@@ -20,6 +20,9 @@

## Upcoming Release

## Version 2.1.1
* Fixed bug that always displayed warning Message when executing cmdlet based on MonitorCmdletBase [#12889]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion is

Fixed the bug that warning message cannot be suppressed. [#12889]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

@@ -89,8 +89,12 @@ public override void ExecuteCmdlet()

try
{
WriteWarningWithTimestamp("*** The namespace for all the model classes will change from Microsoft.Azure.Management.Monitor.Management.Models to Microsoft.Azure.Management.Monitor.Models in future releases.");
WriteWarningWithTimestamp("*** The namespace for output classes will be uniform for all classes in future releases to make it independent of modifications in the model classes.");
var isWarning = bool.Parse(System.Environment.GetEnvironmentVariable("SuppressAzurePowerShellBreakingChangeWarnings"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test case is failed due to above reason.

@Youri970410 Youri970410 changed the title Fix issue [#12889] Fix the bug that warning message cannot be suppressed Sep 18, 2020
@Youri970410 Youri970410 linked an issue Sep 18, 2020 that may be closed by this pull request
@@ -86,14 +86,22 @@ public override void ExecuteCmdlet()
string reasonPhrase = null;
string message = null;
string exName = null;

string warningEnvironmentParam = "SuppressAzurePowerShellBreakingChangeWarnings";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it,thanks.

@dingmeng-xue dingmeng-xue added this to the S176 (2020-10-13) milestone Sep 28, 2020
dingmeng-xue
dingmeng-xue previously approved these changes Sep 28, 2020
@dingmeng-xue dingmeng-xue merged commit 41ed6f1 into Azure:master Sep 29, 2020
@cannehag
Copy link

cannehag commented Dec 3, 2020

When will this be released ?

@wyunchi-ms
Copy link
Contributor

Hi @cannehag , this fix is already included in the latest release of Monitor. Please install the latest Az.Monitor to use it. Here is the way to install the latest release

Install-Module Az.Monitor -Repository PSGallery -Force

@cannehag
Copy link

cannehag commented Dec 4, 2020

@wyunchi-ms I did update and still got the warnings. But after a new test it did work just fine. Thank you!

@wyunchi-ms
Copy link
Contributor

Please try to set SuppressAzurePowerShellBreakingChangeWarnings to True in your environment.

@cannehag
Copy link

cannehag commented Dec 4, 2020

It is working! I had to restart the PS session :)

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

Successfully merging this pull request may close these issues.

Unsuppressable warnings when using Get-AzLog / Get-AzActivityLog
5 participants