Puppet How can i check for syntax errors on my puppet code Is there any tool to do this

0 votes
I have written a puppet module using  puppet DSL, I need to cross check this module for any errors so that my module works efficiently. How can I validate my puppet code?
Aug 7, 2019 in Puppet by Sneha
8,707 views

1 answer to this question.

0 votes
  • At the lowest level of checking, you can use the Puppet parser to do syntax validation.

  • There are a couple of places where you can insert syntax validation. One method is by manually running `puppet parser validate` to make sure that the manifest can be parsed before you commit your changes or deploy them to a live environment.

  • Puppet parser lets you validate Puppet code to make sure it contains no syntax errors. It can be a useful part of your continuous integration toolchain.

For example :

Validate the default site manifest at /etc/puppetlabs/puppet/manifests/site.pp:

$ puppet parser validate

Validate two arbitrary manifest files:

$ puppet parser validate init.pp vhost.pp

For more info: https://puppet.com/docs/puppet/6.7/man/parser.html

  • In addition, you can integrate syntax checking into your editor. Vim has built in code compilation functionality that can be used to run error checking, so you can quickly validate your code and jump to sections of code with syntax errors. 

  • There are plugins like Syntastic that will do continuous checking so you're immediately alerted when syntax errors are made. 

  • There's another tool called puppet-lint that could be used to serve the purpose

answered Aug 7, 2019 by Sirajul
• 59,230 points

Related Questions In Puppet

0 votes
1 answer
0 votes
1 answer

Puppet+Docker: How do i configure my docker container to use a NFS volume?

docker_volume { 'nfs-volume': ensure => ...READ MORE

answered Aug 13, 2019 in Puppet by Sirajul
• 59,230 points
743 views
0 votes
1 answer

Puppet+Docker: How do i configure my docker container to use a NFS volume through a Hiera config file?

If using Hiera, configure the docker::volumes class in the ...READ MORE

answered Aug 14, 2019 in Puppet by Sirajul
• 59,230 points
926 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,034 views
+2 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How can i check the requests of certificates from puppet agent to puppet master?

You could do this by executing the ...READ MORE

answered Jul 24, 2019 in Puppet by Sirajul
• 59,230 points
3,001 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP