Skip to content

Commit

Permalink
Revert "(CAT-1484) - Add ensurable property to resource"
Browse files Browse the repository at this point in the history
This reverts commit 35a8f69.
  • Loading branch information
jordanbreen28 committed Feb 7, 2024
1 parent b7b56ff commit a588fe3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
18 changes: 0 additions & 18 deletions src/Puppet.Dsc/internal/functions/Get-TypeContent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,6 @@ function Get-TypeContent {
} Else {
$FriendlyName = $Resource.FriendlyName
}
# We add an ensurable property to all DSC resources that don't have an ensure property
$ResourceIsEnsurable = ($Resource.ParameterInfo | Select-Object -ExpandProperty Name).Contains('ensure')
$NotEnsurable = [pscustomobject]@{
Name = 'ensurable'
DefaultValue = 'false'
Type = 'Boolean[false]'
Help = 'Default attribute added to all dsc types without an ensure property. This resource is not ensurable.'
mandatory_for_get = 'false'
mandatory_for_set = 'false'
is_parameter = 'false'
is_namevar = 'false'
mof_is_embedded = 'false'
mof_type = 'String'
}
# We only add the ensurable property if it's not already present
If (!$ResourceIsEnsurable) {
$Resource.ParameterInfo += $NotEnsurable
}
# It is not *currently* possible to reliably programmatically retrieve
# the description information for a DSC Resource via CIM instances or
# Get-DscResource or Get-Help.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ Function Get-TypeParameterContent {

ForEach ($Parameter in $ParameterInfo) {
if (![string]::IsNullOrEmpty($Parameter.name)) {
if ($Parameter.name -ne 'ensurable') {
$Parameter.name = "dsc_$($Parameter.name)"
}
New-Object -TypeName System.String @"
$($Parameter.name): {
dsc_$($Parameter.name): {

Check warning on line 28 in src/Puppet.Dsc/internal/functions/Get-TypeParameterContent.ps1

View check run for this annotation

Codecov / codecov/patch

src/Puppet.Dsc/internal/functions/Get-TypeParameterContent.ps1#L28

Added line #L28 was not covered by tests
type: $(ConvertTo-PuppetRubyString -String ($Parameter.Type -split "`n" -join "`n ")),
$(
If ([string]::IsNullOrEmpty($Parameter.Help)) {
Expand Down

0 comments on commit a588fe3

Please sign in to comment.