-
Notifications
You must be signed in to change notification settings - Fork 582
Fix has_ip_address
and has_ip_network
functions
#1448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also support ipv6?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone wants to add that, they could open a PR for it. I did have a quick think about it, and I guess with IPv6 you'd want to do something a bit more sophisticated than just matching the string though as there are several ways to write the same address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, that would require updating
stdlib::has_interface_with()
to work with IpAddr objects