-
-
Notifications
You must be signed in to change notification settings - Fork 881
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
Introducing Puppet Module Data #453
Conversation
class nginx::notice::puppet_module_data { | ||
$message = "[nginx] *** DEPRECATION WARNING***: HI! I notice that you're declaring some attributes in Class[nginx]. We are in the process of moving all of these attributes to Hiera with puppet-module-tool. Please check out https://github.com/jfryman/puppet-nginx/blob/master/docs/hiera.md for more information." | ||
|
||
notify { $message: } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of warning - there is a tendency for those to get lost on a Puppetmaster logs, as opposed to a notify
that is in-your-face on the client.
Looks good! Should it be titled "Introducing Puppet Module Data"? So The other thing is that I'd like to see only OS-level defaults set in the module data. I don't think it makes sense to have stuff like |
:hierarchy: | ||
- osfamily/%{::osfamily} | ||
- kernelversion/%{::kernelversion} | ||
- kernel/%{::kernel} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Facter falls back to kernel
when it doesn't have a specific match for osfamily
, so I think having kernel in the hierarchy is redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That functionality is only with Facter 2.2, right? I don't know if we can assert that across the board yet. Whadda think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's always been that way: puppetlabs/facter@8f938c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh. TIL. :) Incoming change.
Last thing: the hierarchy may need to include So I'd suggest the hierarchy be: - "operatingsystem/%{::operatingsystem}"
- "osfamily/%{::osfamily}"
- common Then maybe include operatingsystemmajrelease if there's a need to. |
@@ -4,7 +4,7 @@ | |||
|
|||
shared_examples 'redhat' do |operatingsystem| | |||
let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'RedHat' }} | |||
|
|||
spec/classes/package_spec.rb | |||
context "using defaults" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should undo this change, probably a typo
I could probably go either way with this... I do like the isolation with the package/file/service pattern, and to let the base-class be responsible for relationship chaining, hiera
Yeah, I know you brought this up in the previous pull, but I really like the idea of everything data driven in the I really think (hope) that by having any configurable value in Hiera that gives a the user the ability to be as flexible as possible, while not creating a ton of edge-cases in code. |
@3flex and thanks for cleaning up the remaining bits. I got tied up with this weekends activities.... https://twitter.com/Mekaeg/status/513429383147573248 |
This totally made sense when there were some things in I'll leave it at that - either way it'll have to be documented! |
That is true for adding new functionality, but not the same experience if I'm purely consuming the module. I think you're right - we'll need to document the change. But, this allows a user more flexibility. That's who I'm targeting here. Does that make sense? I might be splitting hairs, but it's a thought experiment I'm playing with. |
OK! Final 👍 ? |
Almost!
#user declares nginx class
include nginx
#then declares nginx::config with their custom parameters
class {'nginx::config':
...
}
#this will break This might cause more pain than intended.
I ran out of time tonight but I haven't yet had a close look at the new hierarchy and make sure it matches everything in |
Sorry, my first point was kind of stupid, you already can't declare |
Well, I wonder how bad this really is. It's built into Puppet 3, so I don't feel so bad for taking advantage of what I would consider a core part of the language now. That being said, I don't think that it's all dire. We could include a note in the upgrade notes that says something like this...
That will allow us to get around the multiple declaration concern.
Hmmm. Yeah. Good point. This will get fixed with the upcoming factory pattern I proposed in #423, but probably should come out of this pull. These are really great concerns... are they all being knocked out? |
As well as your last commit I think you should update the service/package parameters in common.yaml as well? But that's it from me! Sorry to be so pedantic. I think that upgrade message would be suitable. And the hierarchy looks fine. 👍 to merge! |
I thought that as well, but we had to include it in the spec fixtures. I guess that threw me off. I can nix that. |
…uppet-nginx into add-puppet-module-tool
It will continue to be set in the main nginx class.
Introducing Puppet Module Data
Introducing Puppet Module Data
This PR is an incremental step to introduce changes that were proposed in #423.
The scope of this pull is to eliminate the
params.pp
class, and collapse any user-configurable data to Hiera. Instead of attempting to explain why, I'll link this wonderful post.http://www.devco.net/archives/2013/12/08/better-puppet-modules-using-hiera-data.php