Re: [Puppet-dev] Re: [Puppet Users] Puppet Parse Trees (for a lint checker)
Markus Roberts: > As a hack, I've occasionally done something like: > > diff --git a/lib/puppet/application/apply.rb [...] > - > Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types > + print > ZAML.dump(Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types) [snip] > which changes --parseonly to dump the AST forest to stdout instead of > just constructing it and throwing it out. I also typically filter the > output with "grep -v" or some such to skip the stuff I don't care > about. Ah, yes! This is very much what I was hoping for! Many thanks! -- "Here is the memo if you didn't receive it: GNOME and Free Software is all about *SAVING THE WORLD* not drawing pissy little buttons on the screen." -- Jeff Waugh -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Puppet Parse Trees (for a lint checker)
An alternative is to use the Geppetto tool which parses puppet manifests into a model. There is a Java API for this model. It can also be serialized in other formats that allow processing in other languages. I am interested in what "lint rules" you had in mind, maybe we could collaborate to get them into geppetto? More info here: https://github.com/cloudsmith/geppetto Regards - henrik On Mar 1, 2011, at 12:14 PM, Nick Moffitt wrote: I mean to write a lint checker for my manifests, but I am not a ruby developer to any degree of proficiency. What I think I would like is some kind of serialization of the AST for a given .pp file, which I can then import into my own Python code and analyze for undesirable patterns. Is there any way to get a dump or serialization or marshalling of the parse tree for a given .pp file? Or is there already some easily-modifiable lint checker elsewhere? -- A: No. Q: Should I put my reply above quoted text? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Puppet Parse Trees (for a lint checker)
Dan Bode: > Hi Nick (long time :) ) Hi! Nearly a year, by now! > It is possible to parse a given file and get an ASTArray back, is that > sufficient? I am pretty sure you are going to have to get your hands > into the Ruby code to really figure this out. I suppose so, although I hope that's something that could be serialized trivially without leaving me holding a bunch of opaque object references. > These kinds of questions make more sense to be posted to puppet-dev Hurg. I was hoping something already existed. Okay, I'll try to remember how to subscribe to that without accepting google cookies. -- "Here is the memo if you didn't receive it: GNOME and Free Software is all about *SAVING THE WORLD* not drawing pissy little buttons on the screen." -- Jeff Waugh -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Puppet Parse Trees (for a lint checker)
Hi Nick (long time :) ) On Tue, Mar 1, 2011 at 3:14 AM, Nick Moffitt wrote: > I mean to write a lint checker for my manifests, but I am not a ruby > developer to any degree of proficiency. What I think I would like is > some kind of serialization of the AST for a given .pp file, which I can > then import into my own Python code and analyze for undesirable > patterns. > It is possible to parse a given file and get an ASTArray back, is that sufficient? I am pretty sure you are going to have to get your hands into the Ruby code to really figure this out. There kinds of questions make more sense to be posted to puppet-dev > > Is there any way to get a dump or serialization or marshalling of the > parse tree for a given .pp file? Or is there already some > easily-modifiable lint checker elsewhere? > > -- > A: No. > Q: Should I put my reply above quoted text? > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Puppet Parse Trees (for a lint checker)
(sorry Sandor, I hit individual reply entirely by mistake earlier) Sandor Szuecs: > On Mar 1, 2011, at 12:14 PM, Nick Moffitt wrote: > > Or is there already some easily-modifiable lint checker elsewhere? > > You probably want: > puppet --parseonly As of puppet 2.6.4 this does not print any parse trees that I can see. Is there some extra-verbosity mode I can enable that will spit out the AST in yaml or pson or something? Your quotation of my request for a pre-existing easily-modifiable lint checker suggests that you mean that the --parseonly mode has some mechanism for specifying linter rules. Is there some way I can warn against particular syntactically-valid yet undesirable patterns of use via --parseonly? I would need to be able to specify these patterns myself. -- Schrödinger's cat was an observer. WAKE UP, SHEEPLE! Stop the silence! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Puppet Parse Trees (for a lint checker)
On Mar 1, 2011, at 12:14 PM, Nick Moffitt wrote: > Or is there already some > easily-modifiable lint checker elsewhere? You probably want: puppet --parseonly All the best, Sandor Szücs -- -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
[Puppet Users] Puppet Parse Trees (for a lint checker)
I mean to write a lint checker for my manifests, but I am not a ruby developer to any degree of proficiency. What I think I would like is some kind of serialization of the AST for a given .pp file, which I can then import into my own Python code and analyze for undesirable patterns. Is there any way to get a dump or serialization or marshalling of the parse tree for a given .pp file? Or is there already some easily-modifiable lint checker elsewhere? -- A: No. Q: Should I put my reply above quoted text? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.