Skip to content

Port ranges as string with hyphen as range indicator should work #1212

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 2 commits into from
May 7, 2025

Conversation

2fa
Copy link
Contributor

@2fa 2fa commented Apr 5, 2024

Summary

If you set dport|sport values as a string with - as range indicator puppet will be applying manifest on every run.

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified. (For example puppet apply)

@2fa 2fa requested a review from a team as a code owner April 5, 2024 18:02
@shubhamshinde360
Copy link
Contributor

shubhamshinde360 commented May 6, 2025

When dport/sport is passed as a string "561-570" the insync? method always returns nil since we only process the ports in case they are arrays otherwise return nil (falsey).
This results in the puppet applying the change even when the desired port ranges are the same as actual port ranges.

With this change the string port ranges are handled properly and the insync? method returns true when the port ranges are equal.

@shubhamshinde360
Copy link
Contributor

Thanks @2fa,

Looks good to me.
Could you please rebase your branch with main before this is merged.

@shubhamshinde360 shubhamshinde360 force-pushed the port-ranges-with-hyphens branch from c4ba81f to bd321bb Compare May 7, 2025 06:46
@2fa
Copy link
Contributor Author

2fa commented May 7, 2025

@shubhamshinde360 sorry, i was quite busy yesterday and just got your message. Do i need to rebase the branch or all is good now?

@shubhamshinde360
Copy link
Contributor

shubhamshinde360 commented May 7, 2025

Hey @2fa,
No worries. I rebased it. But it seems there is a rubocop failure in the PR checks. Could you please add a commit to this PR to address that. Other changes look good.

@2fa
Copy link
Contributor Author

2fa commented May 7, 2025

@shubhamshinde360 fixed the issue with rubocop but there are failed acceptance tests. I don't think that's on my side though.

@shubhamshinde360
Copy link
Contributor

Merging this since the check failures are unrelated and need to be addressed separately.

Thanks @2fa for you contribution!

@shubhamshinde360 shubhamshinde360 merged commit 625853e into puppetlabs:main May 7, 2025
6 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants