Skip to content

Commit

Permalink
DscSecurityOption: Ensure that Get returns name (#159)
Browse files Browse the repository at this point in the history
* DscSecurityOption: Ensure that Get returns name

Prior to this commit, invoking the SecurityPolicy resource with the Get method would always return $Null for the Name property; though this property is itself never used by the resource, integrating tools are unable to tell as the Name property is also the Key (as defined in the MOF) for this resource; meaning when comparing the existing state of the resource it will always cause a mismatch between the specified Name and the "actual" representation of the resource on the machine, as reported by the Get-TargetResource function.

This commit modifies the Get-TargetResource function for the SecurityPolicy DSC resource to always return the specified Name for the resource in order to prevent churn in secondary tools such as Puppet, Ansible, or Chef.

This mirrors the change in #152 to AccountPolicy.

* (MAINT) Update capitalization for PSSA

This commit downcases the default keyword in several files to obviate a
failing test case in PSSA relating to the following link:

https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md#correct-format-for-keywords

Co-authored-by: Gael <gaelcolas@users.noreply.github.com>
  • Loading branch information
michaeltlombardi and gaelcolas authored May 21, 2021
1 parent bd72347 commit 44acc25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
- Ensure `Get` method returns the specified `Name` property.
- Fix applying Account_lockout_duration to zero
[Issue #140](https://github.com/dsccommunity/SecurityPolicyDsc/issues/140).
- SecurityPolicy:
- Ensure `Get` method returns the specified `Name` property.
-SecurityOption
- 'Network_access_Remotely_accessible_registry_paths' and 'Network_access_Remotely_accessible_registry_paths_and_subpaths' use null char as a delimiter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ function Get-TargetResource
$Name
)

$returnValue = @{}
$returnValue = @{
Name = $Name
}

$currentSecurityPolicy = Get-SecurityPolicy -Area SECURITYPOLICY
$secOptionDataFilePath = Join-Path -Path $PSScriptRoot -ChildPath 'SecurityOptionData.psd1'
$securityOptionData = Import-PowerShellDataFile -Path $secOptionDataFilePath
Expand Down

0 comments on commit 44acc25

Please # to comment.