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
fixes #8162 - scan classes directories recursively #238
Conversation
I don't really see the relation to the original problem. The ticket indicates the modulepath from the API is My understanding of the problem description is that $environment doesn't get interpolated at any stage, so those directories are never searched. |
I thought so too, but apparently environmentpath = /etc/puppet/environments
basemodulepath = /etc/puppet/environments/common:/etc/puppet/modules:/usr/share/puppet/modules:/etc/puppet/environments/$environment/modules/forge I have the following environments in that puppet: [
"development",
"example_env",
"production",
"common"
] In example_env, I have created a module under [
{
motd: {
params: {
template: "motd/motd.erb"
},
module: null,
name: "motd"
}
}
] I have also made sure that the previously saved modules (under production) are parsed correctly. |
What directory is passed into scan_directory in that case, when it isn't working? |
I see your point. The directory that was passed was |
That sounds incorrect then, it should be Edit: except interpolated, naturally. |
Well, dug around it a bit. Warning: You cannot interpolate $environment within 'modulepath' when using directory environments. Its value will remain /etc/puppet/environments/development/modules:/etc/puppet/environments/common:/etc/puppet/modules:/usr/share/puppet/modules:/etc/puppet/environments/$environment/modules/forge. (The error is generated here: https://github.com/puppetlabs/puppet/blob/master/lib/puppet/settings.rb#L1357) Now, when I look at my smart proxy puppet environment (at: {
name: "example_env",
paths: [
"/etc/puppet/environments/example_env/modules",
"/etc/puppet/environments/common",
"/etc/puppet/modules",
"/usr/share/puppet/modules",
"/etc/puppet/environments/$environment/modules/forge"
]
} When trying to scan directories, we'll get the My question: Shall I bypass puppet and replace the |
Good find! I'd suggest replying on the ticket and stating that this doesn't appear to be supported in Puppet itself (the commit has an interesting explanation). I think this can be rejected and dropped. I wouldn't suggest ignoring Puppet and interpolating it, because users will simply find that the classes then appear in Foreman and don't work in Puppet - we should mirror the behaviour as much as possible. |
Agreed. I'm closing this PR, but will refer to it in my reply. |
These environment paths do work in puppet for the UAT environment puppet will scan the following (as returned by the curl request):- "/etc/puppet/environments/uat/modules", Foreman on the other hand only scans "/etc/puppet/environments/uat/modules" and modules in the other two locations are ignored |
@RobertMortimer in your bug report and e-mail, the "uat" in the modulepath list is not there - it says $environment. Can you confirm which it is? If it's $environment then we're saying that Puppet doesn't support this - it might have worked for a couple of minor releases, but certainly in the latest it's been removed again as it wasn't intended. |
The curl request returns a path set for each environment. Like so:- "uat": {"settings": I believe for the given configuration puppet internally expands this to the following module search path:- "/etc/puppet/environments/uat/modules", Foreman on the other hand does not appear to do the expansion resulting in a discrepancy between the Foreman detected modules and the modules available to puppet. This may however be seen as a bug in puppet as if it is expanding this search path for internal use it should also return the absolute path via the curl result without requiring the substitution to be done by the client. I will double check my old configuration for typos and confirm behavior. Thanks for looking at this I will get back with more detail |
Right, so if you're adding the forge/local paths in your basemodulepath, you should know that Puppet 3.7.1 added a warning and stopped this behaviour in this commit: puppetlabs/puppet@65b85b8 (ticket https://tickets.puppetlabs.com/browse/PUP-3162) as it wasn't meant to be supported. I guess your environment might be working if you're between Puppet 3.5.0 and 3.7.0, but since it's now explicitly not supported by Puppet we decided not to emulate this removed behaviour. |
That is a pain. We have some modified forge module that we wanted to separate to make it obvious that they were not stock modules. Go puppet! not quite time to re-review ansible and salt but puppet does not seem to be helping it's self at the moment. Puppet DB is a pain to configure and the puppet dashboard although paid for does not give us the functions Foreman does (especially in the use of environments where puppet labs increasingly seems to be pushing you to install multiple puppet servers). Thanks for the help and a great product. |
P.S. we dropped the configuration once as it was not supported by Foreman so missed the issues when we upgraded. |
Ah okay. I think the intention is that you deploy environment.conf into your environment directories and set modulepath inside it: https://docs.puppetlabs.com/puppet/latest/reference/config_file_environment.html Something like this:
|
Will Foreman pick that up? |
Yes, as the Puppet API should then return the modulepath list with absolute paths. |
Thanks |
No description provided.