Last change
on this file since 30903 was 30903, checked in by davidb, 8 years ago |
Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details
|
File size:
592 bytes
|
Line | |
---|
1 | #
|
---|
2 | # shell_split.rb
|
---|
3 | #
|
---|
4 |
|
---|
5 | require 'shellwords'
|
---|
6 |
|
---|
7 | module Puppet::Parser::Functions
|
---|
8 | newfunction(:shell_split, :type => :rvalue, :doc => <<-EOS
|
---|
9 | Splits a string into an array of tokens in the same way the Bourne shell does.
|
---|
10 |
|
---|
11 | This function behaves the same as ruby's Shellwords.shellsplit() function
|
---|
12 | EOS
|
---|
13 | ) do |arguments|
|
---|
14 |
|
---|
15 | raise(Puppet::ParseError, "shell_split(): Wrong number of arguments " +
|
---|
16 | "given (#{arguments.size} for 1)") if arguments.size != 1
|
---|
17 |
|
---|
18 | string = arguments[0].to_s
|
---|
19 |
|
---|
20 | result = Shellwords.shellsplit(string)
|
---|
21 |
|
---|
22 | return result
|
---|
23 | end
|
---|
24 | end
|
---|
25 |
|
---|
26 | # vim: set ts=2 sw=2 et :
|
---|
Note:
See
TracBrowser
for help on using the repository browser.