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

stdlib::parsehocon: Support reading files #1436

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bastelfreak
Copy link
Collaborator

Summary

This makes it possible to also parse hocon files. I'm a bit unsure if we should extend the current function or add a new load like stdlib::loadhocon. I'm fine with both. Let me know what you prefer and I will add some tests for it.

Additional Context

Add any additional context about the problem here.

  • Root cause and the steps to reproduce. (If applicable)
  • Thought process behind the implementation.

Related Issues (if any)

Mention any related issues or pull requests.

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified. (For example puppet apply)

require 'hocon/config_factory'

begin
if File.exist? hocon_string
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not a fan of this, because this can also run on the server. It becomes unpredictable.

Isn't there a way to read a file in puppet? I know file() can be used in some cases. Its docs mention it can also read absolute files, so I'd expect this to work:

stdlib::parsehocon(file('/path/to/file'))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes the idea was to read a file from a PE installation on the puppetserver. Your solution should work. I think I will propose this function to the hocon module in case that's still maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants