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 29341151: Issue 4019 - Added "Edge" to platform choices in Issues tracker at issues1. (Closed)
Patch Set: Created May 10, 2016, 3:35 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 | « modules/adblockplus/files/sudoers/puppet ('k') | 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 | « modules/adblockplus/files/sudoers/puppet ('k') | modules/adblockplus/manifests/host.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld