Skip to content

Commit

Permalink
Update Scope WhatIf (#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jefajers authored Dec 19, 2022
1 parent a3bac33 commit 0e95557
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/internal/functions/New-AzOpsDeployment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@
if ((Get-PSFConfigValue -FullName 'AzOps.Core.AutoGeneratedTemplateFolderPath') -ne '.') {
$pathDir = Split-Path -Path $pathDir -Parent
}
$parentDirScopeObject = New-AzOpsScope -Path (Split-Path -Path $pathDir -Parent) | Where-Object {(-not ($_.StatePath).StartsWith('azopsscope-assume-new-resource_'))}
$parentIdScope = New-AzOpsScope -Scope (($resource).properties.details.parent.id) | Where-Object {(-not ($_.StatePath).StartsWith('azopsscope-assume-new-resource_'))}
$parentDirScopeObject = New-AzOpsScope -Path (Split-Path -Path $pathDir -Parent) -WhatIf:$false | Where-Object {(-not ($_.StatePath).StartsWith('azopsscope-assume-new-resource_'))}
$parentIdScope = New-AzOpsScope -Scope (($resource).properties.details.parent.id) -WhatIf:$false | Where-Object {(-not ($_.StatePath).StartsWith('azopsscope-assume-new-resource_'))}
# Validate parent existence with content parent scope, statepath and name match, determines file location match deployment scope
if ($parentDirScopeObject -and $parentIdScope -and $parentDirScopeObject.Scope -eq $parentIdScope.Scope -and $parentDirScopeObject.StatePath -eq $parentIdScope.StatePath -and $parentDirScopeObject.Name -eq $parentIdScope.Name) {
# Validate directory name match resource information
Expand Down
2 changes: 1 addition & 1 deletion src/tests/integration/Repository.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ Describe "Repository" {
$changeSet = @(
"A`t$($script:pushmgmttest2idManagementGroupTemplatePath.FullName[1])"
)
{Invoke-AzOpsPush -ChangeSet $changeSet -WhatIf:$true} | Should -Throw
{Invoke-AzOpsPush -ChangeSet $changeSet} | Should -Throw
}
#endregion

Expand Down

0 comments on commit 0e95557

Please sign in to comment.