Skip to content
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

make ssh::hostkeys::exclude_interfaces_re parameter work properly #380

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/puppet/functions/ssh/ipaddresses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# @param excluded_interfaces An array of interface names to be excluded.
param 'Array[String[1]]', :excluded_interfaces
# @param excluded_interfaces_re An array of regexp matching interface names to be excluded.
param 'Array[Regexp]', :excluded_interfaces_re
param 'Array', :excluded_interfaces_re
# @return The IP addresses found.
return_type 'Array[Stdlib::IP::Address]'
end
Expand Down Expand Up @@ -38,7 +38,7 @@ def ipaddresses(excluded_interfaces, excluded_interfaces_re)
interfaces.each do |iface, data|
# skip excluded interfaces
next if excluded_interfaces.include?(iface)
next if excluded_interfaces_re.any? { |pattern| pattern.match?(iface) }
next if excluded_interfaces_re.any? { |pattern| Regexp.new(pattern).match?(iface) }

%w[bindings bindings6].each do |binding_type|
next unless data.key?(binding_type)
Expand Down
5 changes: 4 additions & 1 deletion manifests/hostkeys.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# @param exclude_interfaces
# List of interfaces to exclude
#
# @param exclude_interfaces_re
# List of regular expressions to exclude interfaces
#
# @param exclude_ipaddresses
# List of ip addresses to exclude
#
Expand All @@ -27,7 +30,7 @@
Optional[String[1]] $storeconfigs_group = undef,
Array $extra_aliases = [],
Array $exclude_interfaces = [],
Array[Regexp] $exclude_interfaces_re = [],
Array $exclude_interfaces_re = [],
Array $exclude_ipaddresses = [],
Boolean $use_trusted_facts = false,
Optional[Array[String[1]]] $tags = undef,
Expand Down