ruby-pwsh 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 106716635e03eef49ab00c8dd35cf16a5674a27452968b16ba7756ba252b97be
4
- data.tar.gz: 4bd6c34343347a1d705cea410346028bbb91446bf5983e75409f16c7730f1000
3
+ metadata.gz: df8360a152766169ee39b1a3e79909f5e75f1645194f22996eb09246c58d8a79
4
+ data.tar.gz: 9733619df523ed7c6d1af948fe2a75e35d24ac7b723cd610945a3c617c367685
5
5
  SHA512:
6
- metadata.gz: f8b6c0c4ff6eabbc9a842cc863d76128dbccca74fabfef02b4aea6ba54f3a01ffd3d97447df4ccc027a8f22cf6a7b430b0893e34d0de7989e742442cf56b5ef9
7
- data.tar.gz: 2404be74308d1b80c5d8f775f49f0f0ac6ae7deab47fe7c38e25e79852aac42f87e16b5cea5e4a4617cdde6eac1236cc8407a0e10fe2c9198bcfd0d6e88a7548
6
+ metadata.gz: f7e6afecbbe06c0a78509458e7e178295d57de9d5901b6a448c177a5be4f2ec1361015de97daf8db022a20dcddda3f50ea0dc326234fea71e068809c06c50f02
7
+ data.tar.gz: 964652929914f2aeb579835dec656d56cc8005218b64075daed3bad684a972c45079f00586a0df4f803a9c369431364163c9515542bc0be4ee58cfb07223f269
@@ -682,16 +682,16 @@ class Puppet::Provider::DscBaseProvider # rubocop:disable Metrics/ClassLength
682
682
  context.type.attributes.select { |_attribute, properties| properties[:mandatory_for_set] }.keys
683
683
  end
684
684
 
685
- # Parses the DSC resource type definition to retrieve the names of any attributes which are specifed as required strings
686
- # This is used to ensure that any nil values are converted to empty strings to match puppets expecetd value
685
+ # Parses the DSC resource type definition to retrieve the names of any attributes which are specified as required strings
686
+ # This is used to ensure that any nil values are converted to empty strings to match puppets expeceted value
687
687
  # @param context [Object] the Puppet runtime context to operate in and send feedback to
688
688
  # @param data [Hash] the hash of properties returned from the DSC resource
689
689
  # @return [Hash] returns a data hash with any nil values converted to empty strings
690
690
  def stringify_nil_attributes(context, data)
691
- nil_strings = data.select { |_name, value| value.nil? }.keys
692
- string_attrs = context.type.attributes.select { |_name, properties| properties[:type] == 'String' }.keys
693
- string_attrs.each do |attribute|
694
- data[attribute] = '' if nil_strings.include?(attribute)
691
+ nil_attributes = data.select { |_name, value| value.nil? }.keys
692
+ nil_attributes.each do |nil_attr|
693
+ attribute_type = context.type.attributes[nil_attr][:type]
694
+ data[nil_attr] = '' if (attribute_type.start_with?('Optional[Enum[', 'Enum[') && enum_values(context, nil_attr).include?('')) || attribute_type == 'String'
695
695
  end
696
696
  data
697
697
  end
data/lib/pwsh/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Pwsh
4
4
  # The version of the ruby-pwsh gem
5
- VERSION = '1.2.1'
5
+ VERSION = '1.2.2'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-pwsh
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-20 00:00:00.000000000 Z
11
+ date: 2024-09-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: PowerShell code manager for ruby.
14
14
  email: