-
Notifications
You must be signed in to change notification settings - Fork 583
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
Fix has_ip_address
and has_ip_network
functions
#1448
base: main
Are you sure you want to change the base?
Conversation
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 puppetlabs#1447
f2b8cbf
to
2a25b6d
Compare
@@ -0,0 +1,10 @@ | |||
# @summary Returns true if the client has the requested IPv4 address on some interface. | |||
# | |||
# @param ip_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.
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
I think the acceptance test breaks due to puppetlabs/puppetlabs-puppet_agent#754. |
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 oldparser/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
andhas_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) inlib/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