Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/adblockplus/lib/puppet/parser/functions/manifest_exists.rb

Issue 29338046: Issue 3638 - Introduce type adblockplus::host (Closed)
Patch Set: Created March 9, 2016, 11:57 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | modules/adblockplus/manifests/host.pp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 module Puppet::Parser::Functions
2
3 newfunction(:manifest_exists, :type => :rvalue, :doc => <<-'begin') do |args|
4 Determine if a Puppet manifest (*.pp file) exists for the given type name,
5 within the Puppet hierarchy of the (adblockplus) module's parent directory
6 begin
7
8 if args.size != 1
9 message = "Usage: manifest_exists('some::definition::name')"
10 raise Puppet::ParseError, message
11 end
12
13 # 'foo::bar::baz' => 'foo', ['bar', 'baz']
14 module_name, *remainder = args[0].to_s.split('::')
15
16 base_directory = File.expand_path(File.join(
17 File.dirname(__FILE__),
18 '..', # parser
19 '..', # puppet
20 '..', # lib
21 '..', # $module
22 '..' # modules
23 ))
24
25 manifest_path = File.join(
26 base_directory,
27 module_name,
28 'manifests',
29 File.join(*remainder) << '.pp'
30 )
31
32 return File.exists? manifest_path
33
34 end
35 end
OLDNEW
« no previous file with comments | « no previous file | modules/adblockplus/manifests/host.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld