When you edit yaml-files which will be used by puppet, you must to have a tool to check syntax of your files. This tool’s name is puppet-lint. Now I will write down how can you use it under windows.
The situation:
You wrote / modify your yaml-file(s) & you would like to verify at least the syntax of it.
You can use Notepad++ to see in highlighted the syntax of it, but it will not indicate, when you leave non-double spaces or tab on it which interrupt phrase of yaml-file.
Another option that you use online-validator like this (yaml-lint). It is fast & easy to use but insecure and not customizable. If you not store sensitive data on yaml-file this way is the fastest for general purposes.
Finally this blog’s topic target also an option (puppet-lint on windows with ruby). This option is offline (always available) fast, script-able, customizable and secure, but hard to install it & a little bit harder to use than online-validator version. Lets explain it.
Puppet-lint on Windows:
Under linux use puppet-lint is not a big deal. You use the system’s package-manager to search & install it. Under windows it is not as easy. So start it:
Install Ruby:
Ruby is the “framework” for puppet-lint “gem”. To run gem(s) under windows, you need to install ruby as interpreter. Please install ruby (simply next-next-finish). Execute “Start Command Prompt with Ruby”. Now you will get a command-line like interface. For navigate please use DOS commands (cd; cd..; dir). TAB-complete works also in here like bash!
Install gem (puppet-lint):
Gem is look like an executable plugin. You can find tons of gems in here. Please download puppet-lint than navigate with Ruby’s Command Prompt to the folder where you store gem. To install it: “gem install puppet-lint-2.0.2.gem”. Please replace the gem’s file name with your file’s name. When installation was finished, you can try it. The syntax of it:”puppet-lint <your_yaml_file>”. For example:puppet-lint common.yaml
My practice to use it in effective way:
I create a directory where I store all of my editable yaml-file (or if you have GIT / another version control system, stand to the folder where you store these files). I work on these files, edit, create of them. When I finished my work I check all of yaml-files with the following simple batch-script:
To customize it, please visit puppet-lint’s homepage.
To write more complex or different script you can study from Windows batching (like this).
I hope I could save time for you with this tutorial. Thanks for the developer of puppet-lint & Ruby.