Permalink
Browse files

Add stdin parsing to puppet parser validate

  • Loading branch information...
1 parent 9b7c73a commit 77bf5f21054bcd66700282a13204d2aa1d544e2c @zsprackett zsprackett committed Dec 15, 2011
Showing with 11 additions and 2 deletions.
  1. +11 −2 lib/puppet/face/parser.rb
View
@@ -24,13 +24,22 @@
Validate two arbitrary manifest files:
$ puppet parser validate init.pp vhost.pp
+
+ Validate from STDIN:
+
+ $ cat init.pp | puppet parser validate
EOT
when_invoked do |*args|
args.pop
files = args
if files.empty?
- files << Puppet[:manifest]
- Puppet.notice "No manifest specified. Validating the default manifest #{Puppet[:manifest]}"
+ if not STDIN.tty?
+ Puppet[:code] = STDIN.read
+ Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types.clear
+ else
+ files << Puppet[:manifest]
+ Puppet.notice "No manifest specified. Validating the default manifest #{Puppet[:manifest]}"
+ end
end
files.each do |file|
Puppet[:manifest] = file

1 comment on commit 77bf5f2

Contributor

wfarr commented on 77bf5f2 Jun 17, 2012

So this change looks to have never been merged to 2.7.x release branch so even though this was supposed to be in 2.7.10 some months ago, it's still not in even 2.7.14.

Definitely need this STDIN support — could we get this rolled into a 2.7.15 release and pushed out relatively soon?

Please sign in to comment.