使用“命令”ruby木偶function以外的木偶提供商
为了让我更容易地debugging我的提供者,我有时想在自己的ruby代码中使用'command'。 试图弄清楚如何是问题。 这就是我在提供者中使用它的方式: commands :wget => '/usr/bin/wget', :cp => '/bin/cp' 后来,我可以用简单的命令来运行命令: wget('http://example.com') 现在,我试着这样做: something = Puppet::Provider.commands({:wget => '/usr/bin/wget'}) something.wget('http://example.com') 但是,我得到这个: test.rb:15: undefined method `wget' for {:wget=>"/usr/bin/wget"}:Hash (NoMethodError) 我也试过运行: wget = Puppet::Provider::Command.new('wget', '/usr/bin/wget', Puppet::Util, Puppet::Util::Execution) puts Puppet::Util::Execution.execute(['wget','http://example.com'],{}) 但输出是空白的… 有任何想法吗?