Skip to content

Commit 784aeff

Browse files
committed
Add excluded provisiong state to make cancel deployment work
1 parent 6426d39 commit 784aeff

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.ResourceManager.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ public virtual List<PSResourceGroupDeployment> FilterResourceGroupDeployments(Fi
457457
List<PSResourceGroupDeployment> deployments = new List<PSResourceGroupDeployment>();
458458
string resourceGroup = options.ResourceGroupName;
459459
string name = options.DeploymentName;
460+
List<string> excludedProvisioningStates = options.ExcludedProvisioningStates ?? new List<string>();
460461

461462
if (!string.IsNullOrEmpty(resourceGroup) && !string.IsNullOrEmpty(name))
462463
{
@@ -475,7 +476,15 @@ public virtual List<PSResourceGroupDeployment> FilterResourceGroupDeployments(Fi
475476
}
476477
}
477478

478-
return deployments;
479+
if(excludedProvisioningStates.Count > 0)
480+
{
481+
return deployments.Where(d => excludedProvisioningStates
482+
.All(s => !s.Equals(d.ProvisioningState, StringComparison.OrdinalIgnoreCase))).ToList();
483+
}
484+
else
485+
{
486+
return deployments;
487+
}
479488
}
480489

481490
/// <summary>

0 commit comments

Comments
 (0)