How to syntax debug in puppet 3?

272 views
Skip to first unread message

Sandra Schlichting

unread,
Aug 24, 2012, 5:52:00 AM8/24/12
to puppet...@googlegroups.com
Dear readers,

How do I syntax debug the config files on the puppet master before I deploy them?

My current problem is that server_list is to be an array, and I don't know if I should write

  class { 'ntp': server_list => $ntpServerList }
or
  class { 'ntp': server_list = $ntpServerList }

How do I debug such a situation on puppet 3?

Hugs,
Sandra



  include common
  class { 'ntp': server_list => $ntpServerList }
}

class common {
  include common::data
}

class common::data {
  $ntpServerList = [ 'ntp1.example.com','ntp2.example.com','ntp3.example.com' ]
}

Bernd Adamowicz

unread,
Aug 24, 2012, 6:02:57 AM8/24/12
to puppet...@googlegroups.com

Did you ever try Gepetto (https://github.com/cloudsmith/geppetto)? At least in the coming version (3.0) will support Puppet 3. I really do recommend Gepetto since I’ve been working with it for more than a year now and it helped me a lot creating error free code. You should give it a try. There are also current beta releases available which (as far as I know) already do support Puppet 3. It’s available as an Eclipse plugin and as a standalone program.

 

Cheers,

Bernd

 

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/wBOih0BkLQMJ.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Sandra Schlichting

unread,
Aug 24, 2012, 6:27:15 AM8/24/12
to puppet...@googlegroups.com
Hi Bernd
 

Did you ever try Gepetto (https://github.com/cloudsmith/geppetto)? At least in the coming version (3.0) will support Puppet 3. I really do recommend Gepetto since I’ve been working with it for more than a year now and it helped me a lot creating error free code. You should give it a try. There are also current beta releases available which (as far as I know) already do support Puppet 3. It’s available as an Eclipse plugin and as a standalone program.

Ok, so Gepetto is a plugin for Eclipse?

I don't suppose it works with either VI or emacs?

Hugs,
Sandra


Bernd Adamowicz

unread,
Aug 24, 2012, 6:44:35 AM8/24/12
to puppet...@googlegroups.com

Hi Sandra,

 

Yes, you may either use it as an Eclipse plugin or as a standalone program. There’s no link to vi or Emacs at all. I think I know what you mean. My absolutely favorite editor is vim. Normally I don’t need anything else but the command line and vim. However, when it’s about creating source code (Puppet, Java, whatever) I want to have the ability to see my errors while I’m typing and that’s why I then move to some GUI stuff like Eclipse. It saves me a lot of time. (Not to mention some other advantages like code formatting.)

 

I know there are also command line tools for validating Puppet code. Maybe someone else from this list can provide more information.

 

Cheers

Bernd

 

--

You received this message because you are subscribed to the Google Groups "Puppet Users" group.

To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/oljsXv0_ayIJ.

Juan Sierra Pons

unread,
Aug 24, 2012, 7:20:02 AM8/24/12
to puppet...@googlegroups.com
Hi

I my 5 cents:

I first use vim-puppet (syntax highlighting for puppet manifests in
vim while creating my manifest) To create my manifests

Then I use
- puppet parser validate file.pp (Validate the syntax of one or more
Puppet manifests).

- puppet-lint file.pp (Check that your Puppet manifest conform to the
style guide) this one must installed using gems package manager: gem
install puppet-lint

Usually inside a loop to check many files at a time

Check all .pp files in a directory
find -name '*.pp' | xargs -n 1 -t puppet parser validate
find -name '*.pp' | xargs -n 1 -t puppet-lint

Best regards
--------------------------------------------------------------------------------------
Juan Sierra Pons ju...@elsotanillo.net
Linux User Registered: #257202 http://www.elsotanillo.net
GPG key = 0xA110F4FE
Key Fingerprint = DF53 7415 0936 244E 9B00 6E66 E934 3406 A110 F4FE
--------------------------------------------------------------------------------------

2012/8/24 Bernd Adamowicz <Bernd.A...@esailors.de>:

Sandra Schlichting

unread,
Aug 24, 2012, 7:58:58 AM8/24/12
to puppet...@googlegroups.com

Yes, you may either use it as an Eclipse plugin or as a standalone program. 

[snip]

That sounds interesting.

How do I do that? =)


Sandra Schlichting

unread,
Aug 24, 2012, 8:04:40 AM8/24/12
to puppet...@googlegroups.com
Dear Juan


- puppet parser validate file.pp (Validate the syntax of one or more
Puppet manifests).

- puppet-lint file.pp (Check that your Puppet manifest conform to the
style guide) this one must installed using gems package manager: gem
install puppet-lint

That's exactly what I was looking for =)

Check all .pp files in a directory
find -name '*.pp' | xargs -n 1 -t puppet parser validate
find -name '*.pp' | xargs -n 1 -t puppet-lint

Didn't knew about the "-n 1" trick instead of making a loop =)

Hugs,
Sandra


 

Sandra Schlichting

unread,
Aug 24, 2012, 8:26:49 AM8/24/12
to puppet...@googlegroups.com
I first use vim-puppet (syntax highlighting for puppet manifests in
vim while creating my manifest) To create my manifests

Btw. How do you install that?

I have tried

mkdir .vim
cd .vim
cd
echo "set runtimepath+=$HOME/.vim/vim-puppet" > .vimrc


 

Dan White

unread,
Aug 24, 2012, 9:01:05 AM8/24/12
to puppet...@googlegroups.com
The author of vim-puppet says in the README that they use something called "pathogen" to manage their vim modules.

I found this: https://github.com/tpope/vim-pathogen

Otherwise, it looks like one would have to pick apart the innards on vim-puppet to understand it enough to install it by other means.

Good like. I hope this helps.

“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)

----- Original Message -----
From: "Sandra Schlichting" <littles...@gmail.com>
To: puppet...@googlegroups.com
Sent: Friday, August 24, 2012 8:26:49 AM
Subject: Re: [Puppet Users] How to syntax debug in puppet 3?



--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/kajkXlfJkrMJ .

Henrik Lindberg

unread,
Aug 24, 2012, 9:02:25 AM8/24/12
to puppet...@googlegroups.com
On 2012-24-08 13:58, Sandra Schlichting wrote:
> Yes, you may either use it as an Eclipse plugin or as a standalone
> program..
>
> [snip]
>
> That sounds interesting.
>
> How do I do that? =)
>
The standalone Geppetto is downloadable from
https://github.com/cloudsmith/geppetto/downloads (linux, windows, osx).

To install it into an Eclipse as a plugin, see instructions in the FAQ -
http://cloudsmith.github.com/geppetto/faq.html#2011/06/02/can-i-use-geppetto-in-eclipse

The current release of Geppetto 2.2.1 supports Puppet 3.0.

- henrik


Juan Sierra Pons

unread,
Aug 24, 2012, 12:36:41 PM8/24/12
to puppet...@googlegroups.com
Hi

I installed it from puppetlabs repositories (in debian):

Package: vim-puppet
Source: puppet
Version: 2.7.19-1puppetlabs1
Architecture: all
Maintainer: Puppet Labs <in...@puppetlabs.com>
Installed-Size: 332
Recommends: vim-addon-manager
Conflicts: puppet (<< 2.7.19-1puppetlabs1)
Section: admin
Priority: optional
Homepage: http://projects.puppetlabs.com/projects/puppet
Description: syntax highlighting for puppet manifests in vim
The vim-puppet package provides filetype detection and syntax highlighting for
puppet manifests (files ending with ".pp").
Filename: pool/squeeze/main/p/puppet/vim-puppet_2.7.19-1puppetlabs1_all.deb
MD5sum: 9a02b144f442b7980e419d26baac09b7
SHA1: 1ff9022b0f416a8cb38bbca3ad0eddbceadd6074
SHA256: bf64cfb4cf9c2711659db7d97c63b380290076c1008eb962c92b2b9b377de658
Size: 260222

So I suppose it must be packaged for other dists: CentOS, RedHat, etc

Ramin K

unread,
Aug 24, 2012, 12:55:17 PM8/24/12
to puppet...@googlegroups.com
On 8/24/2012 6:01 AM, Dan White wrote:
> The author of vim-puppet says in the README that they use something called "pathogen" to manage their vim modules.
>
> I found this: https://github.com/tpope/vim-pathogen

If vim is your primary editing environment install vim-pathogen, takes
two minutes, and be done. Allows vim to load dirs out of ~/.vim/bundle/
and I usually git clone new vim plugins directly into it. Well worth the
time to not dig through .vim/syntax|ftplugin|etc|etc directories.

Ramin

Dan White

unread,
Aug 24, 2012, 1:38:42 PM8/24/12
to puppet...@googlegroups.com
I plan to try it out. It looks like a good utility.

Jakov Sosic

unread,
Aug 25, 2012, 1:12:56 PM8/25/12
to puppet...@googlegroups.com
Yeah.

I use pathogen + syntastic.



--
Jakov Sosic
www.srce.unizg.hr
Reply all
Reply to author
Forward
0 new messages