Skip to content

Commit

Permalink
Move Set-DscADComputer as a helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed Jun 13, 2019
1 parent 4b5e7b5 commit 6a72208
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 51 deletions.
24 changes: 0 additions & 24 deletions DSCResources/MSFT_xADComputer/MSFT_xADComputer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -950,30 +950,6 @@ function Set-TargetResource
}
}

<#
.SYNOPSIS
This is a wrapper for Set-ADComputer.
.PARAMETER Parameters
A hash table containing all parameters that will be passed trough to
Set-ADComputer.
.NOTES
This is needed because of how Pester is unable to handle mocking the
cmdlet Set-ADComputer.
#>
function Set-DscADComputer
{
param
(
[Parameter(Mandatory = $true)]
[System.Collections.Hashtable]
$Parameters
)

Set-ADComputer @Parameters | Out-Null
}

<#
.SYNOPSIS
This evaluates the service principal names current state against the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ $script:modulesFolderPath = Join-Path -Path $script:resourceModulePath -ChildPat
$script:localizationModulePath = Join-Path -Path $script:modulesFolderPath -ChildPath 'xActiveDirectory.Common'
Import-Module -Name (Join-Path -Path $script:localizationModulePath -ChildPath 'xActiveDirectory.Common.psm1')

$script:dscResourcePath = Split-Path -Path $PSScriptRoot -Parent
Import-Module -Name (Join-Path -Path $script:dscResourcePath -ChildPath '\MSFT_xADCommon\MSFT_xADCommon.psm1')

$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xADObjectEnabledState'

<#
Expand Down Expand Up @@ -386,27 +383,3 @@ function Compare-TargetResourceState

return Compare-ResourcePropertyState @compareTargetResourceStateParameters
}

<#
.SYNOPSIS
This is a wrapper for Set-ADComputer.
.PARAMETER Parameters
A hash table containing all parameters that will be passed trough to
Set-ADComputer.
.NOTES
This is needed because of how Pester is unable to handle mocking the
cmdlet Set-ADComputer.
#>
function Set-DscADComputer
{
param
(
[Parameter(Mandatory = $true)]
[System.Collections.Hashtable]
$Parameters
)

Set-ADComputer @Parameters | Out-Null
}
24 changes: 24 additions & 0 deletions Modules/xActiveDirectory.Common/xActiveDirectory.Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,29 @@ function Assert-ADPSDrive
}
}

<#
.SYNOPSIS
This is a wrapper for Set-ADComputer.
.PARAMETER Parameters
A hash table containing all parameters that will be passed trough to
Set-ADComputer.
.NOTES
This is needed because of how Pester is unable to handle mocking the
cmdlet Set-ADComputer. Therefor there are no unit test for this function.
#>
function Set-DscADComputer
{
param
(
[Parameter(Mandatory = $true)]
[System.Collections.Hashtable]
$Parameters
)

Set-ADComputer @Parameters | Out-Null
}

$script:localizedData = Get-LocalizedData -ResourceName 'xActiveDirectory.Common' -ScriptRoot $PSScriptRoot

Expand Down Expand Up @@ -1817,4 +1840,5 @@ Export-ModuleMember -Function @(
'Compare-ResourcePropertyState'
'Test-DscPropertyState'
'Assert-ADPSDrive'
'Set-DscADComputer'
)

0 comments on commit 6a72208

Please sign in to comment.