-
Notifications
You must be signed in to change notification settings - Fork 583
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
has_ip_address
and has_ip_network
functions
The functions were using the old legacy function API. This meant that when they called `has_interface_with`, they were calling the legacy implementation of that function and not the v4 API version introduced in bc218f0. Only in the v4 API implementation was the modern `networking` structured fact being used. The old `parser/functions/has_interface_with.rb` version still used legacy facts that are now not included in Puppet 8 by default. In this commit, we replace the `has_ip_address` and `has_ip_network` functions with namespaced Puppet language functions, (these functions are simple enough to not need ruby). Non-namespaced versions are added (but marked as deprecated) in `lib/puppet/functions`. The old implementations are removed completely. This is _almost_ certainly not going to be a breaking change for anyone. (Only other legacy functions which in turn call these functions could be affected). Fixes #1447
- Loading branch information
1 parent
52740b7
commit f2b8cbf
Showing
10 changed files
with
131 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# @summary Returns true if the client has the requested IP address on some interface. | ||
# | ||
# @param ip_address | ||
# The IPv4 address you want to check the existence of | ||
# @return [Boolean] Returns `true` if the requested IP address exists on any interface. | ||
function stdlib::has_ip_address( | ||
Stdlib::IP::Address::V4::Nosubnet $ip_address, | ||
) >> Boolean { | ||
stdlib::has_interface_with('ipaddress', $ip_address) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# @summary Returns true if the client has the requested IPv4 network on some interface. | ||
# | ||
# @param ip_network | ||
# The IPv4 network you want to check the existence of | ||
# @return [Boolean] Returns `true` if the requested IP network exists on any interface. | ||
function stdlib::has_ip_network( | ||
Stdlib::IP::Address::V4::Nosubnet $ip_network, | ||
) >> Boolean { | ||
stdlib::has_interface_with('network', $ip_network) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
# THIS FILE WAS GENERATED BY `rake regenerate_unamespaced_shims` | ||
|
||
# @summary DEPRECATED. Use the namespaced function [`stdlib::has_ip_address`](#stdlibhas_ip_address) instead. | ||
Puppet::Functions.create_function(:has_ip_address) do | ||
dispatch :deprecation_gen do | ||
repeated_param 'Any', :args | ||
end | ||
def deprecation_gen(*args) | ||
call_function('deprecation', 'has_ip_address', 'This function is deprecated, please use stdlib::has_ip_address instead.', false) | ||
call_function('stdlib::has_ip_address', *args) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
# THIS FILE WAS GENERATED BY `rake regenerate_unamespaced_shims` | ||
|
||
# @summary DEPRECATED. Use the namespaced function [`stdlib::has_ip_network`](#stdlibhas_ip_network) instead. | ||
Puppet::Functions.create_function(:has_ip_network) do | ||
dispatch :deprecation_gen do | ||
repeated_param 'Any', :args | ||
end | ||
def deprecation_gen(*args) | ||
call_function('deprecation', 'has_ip_network', 'This function is deprecated, please use stdlib::has_ip_network instead.', false) | ||
call_function('stdlib::has_ip_network', *args) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.