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

(#127) Allow escaping %{...} in hiera data so that hiera does not try to... #184

Closed

Conversation

ChrisPortman
Copy link

... perform a replacement

This change allows the escaping of %{...} with %%{...} so that the result is literally '%{...}'

It also support escaping the escape eg:
var = 'value of var'

%{var} : 'value of var'
%%{literal} : '%{literal}'
%%%{var} : '%value of var'
%%%%{literal} : '%%{literal}'

…es not try to perform a replacement

This change allows the escaping of %{...} with %%{...} so that the result is literally '%{...}'

It also support escaping the escape eg:
 var = 'value of var'

    %{var}      : 'value of var'
   %%{literal}  : '%{literal}'
  %%%{var}      : '%value of var'
 %%%%{literal}  : '%%{literal}'
@zaphod42
Copy link
Contributor

Hi @ChrisPortman, thanks for the contribution. Unfortunately we can't take this since it is backwards incompatible, as discussed in HI-127. I think the only way we are going to be able to get this is with the suggested escape "function" or some variation thereof.

@zaphod42 zaphod42 closed this Mar 19, 2014
@ChrisPortman
Copy link
Author

Hi @zaphod42,

What if this approach were to be a hiera configurable so that:
a) it is off by default and impactless unless explicitly enabled; and
b) the escape sequence can be defined as the value for the cofigurable so that if using the '%' were to break people manifests, they could specify something else, potentially even a multichar sequence

Would that address the compatibility concerns?

Thanks,
Chris

@zaphod42
Copy link
Contributor

@ChrisPortman, I'd like to keep more this kind of configurability out of hiera. Configurability at this level (how it interprets what is essentially the hiera language) makes it harder to share hiera data, and I think would just add to confusion, especially if people start putting hiera data inside modules and use one of the various systems that have been published to that end.

I added a comment to HI-127 where it looks like we can actually get "escaping" behavior by simply defining a variable named % to have a value of % and so you can do %{%}{something} to get an output of %{something}

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