diff options
author | Nick Lewis <nick@puppetlabs.com> | 2011-04-13 15:35:47 -0700 |
---|---|---|
committer | Nick Lewis <nick@puppetlabs.com> | 2011-04-13 15:40:18 -0700 |
commit | a688461100150d3f4e102e669ece839f8571e14c (patch) | |
tree | 5401af36d7e6b0c64e1b057528a0e650bf40da5b /lib/puppet | |
parent | aa41b27b8687d15c468a343a6e513de8c524139a (diff) | |
download | puppet-a688461100150d3f4e102e669ece839f8571e14c.tar.gz puppet-a688461100150d3f4e102e669ece839f8571e14c.tar.xz puppet-a688461100150d3f4e102e669ece839f8571e14c.zip |
(#6928) Add a Parser face with Validate action
This will accept a number of manifests as arguments and check their syntax. If
no filenames are specified, it will check the default 'manifest' setting.
Paired-With: Jesse Wolfe
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/application/parser.rb | 5 | ||||
-rw-r--r-- | lib/puppet/face/parser.rb | 17 | ||||
-rw-r--r-- | lib/puppet/resource/type_collection.rb | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/lib/puppet/application/parser.rb b/lib/puppet/application/parser.rb new file mode 100644 index 000000000..b6ec3c185 --- /dev/null +++ b/lib/puppet/application/parser.rb @@ -0,0 +1,5 @@ +require 'puppet/application/face_base' +require 'puppet/face' + +class Puppet::Application::Parser < Puppet::Application::FaceBase +end diff --git a/lib/puppet/face/parser.rb b/lib/puppet/face/parser.rb new file mode 100644 index 000000000..c44810b99 --- /dev/null +++ b/lib/puppet/face/parser.rb @@ -0,0 +1,17 @@ +require 'puppet/face' +require 'puppet/parser' + +Puppet::Face.define(:parser, '0.0.1') do + action :validate do + when_invoked do |*args| + args.pop + files = args + files << Puppet[:manifest] if files.empty? + files.each do |file| + Puppet[:manifest] = file + Puppet::Node::Environment.new(Puppet[:environment]).known_resource_types.clear + end + nil + end + end +end diff --git a/lib/puppet/resource/type_collection.rb b/lib/puppet/resource/type_collection.rb index 9fe7cdd06..89b0a16ed 100644 --- a/lib/puppet/resource/type_collection.rb +++ b/lib/puppet/resource/type_collection.rb @@ -6,6 +6,7 @@ class Puppet::Resource::TypeCollection @hostclasses.clear @definitions.clear @nodes.clear + @watched_files.clear end def initialize(env) |