Comments (9)
Hello.
I personally completely prefer YAML since it's much more human readable and support comments.
My 2¢.
Regards.
from template-formula.
@aboe76 Sounds good! Thanks for adding that to the plan.
BTW, there's been a discussion on Slack about using the PillarStack_SDB
Module alongside TOFS for even greater efficiency. I remember you mentioning that you use (or have used) PillarStack. I'm going to add this to the plan as something to be evaluated. Dominik Bessler has offered to give us some feedback about this combination as well. Any thoughts from your experience?
from template-formula.
So the idea is to use JSON instead of YAML because parsing is faster?
I'm not completely ok with keeping both JSON and YAML files with the same information inside, it will just burden the repository and introduce confusion. If we just want to ease maintenance, maybe add doc about converting JSON to YAML, edit YAML, and then convert YAML to JSON.
from template-formula.
@daks Thanks for sharing your views. Always helps when others share their expertise.
Just to be clear, @aboe76 is discussing this in relation to formulas which contain an excessive amount of YAML. It may be worth exploring the performance gains from using JSON in those cases. Just sharing ideas for the time being as we explore how SaltStack Formulas can be improved.
I agree with you about avoiding duplication at all costs. I'm sure we can find a solution for this if we decide that we would like to go forward with it.
from template-formula.
Many programmers consider YAML controversial and prefer JSON. This is another consideration.
from template-formula.
@noelmcloughlin added a decent comment on a PR that needs to be included here:
One more thought (per the vision stuff, not this PR) is that salt can support both yaml and json configuration. All formulas use
yaml/
today but anticipatingjson/
or other data serialisation technology language in the design may make sense - something like this?template-formula/ template/ .. etc .. yaml/ defaults.yaml osmap.yaml osfamilymap.yaml json: defaults.json osmap.json osfamilymap.json
from template-formula.
Maybe #116 is of interest here.
from template-formula.
This conversation came up again in a Slack thread starting from this comment:
- https://saltstackcommunity.slack.com/archives/C7K04SEJC/p1586308765400800
- (This won't be available soon in Slack, so striking while the iron's hot!)
18h Nate
Hello, everyone.
I’ve been working with the SaltStack container to try and familiarize myself with Salt. One thing I’m having a hard time finding solid documentation on, is the structure of config files in /etc/salt/master.d/ The container writes your env var for master_config in JSON. However, I’ve seen some docs that state config files there need to be YAML. Does anyone have an opinion on how to handle those config files?18h Imran Iqbal
Simply copy the settings you'd like to override from /etc/salt/master and modify them in file(s) under /etc/salt/master.d.17h Nate
Thanks for the feedback! That makes sense. Do you know if the files can be both JSON and YAML?17h Imran Iqbal
I've never seen them in JSON format. Why would you want to override it like that? Wouldn't keeping it in the same format as /etc/salt/master be the simplest thing to do?17h David Murphy
you can feed them in JSON format since that is what the YAML parsed is turned into but it has been 4 years since done anything like that. Note YAML is a little easier to deal with, but JSON is doable17h Nate
I absolutely agree with both of you. To be honest, it’s been a slight struggle working with the container and converting to JSON. For reference, you can see the container taking JSON input and writing it to master.d. I may just move away from using the env vars, and use a dockerfile to add the config in as /etc/salt/master
Thanks again for your input and insight!
https://github.com/saltstack/saltdocker/blob/master/saltinit.py
32m Wayne Werner
also FWIW putting them in JSON format eliminates the YAML parsing overhead. If you have a lot of things, using JSON can significantly improve startup times. I'm not sure what the exact figures are, but I know they're significant28m Imran Iqbal
@Wayne Werner How much time would be saved with the default configuration files still provided in YAML? Or are you suggesting to effectively override entire configuration files for this performance gain?20m Wayne Werner
IIUC everything YAML in Salt gets parsed into a python dictionary, and JSON parsing is way faster than YAML. For basic config (<20-30 lines) this isn't a big deal. For a couple of thousand lines of pillar data & config, there's more advantage to using JSON ahead of time5m Imran Iqbal
Yes, I heard about this before. We were thinking about tackling this as some point: #24.
I've had a little thought about this. How about we still use YAML for development but we convert them to JSON for processing? We ensure that these generated files are also merged into the formula as artifacts to be consumed by map.jinja
in production. A one-way conversion only, a bit like how JS files are minified, for performance gains. We could use the one-liner that @aboe76 provided in the first post of this issue.
from template-formula.
Perhaps this could be done when packing into an spm.
from template-formula.
Related Issues (20)
- [BUG] Failure when running the formula on FreeBSD
- [FEATURE] Adopt `quoted-strings` rule from `yamllint` for selected files [ssf] HOT 3
- How to add multiple sub config files HOT 3
- [BUG] `convert-formula` calls ex with unknown argument HOT 6
- [BUG] Debian Docker image should have dbus installed HOT 25
- [QUESTIONS] Best practice to include other formulas? HOT 2
- Finalise standardisations remaining from the `_mapdata` implementation HOT 10
- Remove tags when doing the bin/convert-formula.sh HOT 1
- Remove tags when running bin/convert-formula.sh HOT 1
- [FEATURE] Use https://reuse.software/
- [FEATURE] Use https://editorconfig.org/
- gitlab-ci.yml file can be split to increase readability HOT 4
- [FEATURE] Use Copier to keep formulas up-to-date with template development automatically HOT 2
- [BUG] The shellcheck pre-commit hook installation fails HOT 1
- [BUG] convert.sh script does not change gitlab-ci stuff HOT 5
- [FEATURE] basic schema and data validation [cuelang] HOT 1
- [BUG] v5.0.0+ failed on Raspberry Pi 4 with error "Jinja variable 'opts' is undefined" HOT 2
- [FEATURE] Use dynamic values in Inspec tests instead of hardcoded HOT 5
- [BUG] Doc: what is a role? HOT 1
- [BUG] Incorrect usage of file.managed mode HOT 2
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 template-formula.