Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add stdin parsing to puppet parser validate

  • Loading branch information...
commit 77bf5f21054bcd66700282a13204d2aa1d544e2c 1 parent 9b7c73a
@zsprackett zsprackett authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 lib/puppet/face/parser.rb
View
13 lib/puppet/face/parser.rb
@@ -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

@wfarr
Collaborator

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.
Something went wrong with that request. Please try again.