Skip to content

Fix bug where parameters could not be toggled off #24705

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Websites/Websites/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
12 changes: 6 additions & 6 deletions src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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());
}
Expand All @@ -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());
}
Expand Down
20 changes: 11 additions & 9 deletions src/Websites/Websites/help/Publish-AzWebApp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ Deploys an Azure Web App from a ZIP, JAR, or WAR file using zipdeploy.

### FromWebApp (Default)
```
Publish-AzWebApp -ArchivePath <String> [-Type <String>] [-Clean] [-Async] [-Restart] [-TargetPath <String>]
[-IgnoreStack] [-Reset] [-Force] [-AsJob] [-Timeout <Double>] [-WebApp] <PSSite>
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
Publish-AzWebApp -ArchivePath <String> [-Type <String>] [-Clean <Boolean>] [-Async <Boolean>]
[-Restart <Boolean>] [-TargetPath <String>] [-IgnoreStack] [-Reset] [-Force] [-AsJob] [-Timeout <Double>]
[-WebApp] <PSSite> [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
[-Confirm] [<CommonParameters>]
```

### FromResourceName
```
Publish-AzWebApp -ArchivePath <String> [-Type <String>] [-Clean] [-Async] [-Restart] [-TargetPath <String>]
[-IgnoreStack] [-Reset] [-Force] [-AsJob] [-Timeout <Double>] [-ResourceGroupName] <String> [-Name] <String>
[[-Slot] <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
Publish-AzWebApp -ArchivePath <String> [-Type <String>] [-Clean <Boolean>] [-Async <Boolean>]
[-Restart <Boolean>] [-TargetPath <String>] [-IgnoreStack] [-Reset] [-Force] [-AsJob] [-Timeout <Double>]
[-ResourceGroupName] <String> [-Name] <String> [[-Slot] <String>] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -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:

Expand All @@ -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:

Expand Down Expand Up @@ -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:

Expand Down