Jira (PUP-11894) Namespacing ruby providers and types

13 views
Skip to first unread message

Markus Zilch (Jira)

unread,
Jun 13, 2023, 9:14:03 AM6/13/23
to puppe...@googlegroups.com
Markus Zilch created an issue
 
Puppet / New Feature PUP-11894
Namespacing ruby providers and types
Issue Type: New Feature New Feature
Assignee: Unassigned
Created: 2023/06/13 6:13 AM
Priority: Normal Normal
Reporter: Markus Zilch

Currently (as far as I know), providers and their corresponding types are not namespaceable.
This could result in clashing definitions if two modules provide the same type via ruby (not sure).
Either way, for consistency with classes and resource definitions, types and providers should be namespaceable too.
Instead of:

Puppet::Type.type(:package)

and resulting usage:

package {"namevar":}

The namespaced versions could look something like this:

Puppet::Type.type(:module::package)

and usage:

module::package{"namevar":}

Should this already be possible (and I missed this during my tests), then amending the documentation would be much appreciated smile.png

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.21#820021-sha1:38274c8)
Atlassian logo

Josh Cooper (Jira)

unread,
Jun 13, 2023, 4:08:02 PM6/13/23
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jun 13, 2023, 4:09:02 PM6/13/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
Team: Comply EMEA Phoenix

Josh Cooper (Jira)

unread,
Jun 13, 2023, 4:09:02 PM6/13/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Acceptance Criteria: {quote}Enumeration of requirements to consider the story ticket done.
{quote}

Josh Cooper (Jira)

unread,
Jun 13, 2023, 4:15:03 PM6/13/23
to puppe...@googlegroups.com
Josh Cooper commented on New Feature PUP-11894
 
Re: Namespacing ruby providers and types

Markus Zilch implementing this feature would require changes throughout the agent and server. For example, we currently flatten types & providers from different modules into a single lib/puppet/type directory structure (see PUP-3922). Also types are loaded on the server and it's not possible to have multiple definitions of the same ruby class (we don't have this issue with 4x functions because of the way we load them into ruby).

Could you provide some more details around what problem you're running into? I agree that if we were implementing this from scratch, then namespacing types/providers would be great, but it would require a lot of work to make that happen.

Markus Zilch (Jira)

unread,
Jun 13, 2023, 5:15:03 PM6/13/23
to puppe...@googlegroups.com
Markus Zilch commented on New Feature PUP-11894

I did not run into any specific problem per se. I more or less stumbled into the namespacing issue as described in PUP-3922 during refactoring of a module.
I have a class that wraps mutliple things together for usability, some of these components are other classes of the module, some are built in a provider type fassion. The resulting construct therefore reads inconsistent and is not easy to maintain, as you have to check what resources/types/classes are provided by puppet directly or the own module or even other modules.

Clashing "duplicate" declarations as described in the mentioned issue are another sideeffect of the lack of namespacing. Lets say we have two environments, each loads module A which provides the type and provider "owntype" and uses the type actively. Now we add another module B which also provides "owntype". Due to the way the classes are loaded, Bs "owntype" theoretically might get preverence over As "owntype" in As own implementation (this is the part I havent tested). This could result in different behaviour of the same module that is very hard to debug and possibly impossible to resolve from a users perspective, simply because these modules could be thirdparty and needed by different teams for example.

At the same time, I dont think this is a huge problem currently as provider type definitions are "rare" compared to class definitions and the names of the providers in practices mostly are so specific the chance of accidental duplication is near zero. The biggest benefit would probably be consistency.
But it is something that should be kept in mind and possibly changed at some point. If that point is any time soon and if the work needed is worth it, I dont know.

Reply all
Reply to author
Forward
0 new messages