diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-08-13 20:12:07 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-08-13 20:12:07 +0000 |
commit | 40491ebe7ca9692b57fb533412ece8fb694b7d4c (patch) | |
tree | ab7f4320da1b9c4c7510fd576b1b84b24d2f3139 | |
parent | b59d396b504f40a471459c527b16a1962e32a878 (diff) | |
download | puppet-40491ebe7ca9692b57fb533412ece8fb694b7d4c.tar.gz puppet-40491ebe7ca9692b57fb533412ece8fb694b7d4c.tar.xz puppet-40491ebe7ca9692b57fb533412ece8fb694b7d4c.zip |
Merge /opt/rl/git/puppet
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2773 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/parser/interpreter.rb | 9 | ||||
-rwxr-xr-x | test/language/interpreter.rb | 18 |
2 files changed, 22 insertions, 5 deletions
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 9da1928b3..3ba9c0c7a 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -480,9 +480,14 @@ class Puppet::Parser::Interpreter # Look for external node definitions. def nodesearch_external(name) return nil unless Puppet[:external_nodes] != "none" - + + # This is a very cheap way to do this, since it will break on + # commands that have spaces in the arguments. But it's good + # enough for most cases. + external_node_command = Puppet[:external_nodes].split + external_node_command << name begin - output = Puppet::Util.execute([Puppet[:external_nodes], name]) + output = Puppet::Util.execute(external_node_command) rescue Puppet::ExecutionFailure => detail if $?.exitstatus == 1 return nil diff --git a/test/language/interpreter.rb b/test/language/interpreter.rb index 6352a147e..75800cc41 100755 --- a/test/language/interpreter.rb +++ b/test/language/interpreter.rb @@ -440,15 +440,15 @@ class TestInterpreter < PuppetTest::TestCase File.open(mapper, "w") { |f| f.puts "#!#{ruby} require 'yaml' - name = ARGV[0].chomp + name = ARGV.last.chomp result = {} if name =~ /a/ - result[:parameters] = {'one' => ARGV[0] + '1', 'two' => ARGV[0] + '2'} + result[:parameters] = {'one' => ARGV.last + '1', 'two' => ARGV.last + '2'} end if name =~ /p/ - result['classes'] = [1,2,3].collect { |n| ARGV[0] + n.to_s } + result['classes'] = [1,2,3].collect { |n| ARGV.last + n.to_s } end puts YAML.dump(result) @@ -496,6 +496,18 @@ class TestInterpreter < PuppetTest::TestCase assert_nil(node) end + # Make sure a nodesearch with arguments works + def test_nodesearch_external_arguments + mapper = mk_node_mapper + Puppet[:external_nodes] = "#{mapper} -s something -p somethingelse" + interp = mkinterp + node = nil + assert_nothing_raised do + node = interp.nodesearch("apple") + end + assert_instance_of(NodeDef, node, "did not create node") + end + # A wrapper test, to make sure we're correctly calling the external search method. def test_nodesearch_external_functional mapper = mk_node_mapper |