Skip to content
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

Add missing paths to allowed module layout #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions language/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ already explains what a module is and what it can contain.
| `/examples/` | Example Puppet snippets that explain how to use the module. They can be used within acceptance tests |
| `/facts.d/` | [External facts](https://www.puppet.com/docs/puppet/latest/external_facts.html) that are synced via [pluginsync](https://www.puppet.com/docs/puppet/latest/plugins_in_modules.html) |
| `/lib/facter/` | MAY contain custom facts |
| `/lib/puppet/type/` | Custom types |
| `/lib/puppet/provider/` | Custom provider for one or multiple types |
| `/lib/puppet/type/` | Custom Resource types |
| `/lib/puppet/provider/` | Custom provider for one or multiple Resource types |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, modules can put whatever they want in the /lib directory and it will be packaged in the module and pluginsynced to agents. So from an allowlist perspective, listing individual /lib/puppet/* directories is misleading. But from a "what are the various extension points" perspective, it's informative.

Copy link
Contributor

@bastelfreak bastelfreak Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, modules can put whatever they want in the /lib directory

is that something that we should allow here? Do you have anything in mind that isn't already covered by the different /lib/puppet/ subdirs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that something that we should allow here?

I think we should allow anything under /lib since that's how puppet behaves today. For example, there was some early confusion about /lib/puppetx vs /lib/puppet_x. And given /lib/augeas there may be some others?

In the future, I think it would be good to document which extension points are allowed in the /lib directory and add a deprecation warning to if we detect a dir/file that isn't allowed during pluginsync. Then in a major release, only pluginsync files that are in the allow list.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a deprecation warning to if we detect a dir/file that isn't allowed during pluginsync

Do you think it's realistic to introduce the warnings in Puppet 8 or maybe with Puppet 9.0?

| `/lib/puppet/functions/` | Modern functions in Ruby for the new API |
| `/lib/puppet/datatypes/` | Custom Puppet Data types |
| `/lib/puppet/face/` | Custom Puppet Faces |
| `/lib/puppet/feature/` | Custom Puppet Features for providers |
| `/lib/puppet/property/` | Custom Puppet Properties for Types/Providers |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also /lib/puppet/parameters

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also /lib/puppet/applications and /lib/puppet/reports

| `/lib/puppet/transport/` | Puppet Device Transports for the Resource API |
| `/lib/puppet/util/network_device` | Puppet Device Transports |
| `/lib/puppet/parser/functions/` | Legacy functions in Ruby |
| `/lib/puppet_x/` | Custom Ruby modules to extend types, providers, functions or facts |
| `/lib/augeas/lenses/` | Custom [Augeas](https://augeas.net/) lenses |
Expand Down