Remove TypeData command was causing error when its called in the same session which was resulting into windows_firewall_rule was not working correctly locally when we have more than one describe block for windows_firewall_rule resource

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
This commit is contained in:
Vasu1105 2021-05-04 09:22:19 +00:00
parent f479aa644c
commit 95656f97da

View file

@ -105,7 +105,7 @@ module Inspec::Resources
# @see https://github.com/chef/chef/blob/master/lib/chef/resource/windows_firewall_rule.rb
def load_firewall_state(rule_name)
<<-EOH
Remove-TypeData System.Array # workaround for PS bug here: https://bit.ly/2SRMQ8M
Get-TypeData -TypeName System.Array | Remove-TypeData # workaround for PS bug here: https://bit.ly/2SRMQ8M
$rule = Get-NetFirewallRule -Name "#{rule_name}"
$addressFilter = $rule | Get-NetFirewallAddressFilter
$portFilter = $rule | Get-NetFirewallPortFilter