From 38d837269ad9d73ba7b4c181af75c7a265cf2cbb Mon Sep 17 00:00:00 2001 From: Danny Song Date: Sat, 20 Apr 2024 23:33:24 -0700 Subject: [PATCH 1/3] Fix bug where parameters could not be toggled off --- .../Cmdlets/WebApps/PublishAzureWebApp.cs | 12 +++++------ .../Websites/help/Publish-AzWebApp.md | 20 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs b/src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs index 1c840fc458d6..e60c7ef81b3a 100644 --- a/src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs +++ b/src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs @@ -49,13 +49,13 @@ public class PublishAzureWebAppCmdlet : WebAppOptionalSlotBaseCmdlet public string Type { get; set; } [Parameter(Mandatory = false, HelpMessage = "Cleans the target directory prior to deploying the file(s).")] - public SwitchParameter Clean { get; set; } + public bool? Clean { get; set; } [Parameter(Mandatory = false, HelpMessage = "The artifact is deployed asynchronously. (The command will exit once the artifact is pushed to the web app.)")] - public SwitchParameter Async { get; set; } + public bool? Async { get; set; } [Parameter(Mandatory = false, HelpMessage = "The web app will be restarted following the deployment. Set this to false if you are deploying multiple artifacts and do not want to restart the site on the earlier deployments.")] - public SwitchParameter Restart { get; set; } + public bool? Restart { get; set; } [Parameter(Mandatory = false, HelpMessage = "Absolute path that the artifact should be deployed to.")] public string TargetPath { get; set; } @@ -120,7 +120,7 @@ public override void ExecuteCmdlet() paramValues.Add("path", TargetPath); // default async to true if not provided to match old behavior - if (Async.IsPresent) + if (Async != null) { paramValues.Add("async", Async.ToString()); } @@ -130,12 +130,12 @@ public override void ExecuteCmdlet() paramValues.Add("async", "true"); } - if (Restart.IsPresent) + if (Restart != null) { paramValues.Add("restart", Restart.ToString()); } - if (Clean.IsPresent) + if (Clean != null) { paramValues.Add("clean", Clean.ToString()); } diff --git a/src/Websites/Websites/help/Publish-AzWebApp.md b/src/Websites/Websites/help/Publish-AzWebApp.md index 475f8fe28170..ad72ab93cafc 100644 --- a/src/Websites/Websites/help/Publish-AzWebApp.md +++ b/src/Websites/Websites/help/Publish-AzWebApp.md @@ -14,16 +14,18 @@ Deploys an Azure Web App from a ZIP, JAR, or WAR file using zipdeploy. ### FromWebApp (Default) ``` -Publish-AzWebApp -ArchivePath [-Type ] [-Clean] [-Async] [-Restart] [-TargetPath ] - [-IgnoreStack] [-Reset] [-Force] [-AsJob] [-Timeout ] [-WebApp] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] +Publish-AzWebApp -ArchivePath [-Type ] [-Clean ] [-Async ] + [-Restart ] [-TargetPath ] [-IgnoreStack] [-Reset] [-Force] [-AsJob] [-Timeout ] + [-WebApp] [-DefaultProfile ] [-WhatIf] + [-Confirm] [] ``` ### FromResourceName ``` -Publish-AzWebApp -ArchivePath [-Type ] [-Clean] [-Async] [-Restart] [-TargetPath ] - [-IgnoreStack] [-Reset] [-Force] [-AsJob] [-Timeout ] [-ResourceGroupName] [-Name] - [[-Slot] ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +Publish-AzWebApp -ArchivePath [-Type ] [-Clean ] [-Async ] + [-Restart ] [-TargetPath ] [-IgnoreStack] [-Reset] [-Force] [-AsJob] [-Timeout ] + [-ResourceGroupName] [-Name] [[-Slot] ] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -111,7 +113,7 @@ Accept wildcard characters: False The artifact is deployed asynchronously. (The command will exit once the artifact is pushed to the web app.) ```yaml -Type: System.Management.Automation.SwitchParameter +Type: System.Nullable`1[System.Boolean] Parameter Sets: (All) Aliases: @@ -126,7 +128,7 @@ Accept wildcard characters: False Cleans the target directory prior to deploying the file(s). ```yaml -Type: System.Management.Automation.SwitchParameter +Type: System.Nullable`1[System.Boolean] Parameter Sets: (All) Aliases: @@ -231,7 +233,7 @@ Accept wildcard characters: False The web app will be restarted following the deployment. Set this to false if you are deploying multiple artifacts and do not want to restart the site on the earlier deployments. ```yaml -Type: System.Management.Automation.SwitchParameter +Type: System.Nullable`1[System.Boolean] Parameter Sets: (All) Aliases: From b47f785a56f28972aac323cb98f72e91480399fa Mon Sep 17 00:00:00 2001 From: Danny Song Date: Mon, 22 Apr 2024 17:22:18 -0700 Subject: [PATCH 2/3] Update changelog --- src/Websites/Websites/ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Websites/Websites/ChangeLog.md b/src/Websites/Websites/ChangeLog.md index 0b8aec5b8506..64411cd7e731 100644 --- a/src/Websites/Websites/ChangeLog.md +++ b/src/Websites/Websites/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Allow certain parameters to be toggled off for `Publish-AzWebApp`` ## Version 3.2.0 * Fixed Ambiguous Positional Argument for `New-AzWebAppSlot` From 7c2d4974852acb5d07474fc33c9a8f29b7f28763 Mon Sep 17 00:00:00 2001 From: Danny Song Date: Thu, 9 May 2024 17:17:39 -0700 Subject: [PATCH 3/3] Supress breaking change --- src/Websites/Websites/ChangeLog.md | 2 +- .../Exceptions/Az.Websites/BreakingChangeIssues.csv | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Websites/Websites/ChangeLog.md b/src/Websites/Websites/ChangeLog.md index 64411cd7e731..a155c062fc40 100644 --- a/src/Websites/Websites/ChangeLog.md +++ b/src/Websites/Websites/ChangeLog.md @@ -18,7 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release -* Allow certain parameters to be toggled off for `Publish-AzWebApp`` +* Allow clean and restart parameters to be toggled off for `Publish-AzWebApp`` ## Version 3.2.0 * Fixed Ambiguous Positional Argument for `New-AzWebAppSlot` diff --git a/tools/StaticAnalysis/Exceptions/Az.Websites/BreakingChangeIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Websites/BreakingChangeIssues.csv index 1f1472231ced..0cb06feeebbe 100644 --- a/tools/StaticAnalysis/Exceptions/Az.Websites/BreakingChangeIssues.csv +++ b/tools/StaticAnalysis/Exceptions/Az.Websites/BreakingChangeIssues.csv @@ -1,2 +1,5 @@ "Module","ClassName","Target","Severity","ProblemId","Description","Remediation" "Az.Websites","Microsoft.Azure.Commands.WebApps.Cmdlets.DeploymentSlots.NewAzureWebAppSlotCmdlet","New-AzWebAppSlot","0","1050","The parameter set '__AllParameterSets' for cmdlet 'New-AzWebAppSlot' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'New-AzWebAppSlot'." +"Az.Websites","Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps.PublishAzureWebAppCmdlet","New-AzWebAppSlot","0","1050","The cmdlet 'Publish-AzWebApp' no longer supports the type 'System.Management.Automation.SwitchParameter' for parameter 'Clean'.","Change the type for parameter 'Clean' back to 'System.Management.Automation.SwitchParameter'." +"Az.Websites","Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps.PublishAzureWebAppCmdlet","New-AzWebAppSlot","0","1050","The cmdlet 'Publish-AzWebApp' no longer supports the type 'System.Management.Automation.SwitchParameter' for parameter 'Async'.","Change the type for parameter 'Async' back to 'System.Management.Automation.SwitchParameter'." +"Az.Websites","Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps.PublishAzureWebAppCmdlet","New-AzWebAppSlot","0","1050","The cmdlet 'Publish-AzWebApp' no longer supports the type 'System.Management.Automation.SwitchParameter' for parameter 'Restart'.","Change the type for parameter 'Restart' back to 'System.Management.Automation.SwitchParameter'." \ No newline at end of file