Comments (12)
@ecojan Well... it's not implemented. Quotation is only used as an example.
I've only used quotes as an example on escaping values. Wanted to use something else but thought quotation would be more familiar and easy to visualize.
Conclusions from this thread is that the feature needed is not a flag or a list of keys to ignore in interpolation validation, but proper escaping for values.
from himl.
I think we can use a similar escape sequence as in go templates:
{{`this is a {{value}} that should not be interpolated`}}
/cc @costimuraru
from himl.
I can see this as a valid use case resolved right now by the flag you mentioned 'skip_interpolation_validation=True'.
Also, excluse will completely remove the key before any interpolation. I'm thinking you want something that will not do validation on specified keys. This has the potential to be missused or get cumbersome with more than a few keys that you need to keep track of.
Can you elaborate more on your use case and why just disabling validation doesn't work?
from himl.
Can you elaborate more on your use case and why just disabling validation doesn't work?
I see the validation as a safety net, something that must be interpolated but doesn't get interpolated due to an error should come up when running himl. On the other hand if there are some keys that you specifically don't want to interpolate (leave them as they are), here is where I would see the advantage of having an option to exclude the aforementioned key from the interpolation process.
WDYT?
from himl.
Yes, validation good.
Still interested in your use case, if you can elaborate on that.
At first glance seems you are trying to use hiera as a template engine to template a template and I don't think this is a good use case.
from himl.
Yes, validation good.
Still interested in your use case, if you can elaborate on that.
At first glance seems you are trying to use hiera as a template engine to template a template and I don't think this is a good use case.
I'm not sure what you are referring to or how hiera is tied in here.
My use case is as follow:
I have the following yaml file in one of the subdirectories traversed by himl
slack_configs:
- channel: my-channel
text: '{{ template "__slack_text" . }}'
I'm just trying to ignore the text
key during interpolation here as it would crash the himl processing without disabling validation. The value for the text
key ( '{{ template "__slack_text" . }}'
) is gonna be used later in the obtained output by something independent of himl (again just trying to ignore a key).
from himl.
The issue is when using himl on a configuration that needs to be passed to a different application that is using the same format "{{"and "}}"
from himl.
Seems that what you need is to escape the key value. For example, using double quotes in key: "{{ val }}"
resolves the interpolation, but using single quotes key: '{{ val }}'
results in the literal {{ val }}
string. I think instead of manually ignoring some keys it would be better to support escaping interpolation on values. Would this fit your use case?
from himl.
Escaping interpolation is the keyword here, yes.
Double quote vs single quote seems weak though.
The himl user should be able to explicitly turn off interpolation within a value.
And it may not be possible to implement, when parsing value in https://github.com/adobe/himl/blob/master/himl/interpolation.py#L17
key: "value"
, key: 'value'
and key: value
are equivalent in yaml parser. you get the value
string
from himl.
I've only used quotes as an example on escaping values. Wanted to use something else but thought quotation would be more familiar and easy to visualize.
from himl.
Cool - makes sense
from himl.
@danielcoman I tried escaping via single quotes vs double quotes.
None of them have worked, they both are equivalent as @amuraru said.
One option that can actually make it work is "--skip-interpolation-resolving" but this is not actual escaping and is turning off other features.
from himl.
Related Issues (20)
- Support for jinja syntax in yaml variables HOT 1
- [Feature Request] support for custom merger with different merge strategies HOT 2
- Missing args in ConfigGenerator dynamic data sources method
- [Feature] Allow picking specific default file to merge with specific override file in API HOT 1
- Complex example compilation fails
- himl binary not working in actual directory HOT 1
- Q. How to remove keys on merge? HOT 2
- Select among multiple .yaml files HOT 2
- [Feature Request] himl cli - deep filter
- Reading config from S3 bucket HOT 3
- Use setuptools extras for extra dependencies HOT 1
- Integrate with vals
- Error in the Vault usage docs
- Allow disabling Vault SSL verify HOT 2
- Double newline with multiline strings from Vault
- Retrieve values from environment variables
- Add unit tests for himl
- Dependency Dashboard
- `ConfigProcessor.process(skip_interpolations=True)` flag not working as expected HOT 1
- Version 0.10.0 requires vault package (and more) to be installed instead of being optional
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from himl.