Class: Puppet.features
- Inherits:
-
Object
- Object
- Puppet.features
- Defined in:
- lib/puppet/feature/cisco_node_utils.rb
Overview
TODO: simplify if tickets.puppetlabs.com/browse/PUP-1159 gets fixed. Override the default caching logic created in Puppet.features:
meta_def(‘cisco_node_utils?’) do
# we return a cached result if:
# * if a block is given (and we just evaluated it above)
# * if we already have a positive result
# * if we've tested this feature before and it failed, but we're
# configured to always cache
if block_given? ||
@results['cisco_node_utils'] ||
(@results.has_key?('cisco_node_utils') and
Puppet[:always_cache_features])
@results['cisco_node_utils']
else
@results['cisco_node_utils'] = test('cisco_node_utils',
libs: ['cisco_node_utils'])
@results['cisco_node_utils']
end
end
Class Method Summary collapse
Class Method Details
.cisco_node_utils? ⇒ Boolean
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/puppet/feature/cisco_node_utils.rb', line 28 def cisco_node_utils? # we return a cached result if: # * if we already have a positive result # * if we've tested this feature before and it failed, but we're # configured to always cache if @results['cisco_node_utils'] || (@results.key?('cisco_node_utils') && Puppet[:always_cache_features]) @results['cisco_node_utils'] else @results['cisco_node_utils'] = test('cisco_node_utils', libs: ['cisco_node_utils']) if @results['cisco_node_utils'] rec_version = Gem::Version.new('1.9.0') gem_version = Gem::Version.new(CiscoNodeUtils::VERSION) if gem_version < rec_version warn "This module works best with version #{rec_version} of gem "\ "'cisco_node_utils' but version #{gem_version} is installed. "\ 'Some features may not be fully functional.' end end @results['cisco_node_utils'] end end |