Getting module name in type or provider

25 views
Skip to first unread message

bert hajee

unread,
Oct 16, 2015, 12:11:47 PM10/16/15
to Puppet Developers
Hello ,

Is there a reliable way to get the module name inside of a custom type and/or a provider?  reliable in a sense that it works both when using puppet apply and also works on an agent. 

What I've tried so far is to deducting the type name from the call stack and the source. This works when using Puppet Apply, but when you are running Puppet on an agent this doesn't work. The ruby code on the agent is a fl;at lib directory and all module structure is gone.

Any suggestions would be welcome.

Regards,

Bert Hajee

Henrik Lindberg

unread,
Oct 20, 2015, 11:58:30 AM10/20/15
to puppe...@googlegroups.com
Sounds like a design problem in general. It is never a good thing when
having to use information about the "caller" in a magic way. And in this
context you do not even have that information.

Can you describe what you are trying to achieve - there is probably a
different way of getting what you want.

Regards
- henrik


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

bert hajee

unread,
Oct 20, 2015, 1:59:33 PM10/20/15
to Puppet Developers
We are looking into earning a living building high-quality puppet modules and selling support on them. We would like a provider to allow certain actions based on an entitlement license.  To do this we could use the type name as an entity, but it would be nice to cluster a set of types in a module entitlement. 

For example:

A module Tibco would have all the custom types needed to configure and manage a Tibco installation. In the providers I would like to check if the user is entitled to use the functionality on the current node. The tibco module would have multiple custom types, classes and defined types.

Bert


Op dinsdag 20 oktober 2015 17:58:30 UTC+2 schreef henrik lindberg:
Reply all
Reply to author
Forward
0 new messages