On Mon, Dec 29, 2014 at 4:20 AM, Brice Figureau <
brice-pup...@daysofwonder.com> wrote:

> Hi,
>
> I'm still playing with my file_metadata implementation, and want to
> provide the 'modules' special mount. This mount requires finding the
> module path of a given environment in the clojure part.
>
> I found environment registry references in the code, but I'm really
> unsure it fulfills my requirements (accessing the ruby environments
> specific information) or how to use it.
>
> Any pointers I should look to?
>

Ewww... that's a really sticky one that I hadn't thought of yet.  For now,
there is no way to get access to a setting like that directly from the
clojure code, without making a call into the JRuby layer.

Medium-to-long term, our goal is going to be to eliminate dependencies on
JRuby for this sort of thing, so that new service implementations can be
written in pure Clojure.  This ultimately means migrating the relevant
settings out of puppet.conf and into the puppetserver configuration.  So I
can see a couple of different options to explore:

1. Just add whatever extra settings you need to the puppetserver config
files now; the settings would end up being duplicated across the two
configs for the time being, which is not something we'd want to do in an
actual release, but would be the path of least resistance for an
experimental branch.

or

2. Make your new service have a TK dependency on the
PuppetServerConfigService, like we are currently doing for the CA:

https://github.com/puppetlabs/puppet-server/blob/master/src/clj/puppetlabs/services/ca/certificate_authority_service.clj

Then make sure the PuppetServerConfigService exposes the particular
settings you're interested in from Puppet, e.g.:

https://github.com/puppetlabs/puppet-server/blob/master/src/clj/puppetlabs/services/config/puppet_server_config_core.clj#L15

I'm not even 100% sure that that would completely solve your problem,
though, because in Puppet 4 with the directory environments you probably
need to actually look up the environment via some ruby code and then
interrogate the module path from the ruby object.  In that case you would
probably need to extend the JRubyPuppet interface:

https://github.com/puppetlabs/puppet-server/blob/master/src/java/com/puppetlabs/puppetserver/JRubyPuppet.java#L17

and provide a method for looking up the modulepath for an environment.
Plumbing that through probably wouldn't be *too* hard, but will be a very
expensive operation if you don't figure out a reasonable way to cache the
results so that you don't have to do it on every request.

This whole situation w/rt environments is probably something that we need
to add to the list with auth.conf and do some design work around how to
solve it the right way for the long-term. :(  Thanks for raising the issue,
I'll start trying to put some thought into it.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/CAMx1QfLNEPtiktgVHsLiZuLkM6dPQo8zFPRZAMzzOGHMngdeHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to