ruby-pwsh 0.7.0 → 0.7.1

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: f8334c3715e69873cda019ad2010187d15ad34a2b593426b567d056a4a1fc364
4
- data.tar.gz: e66f5fccc419fc4d315c7db3def945bb3108d57c756bf55e5205039d1963c6c3
3
+ metadata.gz: b70b1a0989c8bc3458422b67e0c328084f819067d60455b9504031106a6c78e6
4
+ data.tar.gz: 44c5f49c82db4a56e76d521e1b90a5434d3bfacd6a5fa242e4e6c5c90878d875
5
5
  SHA512:
6
- metadata.gz: 2522c738352df33e552c0fa26b48113b95b65ceece2cc03bbb48d731df5e1fc623ec8590e18b8152205fb07ff33fc1f1f1892ccbc6e399a729a61732385a48c7
7
- data.tar.gz: 43c5e11f365df85d1b45978bc3ae8855668bd97168ac24ef9d3bffd77b9e4a709b0eb71872d19b63c0225f2c08061dfa346d8e2c7fd52133afd283c14db54b2c
6
+ metadata.gz: 80207ddfde5794a3e461c769fdb20983bbc0f601cc18c99a57bd6e2f37ee3158ca27efa1a176d1bb600090860f107b059816f6ec5c263bbbd3d6b21bf7cb11df
7
+ data.tar.gz: 41d7a31a3703e24e5e64944776eeb889ac01f7acd685e867211898e37a0478606e3728747779e1073cc1138619d51f7e9b2c872047a3754ffc38d061d14916d6
data/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  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).
4
4
 
5
+ ## [0.7.1](https://github.com/puppetlabs/ruby-pwsh/tree/0.7.1) (2021-02-01)
6
+
7
+ [Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.7.0...0.7.1)
8
+
9
+ ### Fixed
10
+
11
+ - \(MAINT\) Correctly canonicalize enumerable values in dsc [\#92](https://github.com/puppetlabs/ruby-pwsh/pull/92) ([michaeltlombardi](https://github.com/michaeltlombardi))
12
+ - \(MAINT\) Ensure vendored path check works with mix of module builds [\#91](https://github.com/puppetlabs/ruby-pwsh/pull/91) ([michaeltlombardi](https://github.com/michaeltlombardi))
13
+ - \(GH-84\) Fix empty array parameter check [\#90](https://github.com/puppetlabs/ruby-pwsh/pull/90) ([michaeltlombardi](https://github.com/michaeltlombardi))
14
+ - \(MAINT\) Minor fixes to CIM instance handling [\#89](https://github.com/puppetlabs/ruby-pwsh/pull/89) ([michaeltlombardi](https://github.com/michaeltlombardi))
15
+
5
16
  ## [0.7.0](https://github.com/puppetlabs/ruby-pwsh/tree/0.7.0) (2021-01-20)
6
17
 
7
18
  [Full Changelog](https://github.com/puppetlabs/ruby-pwsh/compare/0.6.3...0.7.0)
@@ -61,7 +61,8 @@ class Puppet::Provider::DscBaseProvider
61
61
  downcased_result = recursively_downcase(canonicalized)
62
62
  downcased_resource = recursively_downcase(r)
63
63
  downcased_result.each do |key, value|
64
- canonicalized[key] = r[key] unless downcased_resource[key] == value
64
+ is_same = value.is_a?(Enumerable) ? downcased_resource[key].sort == value.sort : downcased_resource[key] == value
65
+ canonicalized[key] = r[key] unless is_same
65
66
  canonicalized.delete(key) unless downcased_resource.keys.include?(key)
66
67
  end
67
68
  # Cache the actually canonicalized resource separately
@@ -358,22 +359,24 @@ class Puppet::Provider::DscBaseProvider
358
359
  # Because Puppet adds all of the modules to the LOAD_PATH we can be sure that the appropriate module lives here during an apply;
359
360
  # PROBLEM: This currently uses the downcased name, we need to capture the module name in the metadata I think.
360
361
  # During a Puppet agent run, the code lives in the cache so we can use the file expansion to discover the correct folder.
362
+ # This handles setting the vendored_modules_path to include the puppet module name; we now add the puppet module name into the
363
+ # path to allow multiple modules to with shared dsc_resources to be installed side by side
364
+ # The old vendored_modules_path: puppet_x/dsc_resources
365
+ # The new vendored_modules_path: puppet_x/<module_name>/dsc_resources
361
366
  root_module_path = $LOAD_PATH.select { |path| path.match?(%r{#{puppetize_name(resource[:dscmeta_module_name])}/lib}) }.first
362
367
  resource[:vendored_modules_path] = if root_module_path.nil?
363
- File.expand_path(Pathname.new(__FILE__).dirname + '../../../' + 'puppet_x/dsc_resources') # rubocop:disable Style/StringConcatenation
368
+ File.expand_path(Pathname.new(__FILE__).dirname + '../../../' + "puppet_x/#{puppetize_name(resource[:dscmeta_module_name])}/dsc_resources") # rubocop:disable Style/StringConcatenation
364
369
  else
365
- File.expand_path("#{root_module_path}/puppet_x/dsc_resources")
370
+ File.expand_path("#{root_module_path}/puppet_x/#{puppetize_name(resource[:dscmeta_module_name])}/dsc_resources")
366
371
  end
367
372
 
368
- # This handles setting the vendored_modules_path to include the puppet module name
369
- # We now add the puppet module name into the path to allow multiple modules to with shared dsc_resources to be installed side by side
370
- # The old vendored_modules_path: puppet_x/dsc_resources
371
- # The new vendored_modules_path: puppet_x/<module_name>/dsc_resources
373
+ # Check for the old vendored_modules_path second - if there is a mix of modules with the old and new pathing,
374
+ # checking for this first will always work and so the more specific search will never run.
372
375
  unless File.exist? resource[:vendored_modules_path]
373
376
  resource[:vendored_modules_path] = if root_module_path.nil?
374
- File.expand_path(Pathname.new(__FILE__).dirname + '../../../' + "puppet_x/#{puppetize_name(resource[:dscmeta_module_name])}/dsc_resources") # rubocop:disable Style/StringConcatenation
377
+ File.expand_path(Pathname.new(__FILE__).dirname + '../../../' + 'puppet_x/dsc_resources') # rubocop:disable Style/StringConcatenation
375
378
  else
376
- File.expand_path("#{root_module_path}/puppet_x/#{puppetize_name(resource[:dscmeta_module_name])}/dsc_resources")
379
+ File.expand_path("#{root_module_path}/puppet_x/dsc_resources")
377
380
  end
378
381
  end
379
382
 
@@ -535,8 +538,8 @@ class Puppet::Provider::DscBaseProvider
535
538
  'user' => property_hash[:value]['user'],
536
539
  'password' => escape_quotes(property_hash[:value]['password'].unwrap)
537
540
  }
538
- instantiated_variables.merge!(variable_name => credential_hash)
539
541
  credentials_block << format_pscredential(variable_name, credential_hash)
542
+ instantiated_variables.merge!(variable_name => credential_hash)
540
543
  end
541
544
  credentials_block.join("\n")
542
545
  credentials_block == [] ? '' : credentials_block
@@ -563,6 +566,7 @@ class Puppet::Provider::DscBaseProvider
563
566
  cim_instances_block = []
564
567
  resource[:parameters].each do |_property_name, property_hash|
565
568
  next unless property_hash[:mof_is_embedded]
569
+ next if property_hash[:mof_type] == 'PSCredential' # Credentials are handled separately
566
570
 
567
571
  # strip dsc_ from the beginning of the property name declaration
568
572
  # name = property_name.to_s.gsub(/^dsc_/, '').to_sym
@@ -573,10 +577,10 @@ class Puppet::Provider::DscBaseProvider
573
577
  unless cim_instance_hashes.count.zero?
574
578
  cim_instance_hashes.each do |instance|
575
579
  variable_name = random_variable_name
576
- instantiated_variables.merge!(variable_name => instance)
577
580
  class_name = instance['cim_instance_type']
578
581
  properties = instance.reject { |k, _v| k == 'cim_instance_type' }
579
582
  cim_instances_block << format_ciminstance(variable_name, class_name, properties)
583
+ instantiated_variables.merge!(variable_name => instance)
580
584
  end
581
585
  end
582
586
  # We have to handle arrays of CIM instances slightly differently
@@ -584,14 +588,14 @@ class Puppet::Provider::DscBaseProvider
584
588
  class_name = property_hash[:mof_type].gsub('[]', '')
585
589
  property_hash[:value].each do |hash|
586
590
  variable_name = random_variable_name
587
- instantiated_variables.merge!(variable_name => hash)
588
591
  cim_instances_block << format_ciminstance(variable_name, class_name, hash)
592
+ instantiated_variables.merge!(variable_name => hash)
589
593
  end
590
594
  else
591
595
  variable_name = random_variable_name
592
- instantiated_variables.merge!(variable_name => property_hash[:value])
593
596
  class_name = property_hash[:mof_type]
594
597
  cim_instances_block << format_ciminstance(variable_name, class_name, property_hash[:value])
598
+ instantiated_variables.merge!(variable_name => property_hash[:value])
595
599
  end
596
600
  end
597
601
  cim_instances_block == [] ? '' : cim_instances_block.join("\n")
@@ -674,7 +678,7 @@ class Puppet::Provider::DscBaseProvider
674
678
  params_block = params_block.gsub("'[DateTime]", "[DateTime]'")
675
679
  # HACK: Handle intentionally empty arrays - need to strongly type them because
676
680
  # CIM instances do not do a consistent job of casting an empty array properly.
677
- empty_array_parameters = resource[:parameters].select { |_k, v| v[:value].empty? }
681
+ empty_array_parameters = resource[:parameters].select { |_k, v| v[:value].is_a?(Array) && v[:value].empty? }
678
682
  empty_array_parameters.each do |name, properties|
679
683
  param_block_name = name.to_s.gsub(/^dsc_/, '')
680
684
  params_block = params_block.gsub("#{param_block_name} = @()", "#{param_block_name} = [#{properties[:mof_type]}]@()")
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 = '0.7.0'
5
+ VERSION = '0.7.1'
6
6
  end
data/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puppetlabs-pwshlib",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "author": "puppetlabs",
5
5
  "summary": "Provide library code for interoperating with PowerShell.",
6
6
  "license": "MIT",
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: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-20 00:00:00.000000000 Z
11
+ date: 2021-02-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: PowerShell code manager for ruby.
14
14
  email:
@@ -54,7 +54,7 @@ metadata:
54
54
  homepage_uri: https://github.com/puppetlabs/ruby-pwsh
55
55
  source_code_uri: https://github.com/puppetlabs/ruby-pwsh
56
56
  changelog_uri: https://github.com/puppetlabs/ruby-pwsh
57
- post_install_message:
57
+ post_install_message:
58
58
  rdoc_options: []
59
59
  require_paths:
60
60
  - lib
@@ -69,8 +69,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubygems_version: 3.1.4
73
- signing_key:
72
+ rubyforge_project:
73
+ rubygems_version: 2.7.6
74
+ signing_key:
74
75
  specification_version: 4
75
76
  summary: PowerShell code manager for ruby.
76
77
  test_files: []