1

我是 Chef 和 Ruby 的新手,我想要的只是使用 chef-solo 将一个简单的文本文件从机器 A 复制到机器 B。

我的 default.rb 文件是:

require 'rubygems'
require 'net/scp'

hostname = '142.138.0.147'
username = 'someone'
password = 'someone123'

Net::SCP.start( hostname, username, :password => password ) do|scp|
  puts 'SCP Started!'
  scp.download('/home/someone/file.txt', '.')
end

但是在运行时出现此错误:

FATAL: LoadError: no such file to load -- net/scp

这是因为 Chef 使用的是它的嵌入式 Ruby 版本,而不是我安装的那个。我如何告诉 Chef 使用哪个 Ruby 版本?

4

1 回答 1

0

i don't know what you mean by "embedded", but you need to have the right ruby version installed on the system you are executing the chef recipe.

if you want to get a tiny overview of how to handle chef, you could have a look at the railscast episode about chef-solo: http://railscasts.com/episodes/339-chef-solo-basics

于 2012-08-06T11:19:37.190 回答