Skip to content

(#12399) DRY up rest.rb#451

Closed
jeffweiss wants to merge 2 commits intopuppetlabs:masterfrom
jeffweiss:ticket/master/12399_dry_up_rest.rb
Closed

(#12399) DRY up rest.rb#451
jeffweiss wants to merge 2 commits intopuppetlabs:masterfrom
jeffweiss:ticket/master/12399_dry_up_rest.rb

Conversation

@jeffweiss
Copy link
Contributor

Move the calls to request.do_request(...) to a method to encapsulate
the params

Encapsulate call to request.do_request with the arguments from this class
Then yield to the code block that was called in

We certainly could have retained the full request.do_request(...) {|r| ... }
but this makes the code much cleaner and we only then actually make the call
to request.do_request from here, thus if we change what we pass or how we
get it, we only need to change it here.

Move the calls to request.do_request(...) to a method to encapsulate
the params
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure there is a need for this comment. Maybe include it in the commit message, but it seems obvious what the code does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Thought there might be pushback because the change seemed simple, so thought I should provide justification. Updated.

Move comment to commit message.

Encapsulate call to request.do_request with the arguments from this class
Then yield to the code block that was called in

We certainly could have retained the full request.do_request(...) {|r| ... }
but this makes the code much cleaner and we only then actually make the call
to request.do_request from here, thus if we change what we pass or how we
get it, we only need to change it here.
@slippycheeze
Copy link
Contributor

I actually liked the version with the comment better, so I cherry-picked just the first commit and hand-merged it. Thanks for the contribution.

melissa pushed a commit to melissa/puppet that referenced this pull request Mar 30, 2018
…1-pxp-agent_acceptance_should_support_a_failover_pcp-broker-b

(PCP-431) fix previous acceptance commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants