Skip to content

Commit ec06ad0

Browse files
authored
Merge pull request #172 from SQLPlayer/issue171
Bug fixed: Loading ADF from code fails when excluding any object and …
2 parents eddc476 + e8828cf commit ec06ad0

File tree

5 files changed

+43
-5
lines changed

5 files changed

+43
-5
lines changed

azure.datafactory.tools.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Kamil Nowinski @ SQLPlayer.net
55
#
6-
# Generated on: 10/10/2021
6+
# Generated on: 07/12/2021
77
#
88

99
@{
@@ -12,7 +12,7 @@
1212
RootModule = 'azure.datafactory.tools.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.95.0'
15+
ModuleVersion = '0.95.1'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

7+
## [0.95.1] - 2021-12-07
8+
* Bug fixed: Loading ADF from code fails when excluding any object and ManagedVNET exist #171
9+
710
## [0.95.0] - 2021-10-23
811
* Added structure to return object for Test-AdfCode which allows to check number of warnings too
912
* Fixed tests

private/AdfObject.class.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ class AdfObject {
7474
$ofn = ''
7575
if ($this.Body.PSObject.Properties.Name -contains "properties")
7676
{
77-
$o = $this.Body.properties
78-
if ($o.PSobject.Properties.Name -contains "folder")
77+
$o = $this.Body.Properties
78+
if ($o.PSobject.Properties -ne $null -and $o.PSobject.Properties.Name -contains "folder")
7979
{
80-
$ofn = $this.Body.properties.folder.name
80+
$ofn = $this.Body.Properties.folder.name
8181
}
8282
}
8383
return $ofn

test/ApplyExclusionOptions.Tests.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,32 @@ InModuleScope azure.datafactory.tools {
2727
}
2828

2929
}
30+
31+
Describe 'of BigFactorySample2_vnet without properties node and exclude rules' {
32+
BeforeEach {
33+
$DataFactoryName = "BigFactorySample2_vnet"
34+
$RootFolder = Join-Path -Path $PSScriptRoot -ChildPath $DataFactoryName
35+
$vnetFile = Join-Path $RootFolder 'managedVirtualNetwork\default.json'
36+
$bf = Backup-File -FileName $vnetFile
37+
}
38+
39+
It 'Should completed successfully' {
40+
Remove-ObjectPropertyFromFile -FileName $vnetFile -Path 'properties'
41+
$adf = Import-AdfFromFolder -FactoryName $DataFactoryName -RootFolder $RootFolder
42+
$option = [AdfPublishOption]::new()
43+
$option.Excludes.Add('managedVirtualNetwork*.*', '')
44+
$adf.PublishOptions = $option
45+
{ ApplyExclusionOptions -adf $adf } | Should -Not -Throw
46+
#$bf
47+
}
48+
49+
AfterEach {
50+
if ($bf) {
51+
Write-Verbose "Restoring file from backup: $bf"
52+
Restore-File -FileName $bf -RemoveBackup $true
53+
}
54+
}
55+
56+
}
57+
3058
}

test/adfObject-class.Tests.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ InModuleScope azure.datafactory.tools {
5656
}
5757
}
5858

59+
Context 'When the object has limited nodes in it' {
60+
It 'Should not throw an error' {
61+
$o = New-AdfObjectFromFile -fileRelativePath 'BigFactorySample2_vnet\managedVirtualNetwork\default.json' -type 'managedVirtualNetwork' -name 'default'
62+
$o.Body.Properties.PSObject.Properties.Remove('preventDataExfiltration')
63+
{ $o.GetFolderName() } | Should -Not -Throw
64+
}
65+
}
5966

6067
}
6168

0 commit comments

Comments
 (0)