'require':无法加载此类文件 - winrm(LoadError)

时间:2013-12-03 17:08:03

标签: ruby chef

我有以下脚本:

require_relative 'embedded\lib\ruby\gems\1.9.1\gems\winrm-1.1.3\winrm.rb'

IP=ARGV[0]
USER=ARGV[1]
endpoint = "http://#{IP}:5985/wsman"
winrm = WinRM::WinRMWebService.new endpoint, :plaintext, user: USER, pass: 'supersecret', basic_auth_only: true
winrm.set_timeout 1800

installer_file = "c:\\Users\\#{USER}\\Downloads\\chef_client.msi"
installer_cmd = "msiexec /qn /i #{installer_file} ADDLOCAL=\"ChefServiceFeature,ChefClientFeature\""

puts 'Installating Chef'
install_output = winrm.cmd installer_cmd

sleep 300
puts 'Configuring Chef'
winrm.cmd %Q(mv c:\\Users\\#{USER}\\Downloads\\client.rb c:\\chef\\client.rb)
winrm.cmd %Q(mv c:\\Users\\#{USER}\\Downloads\\chef-validator.pem c:\\chef\\validation.pem)
winrm.cmd 'net start chef-client || net start chef-client'

每当我尝试运行它时,我会得到:'require': cannot load such file -- winrm (LoadError)

我正在使用Ruby193和Chef的设置,所以也许它与193和我的盒子里的Chef附带的东西有什么关系? - 我不能为我的生活让这个工作。我能够安装winrm gem(我想?)但我无法弄清楚如何从我的脚本中访问它。

0 个答案:

没有答案