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

Modernize module #35

Closed
wants to merge 4 commits into from
Closed

Conversation

ghoneycutt
Copy link
Member

Taking a quick pass at adding support for Travis, Puppet v3, Ruby 1.8.7,
1.9.3, and 2.0.0 and passing lint. Also specifies the version of concat
(1.1.0) and stdlib (4.1.0).

@ghoneycutt
Copy link
Member Author

Could you please enable travis on this repo?

PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

desc "Run puppet in noop mode and check for syntax errors."
Copy link
Member

Choose a reason for hiding this comment

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

You should have a look at puppet-syntax since it's a lot faster than calling things in shell.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point! I'll look into it.

Think it is good to merge as is though, considering that puppet uses this code now by default when generating modules.

https://github.com/puppetlabs/puppet/blob/master/lib/puppet/module_tool/skeleton/templates/generator/Rakefile

Copy link
Member

Choose a reason for hiding this comment

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

I created ghoneycutt#1 to integrate this, plus some other things.

@ghoneycutt
Copy link
Member Author

@hunner as the last person who touched this module, what do you think about this PR?

@@ -23,6 +25,8 @@
validate_array($ntpservers)

include dhcp::params
include dhcp::monitor
include concat::setup
Copy link
Member

Choose a reason for hiding this comment

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

I thought concat::setup was deprecated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure why that is there..good eye. Shall I just remove that line?

@ghoneycutt
Copy link
Member Author

PuppetLabs folks: I'll squash these commits upon request, please do not merge as is.

@@ -1,6 +1,10 @@
fixtures:
repositories:
concat: 'git://github.com/puppetlabs/puppetlabs-concat.git'
stdlib: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
concat:
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer always checking against the newest git versions.

Copy link
Member Author

Choose a reason for hiding this comment

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

That does not make for very good tests. We should be explicit about what version is supported and test against an exact ref, not HEAD.

@ekohl
Copy link
Member

ekohl commented May 21, 2014

https://github.com/garethr/puppet-module-skeleton has a very nice set of defaults for Gemfile, Rakefile and .travis.yml btw.

class dhcp (
$dnsdomain,
$nameservers,
$dnsdomain = [ $::domain ],
Copy link
Member

Choose a reason for hiding this comment

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

puppet-lint produces a false positive here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, its got a bug when you use a fact as a value for a param. It is OK though.

Copy link
Member

Choose a reason for hiding this comment

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

Not if you want to set up puppet-lint to fail on warnings, which IMHO you do want.

Copy link
Member

Choose a reason for hiding this comment

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

If $::domain is undef, then this will blow up in the template. Many customers have boxes without a domain fact value.

Copy link
Member

Choose a reason for hiding this comment

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

@apenney
Copy link
Contributor

apenney commented May 22, 2014

I think we're ok with most of this! We made a few comments along the way but it's in pretty good shape for merging. We're going to update the style guide to say inheriting from params.pp is fine.

@ghoneycutt
Copy link
Member Author

@apenney moved that logic into params. Anything else you want me to fix up before squashing commits?

@ghoneycutt
Copy link
Member Author

@apenney squashed the commits

@ekohl
Copy link
Member

ekohl commented May 23, 2014

@ghoneycutt I think it also needs a rebase now.

@ghoneycutt
Copy link
Member Author

rebased

mode => '0644',
before => Package[$packagename],
notify => Service[$servicename],
content => template('dhcp/debian/default_isc-dhcp-server'),
}
'redhat','centos','fedora','Scientific': {
Copy link
Member

Choose a reason for hiding this comment

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

This should be rewritten to $::osfamily as well.

@ghoneycutt
Copy link
Member Author

@apenney Could you please merge this?

@ekohl
Copy link
Member

ekohl commented Jun 1, 2014

@ghoneycutt No, you should first fix the issue in init.pp with $::osfamily.

@ekohl
Copy link
Member

ekohl commented Jun 1, 2014

You changed rewrote the case statement to an if statement and in the rebase this resulted in invalid syntax. That must be fixed before it can be merged.

@ghoneycutt
Copy link
Member Author

@ekohl fixed

Taking a quick pass at adding support for Travis, Puppet v3, Ruby 1.8.7,
1.9.3, and 2.0.0 and passing lint. Also specifies the version of concat
(1.1.0) and stdlib (4.1.0).
@ghoneycutt
Copy link
Member Author

@apenney rebased so this can be merged.

This patch enforces the use of parameterized classes and encoding data
in your manifests.
@apenney
Copy link
Contributor

apenney commented Jul 24, 2014

The only issue I'm aware of now is the dnsdomain => parameter that defaults to $::domain. Because this may be undef for many users this'll make the template catch on fire and explode. I think that's literally the only issue left before this can be merged.

(Having said that some of this PR, the travis stuff, etc) will eventually get overwritten as we're starting to manage those through a central repo that can automatically build and commit these files for all modules.

@underscorgan
Copy link
Contributor

@ghoneycutt ping? Can you update the last issue with this PR?

@ghoneycutt
Copy link
Member Author

@mhaskel Thanks for the reminder as I had forgotten about this code.. pushed up what I was working on previously.

} else {
fail('dhcp::dnsdomain must be set and domain fact is missing to use as a default value.')
}
}
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 you're missing an

else {
  $dnsdomain_real = $dnsdomain
}

kimor79 added a commit to kimor79/puppetlabs-dhcp that referenced this pull request Jan 6, 2015
@tphoney
Copy link
Contributor

tphoney commented Mar 2, 2015

@ghoneycutt ping? Can you update the last issue that @mhaskel mentioned.

This patch works around the case where the domain fact is absent while
ensuring that all parameters have default values.
@ghoneycutt
Copy link
Member Author

Updated the code as requested as well as updating the Travis-ci framework. This code needs to be rebased, which I have no interest in doing. Perhaps someone that uses this module and wants the extra functionality that I added will have time to do so.

@underscorgan underscorgan mentioned this pull request Mar 3, 2015
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.

None yet

7 participants