source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/lib/puppet/parser/functions/assert_private.rb@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 7 years ago

Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details

File size: 877 bytes
Line 
1#
2# assert_private.rb
3#
4
5module Puppet::Parser::Functions
6 newfunction(:assert_private, :doc => <<-'EOS'
7 Sets the current class or definition as private.
8 Calling the class or definition from outside the current module will fail.
9 EOS
10 ) do |args|
11
12 raise(Puppet::ParseError, "assert_private(): Wrong number of arguments "+
13 "given (#{args.size}}) for 0 or 1)") if args.size > 1
14
15 scope = self
16 if scope.lookupvar('module_name') != scope.lookupvar('caller_module_name')
17 message = nil
18 if args[0] and args[0].is_a? String
19 message = args[0]
20 else
21 manifest_name = scope.source.name
22 manifest_type = scope.source.type
23 message = (manifest_type.to_s == 'hostclass') ? 'Class' : 'Definition'
24 message += " #{manifest_name} is private"
25 end
26 raise(Puppet::ParseError, message)
27 end
28 end
29end
Note: See TracBrowser for help on using the repository browser.