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

update resolver parameters #526

Merged
merged 3 commits into from
Oct 24, 2022
Merged

update resolver parameters #526

merged 3 commits into from
Oct 24, 2022

Conversation

bugfood
Copy link

@bugfood bugfood commented Aug 9, 2022

This fixes two separate issues with the resolver defined type:

  1. The accepted_payload_size puppet parameter must be specified, despite HAProxy itself allowing the corresponding option to be unspecified.
  2. The parse-resolv-conf HAProxy option is not supported.

I have updated the tests accordingly.

@bugfood bugfood requested a review from a team as a code owner August 9, 2022 23:50
@puppet-community-rangefinder
Copy link

haproxy::resolver is a type

Breaking changes to this file WILL impact these 1 modules (exact match):

This module is declared in 40 of 579 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

@github-actions
Copy link

github-actions bot commented Oct 9, 2022

This PR has been marked as stale because it has been open for a while and has had no recent activity. If this PR is still important to you please drop a comment below and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days.

@github-actions github-actions bot added the stale label Oct 9, 2022
$hold = undef,
$resolve_retries = undef,
$timeout = undef,
$accepted_payload_size = undef,
# https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#5.3.2-accepted_payload_size
Optional[Integer[512, 8192]] $accepted_payload_size = undef,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you align the different variable lengths

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done; I did this as an additional commit rather than mix functional and whitespace changes together.

@david22swan
Copy link
Member

david22swan commented Oct 10, 2022

@bugfood One small change is needed, otherwise this looks good

Also, sorry on the wait for a review

@david22swan david22swan removed the stale label Oct 10, 2022
@jordanbreen28
Copy link

Hi @bugfood - this change looks good. Can you address @david22swan's comment above, and rebase with the current main, so we can proceed with this.
Thanks

@bugfood
Copy link
Author

bugfood commented Oct 19, 2022

Thanks, yes, I will take a look at this.

This fixes the error:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Comparison of: Undef Value < Integer, is not possible. Caused by 'Only Strings, Numbers, Timespans, Timestamps, and Versions are comparable'. (file: /etc/puppetlabs/code/modules/haproxy/manifests/resolver.pp, line: 125, column: 30)

HAProxy allows this parameter to be unset, and the code here works with
this ok, aside from the bounds check. Replace the bounds check with a
parameter type declaration, so that puppet itself will do the check for
us.

Update tests accordingly.
@bugfood
Copy link
Author

bugfood commented Oct 19, 2022

@jordanbreen28 @david22swan thanks, I amended the PR for:

  • whitespace change
  • rebase

I've been using my branch on live hosts since I made the PR, and it's been fine so far, at least for my use case. The rebased branch works as well.

@jordanbreen28
Copy link

jordanbreen28 commented Oct 21, 2022

@bugfood thank you for all your work on this so far!
There seems to have been some test failures - can you take a look at these?

The parse-resolv-conf parameter can be used on its own or in conjunction
with the nameservers parameter.

Adjust the nameservers parameter default to allow the template to work;
an empty hash results in no nameservers specified.

Add a new test.
@bugfood
Copy link
Author

bugfood commented Oct 21, 2022

@bugfood thank you for all your work on this so far! There seems to have been some test failures - can you take a look at these?

Yes, rubocop seems to be getting stricter over time. I fixed that failure, and I don't see any other failures in the test report. Hopefully the test suite will pass now.

@bugfood
Copy link
Author

bugfood commented Oct 21, 2022

Note that there is a deprecation warning on pdk bundle exec rake spec:

Deprecation Warnings:

Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }` instead. Called from /home/chickey/puppetlabs-haproxy/spec/classes/haproxy_spec.rb:28:in `block (5 levels) in <top (required)>'.

This warns on the test I added, but that's only because the new test is listed first in the file. The new tests I added follow the same construction as the other tests, and the same warning happens on current upstream main.

I don't think that the pre-existing warning needs to be fixed here, but if so, I would need some further guidance on that. The string "should" does not appear in that file; I presume that some higher-level construct is using ":should", but I'm not familiar enough with rspec to know what would need to be changed. Other examples of that error I can find by a web search are for code that looks rather different.

@jordanbreen28
Copy link

Hi again @bugfood :-)
Great work on this one, theres one failure but as before I expect it to be transient.
Let me re-kick the test here so hopefully we can proceed!

Copy link

@jordanbreen28 jordanbreen28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Thanks for your work on this & for bringing the deprecation warning to our attention.

@jordanbreen28 jordanbreen28 merged commit bd20633 into puppetlabs:main Oct 24, 2022
@bugfood
Copy link
Author

bugfood commented Oct 24, 2022

Very good. Thank you for helping me with me PRs.

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