Phpstorm yaml formatter9/9/2023 ![]() This enables syntax highlighting for plain YAML files (no luck with Jinja though).Īnother plugin is called LiClipseText. Then go to Window -> Preferences -> General -> Editors -> File Associations and associate the *.sls extension with YEdit. Go to Help -> Eclipse Marketplace, search for “yedit” and install it. I was unable to find a good enough solution for Eclipse, but below are two directions you can try to explore: The indentation guides should be enabled by default by Salt plugin, but you can enforce it by clicking Edit -> Preferences -> Editor -> Show Indent Guide.Aligner-salt ( GitHub) to visually align YAML attributes.Language-salt - an alternative Atom plugin for Salt (enabled for *.sls files, provides the source.salt scope and a bunch of snippets)."*" : core: customFileTypes: "" : Other things to try You can assign specific language scope to any extension with something like this in your ~/.atom/config.cson: Supports syntax highlighting and folding.Atom-jinja2 provides the scope, which is enabled for *.jinja, *.j2 and a bunch of other extensions.Also, it should open Salt docs via the salt-doc command, but it didn’t work for me for some reason.This means you get syntax highlighting for py, pydsl, and pyobjects Salt renderers. The second scope is not associated with any file extension and instead is enabled for any files which start with #!py.The first atom-salt language scope is, which is automatically enabled for *.sls files and provides syntax highlighting (YAML+Jinja combo).Just click Edit -> Preferences -> Install, search for atom-salt or atom-jinja and install them. ![]() Plus, you could install atom-jinja2 and manually switch a file grammar to YAML (Jinja Templates) by pressing Ctrl+Shift+L.įor better results, you can install both atom-salt and atom-jinja2. Out of the box, Atom understands *.sls files as YAML. (Mailchimp has destroyed my mailing list, so everything is manual for now. If your favorite editor is not covered here, or you want to share a nifty hack that helps you reduce the number of YAML mistakes, ping me on Twitter. These plugins aren’t ideal, but they are open source, and you can contribute to any of them if you want (I did). Also, I will give a few installation/configuration tips to save you some googling. Know and highlight the most common Salt state keywordsīelow I’ll cover plugins for 9 different editors, so you do not have to switch away from your favorite one.Help you deal with YAML indentation levels and data structures.It will catch your typos before they get committed and deployed (and let the CI system deal with more complicated stuff). The first layer of defense can work right in your text editor as you type, providing immediate feedback. Well, your development environment can help you. Such a long feedback cycle could easily lead to git commit -m "Fuck YAML" in your commit history and a subsequent amend/rebase/squash dance (and you can’t squash the obscene commit notifications sent to the rest of your team!). You need to commit and push to run your tests, spin up VMs or containers, dive into Ruby code, and write tests for all possible pillar/grain permutations. A helpful guide on this topic is available here. Test your states using Test Kitchen together with kitchen-salt and some verifier. This triggers the state rendering process and can catch tons of possible errors. Use the salt-call -local -retcode-passthrough state.show_sls YOUR_STATE either manually or using a commit hook. For Salt, you have the following options: Indeed, it is possible to validate your states, in a semi- or completely automated way, even before they touch your infrastructure. Smart developers probably have this figured out, right? These issues definitely have come up before ( #802). Sprinkle a few Jinja tags here and there, and the errors can get even fancier… Is there anything that could be done? Indentation with mixed tabs and spaces, which took a surprisingly long time to debugĪnd even if your states are valid YAML, they still can have no sense for Salt because your wathc_in requisite has a typo.State requirements at the wrong indentation level.A nested dictionary, indented with two spaces instead of four.A ParserError or ScannerError while running the state.highstate.Data failed to compile: State ‘foo’ in SLS ‘bar’ is not formed as a list.A missing colon after the YAML key or a missing space after the colon.If you have ever written a couple of Salt states, these problems may sound familiar: Text editor plugins for Salt states and YAML/Jinja
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |