Skip to content

Commit

Permalink
Merge pull request #24 from AsrOneSdk/dev/vijami/FixForClearingTagsFo…
Browse files Browse the repository at this point in the history
…rResource

[V2A / H2A] Fixed the resource tagging parameters to clear off tags case in Set(Update) ProtectedItem cmdlet
  • Loading branch information
vidyadharijami authored Apr 9, 2021
2 parents 28e2299 + 71de23e commit f88afa3
Showing 1 changed file with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,21 @@ public class SetAzureRmRecoveryServicesAsrReplicationProtectedItem : SiteRecover
/// Gets or sets target VM tags.
/// </summary>
[Parameter]
[ValidateNotNullOrEmpty]
[ValidateNotNull]
public IDictionary<string, string> RecoveryVmTag { get; set; }

/// <summary>
/// Gets or sets the tags for the disks.
/// </summary>
[Parameter]
[ValidateNotNullOrEmpty]
[ValidateNotNull]
public IDictionary<string, string> DiskTag { get; set; }

/// <summary>
/// Gets or sets the tags for the target NICs.
/// </summary>
[Parameter]
[ValidateNotNullOrEmpty]
[ValidateNotNull]
public IDictionary<string, string> RecoveryNicTag { get; set; }

// <summary>
Expand Down Expand Up @@ -458,20 +458,17 @@ public override void ExecuteSiteRecoveryCmdlet()
ToDictionary(x => x.DiskId, x => x.DiskEncryptionSetId);
}

if (this.RecoveryVmTag == null ||
this.RecoveryVmTag.Count == 0)
if (this.RecoveryVmTag == null)
{
recoveryVmTag = providerSpecificDetails.TargetVmTags;
}

if (this.RecoveryNicTag == null ||
this.RecoveryNicTag.Count == 0)
if (this.RecoveryNicTag == null)
{
recoveryNicTag = providerSpecificDetails.TargetNicTags;
}

if (this.DiskTag == null ||
this.DiskTag.Count == 0)
if (this.DiskTag == null)
{
diskTag = providerSpecificDetails.TargetManagedDiskTags;
}
Expand Down Expand Up @@ -572,20 +569,17 @@ public override void ExecuteSiteRecoveryCmdlet()
primaryNic = providerSpecificDetails.SelectedSourceNicId;
}

if (this.RecoveryVmTag == null ||
this.RecoveryVmTag.Count == 0)
if (this.RecoveryVmTag == null)
{
recoveryVmTag = providerSpecificDetails.TargetVmTags;
}

if (this.RecoveryNicTag == null ||
this.RecoveryNicTag.Count == 0)
if (this.RecoveryNicTag == null)
{
recoveryNicTag = providerSpecificDetails.TargetNicTags;
}

if (this.DiskTag == null ||
this.DiskTag.Count == 0)
if (this.DiskTag == null)
{
diskTag = providerSpecificDetails.TargetManagedDiskTags;
}
Expand Down

0 comments on commit f88afa3

Please sign in to comment.