-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Update monitor cmdlet warning message #17129
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,20 +60,24 @@ protected string GetCmdletName() | |
/// <param name="withTimeStamp">true if the message should include a timestamp, false (default) it no timestamp should be included</param> | ||
protected void WriteIdentifiedWarning(string cmdletName, string topic, string message, bool withTimeStamp = false) | ||
{ | ||
string formattedMessage = string.Format( | ||
CultureInfo.InvariantCulture, | ||
"[{0}] {1}: {2}", | ||
cmdletName, | ||
topic, | ||
message); | ||
|
||
if (withTimeStamp) | ||
{ | ||
WriteWarningWithTimestamp(formattedMessage); | ||
} | ||
else | ||
string supressWarningOrErrorValue = System.Environment.GetEnvironmentVariable(BreakingChangeAttributeHelper.SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME); | ||
bool supressWarningOrError; | ||
Boolean.TryParse(supressWarningOrErrorValue, out supressWarningOrError); | ||
if (!supressWarningOrError) | ||
{ | ||
WriteWarning(formattedMessage); | ||
string formattedMessage = string.Format( | ||
CultureInfo.InvariantCulture, "{0}{1}{2}", | ||
string.IsNullOrEmpty(cmdletName) ? cmdletName : "[" + cmdletName + "] ", | ||
string.IsNullOrEmpty(topic) ? topic : topic + ": ", | ||
message); | ||
if (withTimeStamp) | ||
{ | ||
WriteWarningWithTimestamp(formattedMessage); | ||
} | ||
else | ||
{ | ||
WriteWarning(formattedMessage); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -87,16 +91,18 @@ public override void ExecuteCmdlet() | |
string reasonPhrase = null; | ||
string message = null; | ||
string exName = null; | ||
string supressWarningOrErrorValue = System.Environment.GetEnvironmentVariable(BreakingChangeAttributeHelper.SUPPRESS_ERROR_OR_WARNING_MESSAGE_ENV_VARIABLE_NAME); | ||
try | ||
{ | ||
bool supressWarningOrError; | ||
Boolean.TryParse(supressWarningOrErrorValue, out supressWarningOrError); | ||
if (!supressWarningOrError) | ||
{ | ||
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."); | ||
} | ||
this.WriteIdentifiedWarning( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WriteIdentifiedWarning("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."); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
cmdletName: "", | ||
topic: "", | ||
message: "*** 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.", | ||
withTimeStamp: true); | ||
this.WriteIdentifiedWarning( | ||
cmdletName: "", | ||
topic: "", | ||
message: "*** The namespace for output classes will be uniform for all classes in future releases to make it independent of modifications in the model classes.", | ||
withTimeStamp: true); | ||
this.ProcessRecordInternal(); | ||
} | ||
catch (AggregateException ex) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check line 96 - 101, remove duplicate logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, please check it.