Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(REVERT) - Revert forcing of ensurable property on resources #283

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions docs/architecture/decisions/0001-force-ensurable.md

This file was deleted.

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 @@

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
Loading