Skip to content

Commit

Permalink
Fix bug to allow params to be toggled off
Browse files Browse the repository at this point in the history
Update ChangeLog
  • Loading branch information
dannysongg authored and msJinLei committed Sep 25, 2024
1 parent 3b49cdc commit 89a4dae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
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
* Fix bug where parameters could not be set to false for `Publish-AzWebApp`

## Version 3.2.1
* Introduced secrets detection feature to safeguard sensitive data.
Expand Down
13 changes: 7 additions & 6 deletions src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,33 +119,34 @@ public override void ExecuteCmdlet()

paramValues.Add("path", TargetPath);

// Purposely using IsParameterBound to check if the parameter is passed or not. In this case we want to return true if $false is passed.
// We only want to set the parameter if a value is passed.
// default async to true if not provided to match old behavior
if (Async.IsPresent)
if (this.IsParameterBound(c => c.Async))
{
paramValues.Add("async", Async.ToString());
}

else
{
paramValues.Add("async", "true");
}

if (Restart.IsPresent)
if (this.IsParameterBound(c => c.Restart))
{
paramValues.Add("restart", Restart.ToString());
}

if (Clean.IsPresent)
if (this.IsParameterBound(c => c.Clean))
{
paramValues.Add("clean", Clean.ToString());
}

if (IgnoreStack.IsPresent)
if (this.IsParameterBound(c => c.IgnoreStack))
{
paramValues.Add("ignorestack", IgnoreStack.ToString());
}

if (Reset.IsPresent)
if (this.IsParameterBound(c => c.Reset))
{
paramValues.Add("reset", Reset.ToString());
}
Expand Down

0 comments on commit 89a4dae

Please sign in to comment.