Skip to content

Commit 245fb75

Browse files
bastelfreaksmortex
authored andcommitted
(maint) Switch from is_function_available() to defined()
1 parent 6538137 commit 245fb75

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

manifests/params.pp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@
4343
# The `is_pe` fact currently works by echoing out the puppet version
4444
# and greping for "puppet enterprise". With Puppet 4 and PE 2015.2, there
4545
# is no longer a "PE Puppet", and so that fact will no longer work.
46-
# Instead check for the `is_pe` fact or if a PE provided function is available
47-
$_is_pe = (getvar('::is_pe') or is_function_available('pe_compiling_server_version'))
46+
# Instead check for the `is_pe` fact or if the `pe_anchor` resource type
47+
# provided by the puppet_enterprise module exist.
48+
$_is_pe = (getvar('::is_pe') or defined('pe_anchor'))
4849
if $_is_pe {
4950
# Calculate the default collection
5051
$_pe_version = pe_build_version()

spec/classes/puppet_agent_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def global_facts(facts, os)
237237
before(:each) do
238238
Puppet::Parser::Functions.newfunction(:pe_build_version, type: :rvalue) { |_args| '2000.0.0' }
239239
Puppet::Parser::Functions.newfunction(:pe_compiling_server_aio_build, type: :rvalue) { |_args| '1.10.100' }
240-
Puppet::Parser::Functions.newfunction(:pe_compiling_server_version, type: :rvalue) { |_args| '2.20.200' }
240+
Puppet::Parser::Functions.newfunction(:defined, type: :rvalue) { |_args| true }
241241
end
242242

243243
context 'package_version is initialized automatically' do

0 commit comments

Comments
 (0)