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

Allow to create virtual resources dynamically #9363

Open
vicinus opened this issue May 23, 2024 · 2 comments
Open

Allow to create virtual resources dynamically #9363

vicinus opened this issue May 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@vicinus
Copy link
Contributor

vicinus commented May 23, 2024

Describe the Bug

Trying to create virtual resources dynamically results in an error, that the resource name does not conform to the naming rule:

puppet apply -e 'Resource["@File"] { "/tmp/test.txt": }'
Error: Evaluation Error: Illegal type reference. The given name '@file' does not conform to the naming rule (line: 1, column: 10) on node xyz

Expected Behavior

Should allow creating virtual resources like create_resources does.

Steps to Reproduce

puppet apply -e 'Resource["@file"] { "/tmp/test.txt": }'
Error: Evaluation Error: Illegal type reference. The given name '@file' does not conform to the naming rule (line: 1, column: 10) on node xyz

Environment

Tested with puppet agent 8.6.0

@vicinus vicinus added the bug Something isn't working label May 23, 2024
@tvpartytonight
Copy link
Contributor

@vicinus I am not clear what you mean by the create_resources in the Expected Behavior section; do you think you could write some more detail in about that?

@vicinus
Copy link
Contributor Author

vicinus commented May 29, 2024

I just meant, that with create_resources it is possible to create virtual resources dynamically, without an error:

puppet apply -e 'create_resources("@file", { "/tmp/test.txt" => {}})'
Notice: Compiled catalog for xyz in environment production in 0.02 seconds
Notice: Applied catalog in 0.02 seconds

If I understand the documentation of create_resources correctly, then the usage of create_resources is discouraged and the Resource version is preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants