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

inspect escaping node variable #373

Closed
famfop opened this issue Jan 7, 2021 · 3 comments
Closed

inspect escaping node variable #373

famfop opened this issue Jan 7, 2021 · 3 comments

Comments

@famfop
Copy link

famfop commented Jan 7, 2021

Affected Puppet, Ruby, OS and module versions/distributions

Debian 10, Puppet 6, Ruby 2.3.3p222,

How to reproduce (e.g Puppet code you use)

In hiera I set (among others) the key artifacts_path like

  artifacts_path: "/mnt/gitlab/#{node['fqdn']}/artifacts"

I did try multiple different ways but I think the .inspect-method prevents my success.

What are you seeing

My generated config.rb contains /mnt/gitlab/\#{node['fqdn']}/artifacts. Note the backslash \#.

What behaviour did you expect instead

I do expect this to happen using the inspect-method. I am wondering how I may prevent this behaviour as gitlab needs the # unescaped.

Output log

Any additional information you'd like to impart

I should note that I am not using the whole repository as of now, as I am working on an already existing self-made puppet environment. I would like to use the template though and I could not find any information on how this repository deals with this issue.

@kenyon
Copy link
Member

kenyon commented Jan 8, 2021

Looks like you can't prevent this, that's just how the Ruby inspect method works on strings. Seems like this is not a very good way to do it if this template is supposed to be producing valid Ruby itself. Since you're not using the module, you can just edit the template however you want. For this Puppet module though, I think converting it to EPP would be a good first step.

@kenyon
Copy link
Member

kenyon commented Jan 8, 2021

Also, I don't even see artifacts_path in this module at all. If you're using this template outside of this module, I think this usage is invalid as it's not being used as intended, and therefore this bug report is also invalid. So, closing issue.

@kenyon kenyon closed this as completed Jan 8, 2021
@famfop
Copy link
Author

famfop commented Jan 8, 2021

It is in fact a key of the gitlab_rails hash. I accept that it is closed, in fact I think you are right. But out of curiousity, because I don't understand how this repo deals with it: How is the data produced by the template postprocessed such that this behaviour as I describe cannot happen?

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

No branches or pull requests

2 participants