Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.

Commit 409dccf

Browse files
authored
Full EDB support (experimental) (#39)
!Deploy * initial full ese support for registration and partial for device and status report * fixed Get-ESEDevice internal function * moved specific set edb types to generic function * add edb support to New-DSCPullServerAdminDevice * added edb functionality to Set-DSCPullServerAdminDevice * fixed convertfrom-json when value is null * do not process primary keys in edb * enabled edb for New and Set StatusReport * improved connection handling between pipeline functions. Added EDB ad-hoc connection option to all non get functions. Added test for Test-DSCPullServerESEDatabase * added Top support for EDB * fixed bug in Set-DSCPullServerAdminRegistrion * initial Copy from anywhere to anywhere function. Removed edb to sql specific function * some enhancements to GetConnection handling * updated tests * fixes for nullable datetime properties (#38)
1 parent 5d584e3 commit 409dccf

File tree

56 files changed

+2958
-1100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2958
-1100
lines changed

.build.ps1

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ param (
1313

1414
[switch] $ForceEnvironmentVariables = [switch]$true,
1515

16-
$MergeList = @('enum*',[PSCustomObject]@{Name='class*';order={(Import-PowerShellDataFile -EA 0 .\*\Classes\classes.psd1).order.indexOf($_.BaseName)}},'priv*','pub*')
17-
18-
,$TaskHeader = {
16+
$MergeList = @('enum*',[PSCustomObject]@{Name='class*';order={(Import-PowerShellDataFile -EA 0 .\*\Classes\classes.psd1).order.indexOf($_.BaseName)}},'priv*','pub*'),
17+
18+
$TaskHeader = {
1919
param($Path)
2020
''
2121
'=' * 79
@@ -25,9 +25,11 @@ param (
2525
Write-Build DarkGray " $Path"
2626
Write-Build DarkGray " $($Task.InvocationInfo.ScriptName):$($Task.InvocationInfo.ScriptLineNumber)"
2727
''
28-
}
28+
},
29+
30+
$CodeCoverageThreshold = 70,
2931

30-
,$CodeCoverageThreshold = 70
32+
[switch] $UpdateModulePathOnly
3133
)
3234

3335
Process {
@@ -135,7 +137,10 @@ begin {
135137
$Env:PSModulePath = (Join-Path $BuildOutput 'modules') + ';' + $Env:PSModulePath
136138
}
137139

138-
140+
if ($UpdateModulePathOnly) {
141+
break
142+
}
143+
139144
if ($ResolveDependency) {
140145
Write-Host "Resolving Dependencies... [this can take a moment]"
141146
$Params = @{}

.build/Release/MergeModule.Release.build.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
[string] $ModuleVersion = (property ModuleVersion $(
99
if($resolvedModuleVersion = Get-NextNugetPackageVersion -Name $ProjectName -ErrorAction SilentlyContinue) {
10-
if ($resolvedModuleVersion -gt [version]'0.2.0') {
10+
if ($resolvedModuleVersion -gt [version]'0.3.0') {
1111
$resolvedModuleVersion
1212
} else {
13-
'0.2.0'
13+
'0.3.0'
1414
}
1515
} else {
16-
'0.2.0'
16+
'0.3.0'
1717
}
1818
)),
1919

DSCPullServerAdmin/DSCPullServerAdmin.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ FunctionsToExport = @(
8989
'Set-DSCPullServerAdminDevice',
9090
'Set-DSCPullServerAdminRegistration',
9191
'Set-DSCPullServerAdminStatusReport',
92-
'Copy-DSCPullServerAdminDataESEToSQL',
92+
'Copy-DSCPullServerAdminData',
9393
'New-DSCPullServerAdminSQLDatabase'
9494
)
9595

@@ -126,7 +126,7 @@ PrivateData = @{
126126
# IconUri = ''
127127

128128
# ReleaseNotes of this module
129-
ReleaseNotes = 'No changes, build pipeline update to create GitHub releases togheter with PSGallery Publishing'
129+
ReleaseNotes = 'Implemented full EDB support (experimental): Set, Remove and New Device, Registration and StatusReport.'
130130

131131
} # End of PSData hashtable
132132

DSCPullServerAdmin/classes/DSCDevice.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ class DSCDevice {
8181
} else {
8282
"$($_.Name) = '{0}'" -f $this."$($_.Name)".ToString('yyyy-MM-dd HH:mm:ss')
8383
}
84+
} elseif ($_.Definition.Split(' ')[0] -like '*nullable*' -and $null -eq $this."$($_.Name)") {
85+
"$($_.Name) = NULL"
8486
} else {
8587
"$($_.Name) = '{0}'" -f $this."$($_.Name)"
8688
}
@@ -103,6 +105,8 @@ class DSCDevice {
103105
} else {
104106
"'{0}'" -f $this."$($_.Name)".ToString('yyyy-MM-dd HH:mm:ss')
105107
}
108+
} elseif ($_.Definition.Split(' ')[0] -like '*nullable*' -and $null -eq $this."$($_.Name)") {
109+
'NULL'
106110
} else {
107111
"'{0}'" -f $this."$($_.Name)"
108112
}

DSCPullServerAdmin/classes/DSCNodeStatusReport.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class DSCNodeStatusReport {
1919

2020
[IPAddress[]] $IPAddress
2121

22-
[datetime] $StartTime
22+
[nullable[datetime]] $StartTime
2323

24-
[datetime] $EndTime
24+
[nullable[datetime]] $EndTime
2525

26-
[datetime] $LastModifiedTime # Only applicable for ESENT, Not present in SQL
26+
[nullable[datetime]] $LastModifiedTime # Only applicable for ESENT, Not present in SQL
2727

2828
[PSObject[]] $Errors
2929

@@ -77,12 +77,14 @@ class DSCNodeStatusReport {
7777
} elseif ($_.Name -eq 'AdditionalData') {
7878
"$($_.Name) = '[{0}]'" -f ($this."$($_.Name)" | ConvertTo-Json -Compress -Depth 100)
7979
} else {
80-
if ($_.Definition.Split(' ')[0] -eq 'datetime') {
80+
if ($_.Definition.Split(' ')[0] -like '*datetime*' -and -not $null -eq $this."$($_.Name)") {
8181
if ($this."$($_.Name)".ToString('yyyy-MM-dd HH:mm:ss') -eq '0001-01-01 00:00:00') {
8282
"$($_.Name) = NULL"
8383
} else {
8484
"$($_.Name) = '{0}'" -f $this."$($_.Name)".ToString('yyyy-MM-dd HH:mm:ss')
8585
}
86+
} elseif ($_.Definition.Split(' ')[0] -like '*nullable*' -and $null -eq $this."$($_.Name)") {
87+
"$($_.Name) = NULL"
8688
} else {
8789
"$($_.Name) = '{0}'" -f $this."$($_.Name)"
8890
}
@@ -106,12 +108,14 @@ class DSCNodeStatusReport {
106108
} elseif ($_.Name -eq 'AdditionalData') {
107109
"'{0}'" -f ($this."$($_.Name)" | ConvertTo-Json -Compress -Depth 100)
108110
} else {
109-
if ($_.Definition.Split(' ')[0] -eq 'datetime') {
111+
if ($_.Definition.Split(' ')[0] -like '*datetime*' -and -not $null -eq $this."$($_.Name)") {
110112
if ($this."$($_.Name)".ToString('yyyy-MM-dd HH:mm:ss') -eq '0001-01-01 00:00:00') {
111113
'NULL'
112114
} else {
113115
"'{0}'" -f $this."$($_.Name)".ToString('yyyy-MM-dd HH:mm:ss')
114116
}
117+
} elseif ($_.Definition.Split(' ')[0] -like '*nullable*' -and $null -eq $this."$($_.Name)") {
118+
'NULL'
115119
} else {
116120
"'{0}'" -f $this."$($_.Name)"
117121
}

DSCPullServerAdmin/classes/DSCPullServerESEConnection.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ class DSCPullServerESEConnection : DSCPullServerConnection {
33
hidden [object] $Instance
44
hidden [object] $SessionId
55
hidden [object] $DbId
6+
hidden [object] $TableId
67

78
DSCPullServerESEConnection () : base([DSCPullServerConnectionType]::ESE) { }
89

DSCPullServerAdmin/private/Dismount-DSCPullServerESEDatabase.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ function Dismount-DSCPullServerESEDatabase {
2828
$Connection.Instance = $null
2929
$Connection.SessionId = $null
3030
$Connection.DbId = $null
31+
$Connection.TableId = $null
3132
}

DSCPullServerAdmin/private/Get-DSCPullServerESEDevice.ps1

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)