Merge pull request #357 from hunner/hasInterfaceWithLookupBug
(PUP-3597) Catch :undefined_variable when Future Parser is enabled on 3.7.x
This commit is contained in:
commit
0a8963fbd3
3 changed files with 14 additions and 4 deletions
|
@ -35,7 +35,13 @@ has_interface_with("lo") => true
|
|||
|
||||
kind, value = args
|
||||
|
||||
if lookupvar(kind) == value
|
||||
# Bug with 3.7.1 - 3.7.3 when using future parser throws :undefined_variable
|
||||
# https://tickets.puppetlabs.com/browse/PUP-3597
|
||||
factval = nil
|
||||
catch :undefined_variable do
|
||||
factval = lookupvar(kind)
|
||||
end
|
||||
if factval == value
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -44,7 +50,11 @@ has_interface_with("lo") => true
|
|||
iface.downcase!
|
||||
factval = nil
|
||||
begin
|
||||
factval = lookupvar("#{kind}_#{iface}")
|
||||
# Bug with 3.7.1 - 3.7.3 when using future parser throws :undefined_variable
|
||||
# https://tickets.puppetlabs.com/browse/PUP-3597
|
||||
catch :undefined_variable do
|
||||
factval = lookupvar("#{kind}_#{iface}")
|
||||
end
|
||||
rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
|
||||
end
|
||||
if value == factval
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'ensure_packages function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) || fact('osfamily') == 'windows') do
|
||||
describe 'ensure_packages function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) && fact('osfamily') != 'windows') do
|
||||
describe 'success' do
|
||||
it 'ensure_packages a package' do
|
||||
apply_manifest('package { "rake": ensure => absent, provider => "gem", }')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'ensure_resource function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) || fact('osfamily') == 'windows') do
|
||||
describe 'ensure_resource function', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) && fact('osfamily') != 'windows') do
|
||||
describe 'success' do
|
||||
it 'ensure_resource a package' do
|
||||
apply_manifest('package { "rake": ensure => absent, provider => "gem", }')
|
||||
|
|
Loading…
Reference in a new issue