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

Refactor params class to use hash, fixes #62 #88

Closed
wants to merge 13 commits into from
Closed

Refactor params class to use hash, fixes #62 #88

wants to merge 13 commits into from

Conversation

jamorton
Copy link
Contributor

@jamorton jamorton commented Jul 9, 2013

Hi, this is my stab at fixing #62 by adding a hash to contain params as you suggested in #79.

Some other goodies in this PR:

  • added more gzip options
  • added support for tcp_nopush
  • added an example to the README for setting up a location

🍔

nginx::resource::vhost { 'rack.puppetlabs.com':
ensure => present,
proxy => 'http://puppet_rack_app',
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use puppet-lint to check the new code.

@abraham1901
Copy link
Contributor

What about backwards compatibility?

@joshbetz
Copy link

+1

This is a big commit and it needs backwards compatibility, but I really like where this is going.

@jamorton
Copy link
Contributor Author

@abraham1901 I think this change by definition can't be backwards compatible

@jfryman
Copy link
Contributor

jfryman commented Jul 13, 2013

I'm pretty sure this is going to break all backwards compatibility, but it needs to happen.

The current plan that I have right now is to tag the current rev to 0.0.9, and then clean-up this pull and tag as 0.1.0. That way, folks that keep using this module can continue to use 0.0.9 until they can refactor to 0.1.0 or greater.

File {
owner => 'root',
group => 'root',
mode => '0644',
}

file { $nginx::params::nx_conf_dir:
# some of these are accessed from other manifests/templates
$conf_dir = $options['conf_dir']
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be cleaner to use the merge() function here as opposed to setting several instance variables to hold this data. The pattern that I'm using here in other modules that I was planning on using in this module is:

class nginx::config(
  $options = {},
) {
  $config = merge($github::params::defaults, $options)
  ...

}

and then use the hash to reference various variables in the hash where needed in the manifest itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jfryman
Copy link
Contributor

jfryman commented Jul 13, 2013

@Jonanin This is ✨. Thanks for taking this on. I made a few comments in code, and want to get your input, but this is absolutely on the right track.

@jfryman
Copy link
Contributor

jfryman commented Jul 13, 2013

I'm also toying with adding rspec-puppet specs here, given this module is really increasing in complexity and I'ld like to be able to maintain some sort of net against regressions, especially in light of a major refactor of this.

@Jonanin care to take a pass at this? If not, I'll start adding them late next week as my schedule opens up.

@jamorton
Copy link
Contributor Author

Here are the fixes people have asked for.

Note: that was supposed to be "Rename $config_opts -> $config". Didn't escape on the shell!

@jamorton
Copy link
Contributor Author

@jfryman I should have some time tomorrow, i'll take a look at rspec-puppet.

@dcarley
Copy link

dcarley commented Aug 22, 2013

👍 for the solution to the never-ending-class-params problem.

@jfryman
Copy link
Contributor

jfryman commented Aug 22, 2013

/cc 05ec889

@jamorton
Copy link
Contributor Author

jamorton commented Oct 8, 2013

I've pushed a commit that fixes all conflicts with changes in master since the initial pull request.

I'm pretty busy and thus don't have time to look at implementing rspec in addition. Is there anything else that needs to be done for this to be merged?

@jfryman
Copy link
Contributor

jfryman commented Jun 24, 2014

Way old. Thanks for taking a pass at this... going to revisit when 🕐 allows.

@jfryman jfryman closed this Jun 24, 2014
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.

5 participants