Skip to content

Commit

Permalink
DnsServerDsc: Replace ConvertTo-HashTableFromObject (#263)
Browse files Browse the repository at this point in the history
- DnsServerDsc
  - Replaced the private function `ConvertTo-HashTableFromObject` with the
    public function `ConvertFrom-DscResourceInstance` (from _DscResource.Common_).
  • Loading branch information
johlju authored Jun 29, 2021
1 parent 4126562 commit 935e86c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 81 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
use the new GitHub issue forms template.
- Changed the issue template for proposing a new resource to use the new
GitHub issue forms template.
- Replaced the private function `ConvertTo-HashTableFromObject` with the
public function `ConvertFrom-DscResourceInstance` (from _DscResource.Common_).

## [3.0.0] - 2021-05-26

Expand Down
4 changes: 2 additions & 2 deletions source/Classes/001.ResourceBase.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ class ResourceBase
#>
hidden [System.Collections.Hashtable[]] Compare()
{
$currentState = $this.Get() | ConvertTo-HashTableFromObject
$desiredState = $this | ConvertTo-HashTableFromObject
$currentState = $this.Get() | ConvertFrom-DscResourceInstance
$desiredState = $this | ConvertFrom-DscResourceInstance

<#
Remove properties that have $null as the value, and remove read
Expand Down
8 changes: 4 additions & 4 deletions source/Classes/002.DnsRecordBase.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ class DnsRecordBase : ResourcePropertiesBase
{
if ($null -ne $existingRecord)
{
$currentState = $this.Get() | ConvertTo-HashTableFromObject
$desiredState = $this | ConvertTo-HashTableFromObject
$currentState = $this.Get() | ConvertFrom-DscResourceInstance
$desiredState = $this | ConvertFrom-DscResourceInstance

# Remove properties that have $null as the value
@($desiredState.Keys) | ForEach-Object -Process {
Expand Down Expand Up @@ -196,8 +196,8 @@ class DnsRecordBase : ResourcePropertiesBase
{
$isInDesiredState = $true

$currentState = $this.Get() | ConvertTo-HashTableFromObject
$desiredState = $this | ConvertTo-HashTableFromObject
$currentState = $this.Get() | ConvertFrom-DscResourceInstance
$desiredState = $this | ConvertFrom-DscResourceInstance

if ($this.Ensure -eq 'Present')
{
Expand Down
26 changes: 0 additions & 26 deletions source/Private/ConvertTo-HashtableFromObject.ps1

This file was deleted.

49 changes: 0 additions & 49 deletions tests/Unit/Private/ConvertTo-HashtableFromObject.tests.ps1

This file was deleted.

0 comments on commit 935e86c

Please sign in to comment.