diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d758858..f2d32387 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,21 @@ All notable changes to this project will be documented in this file.The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [0.6.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.6.0) (2020-11-24) + +[Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.5.1...0.6.0) + +### Added + +- \(GH-81\) Handle parameters in the dsc base provider [\#62](https://github.com/puppetlabs/ruby-pwsh/pull/62) ([michaeltlombardi](https://github.com/michaeltlombardi)) +- \(GH-74\) Remove special handling for ensure in the dsc base provider [\#61](https://github.com/puppetlabs/ruby-pwsh/pull/61) ([michaeltlombardi](https://github.com/michaeltlombardi)) +- \(GH-59\) Refactor away from Simple Provider [\#60](https://github.com/puppetlabs/ruby-pwsh/pull/60) ([michaeltlombardi](https://github.com/michaeltlombardi)) + +### Fixed + +- \(GH-57\) Handle datetimes in dsc [\#58](https://github.com/puppetlabs/ruby-pwsh/pull/58) ([michaeltlombardi](https://github.com/michaeltlombardi)) +- \(GH-55\) Handle intentionally empty arrays [\#56](https://github.com/puppetlabs/ruby-pwsh/pull/56) ([michaeltlombardi](https://github.com/michaeltlombardi)) + ## [0.5.1](https://github.com/puppetlabs/ruby-pwsh/tree/0.5.1) (2020-09-25) [Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.5.0...0.5.1) diff --git a/lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb b/lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb index 89637f4d..3946f998 100644 --- a/lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb +++ b/lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb @@ -134,7 +134,7 @@ def set(context, changes) end # for compatibility sake, we use dsc_ensure instead of ensure, so context.type.ensurable? does not work - if !context.type.attributes.key?(:dsc_ensure) + if context.type.attributes.key?(:dsc_ensure) is = create_absent(:name, name) if is.nil? should = create_absent(:name, name) if should.nil? @@ -280,6 +280,15 @@ def invoke_get_method(context, name_hash) # If a resource is found, it's present, so refill this Puppet-only key data.merge!({ name: name_hash[:name] }) + # Have to check for this to avoid a weird canonicalization warning + # The Resource API calls canonicalize against the current state which + # will lead to dsc_ensure being set to absent in the name_hash even if + # it was set to present in the manifest + name_hash_has_nil_keys = name_hash.select { |_k, v| v.nil? }.count.positive? + # We want to throw away all of the empty keys if and only if the manifest + # declaration is for an absent resource and the resource is actually absent + data.reject! { |_k, v| v.nil? } if data[:dsc_ensure] == 'Absent' && name_hash[:dsc_ensure] == 'Absent' && !name_hash_has_nil_keys + # Cache the query to prevent a second lookup @@cached_query_results << data.dup if fetch_cached_hashes(@@cached_query_results, [data]).empty? context.debug("Returned to Puppet as #{data}") diff --git a/lib/pwsh/version.rb b/lib/pwsh/version.rb index 63d96a97..d76c1460 100644 --- a/lib/pwsh/version.rb +++ b/lib/pwsh/version.rb @@ -2,5 +2,5 @@ module Pwsh # The version of the ruby-pwsh gem - VERSION = '0.5.1' + VERSION = '0.6.0' end diff --git a/metadata.json b/metadata.json index 747c55d7..a79831e9 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-pwshlib", - "version": "0.5.1", + "version": "0.6.0", "author": "puppetlabs", "summary": "Provide library code for interoperating with PowerShell.", "license": "MIT",