gem_package因测试厨房中的错误要求[""]而失败

时间:2017-03-27 08:51:19

标签: chef test-kitchen

获取错误'格式错误的要求[""]'在Windows平台上的测试厨房中安装宝石时:

I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows: ---- Begin output of C:\opscode\chef\embedded\bin\gem install C:\Users\ADMINI~1\AppData\Local\Temp\kitchen\cache/rubyzip-1.2.0.gem -q --no-rdoc --no-ri -v "" ----
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows: STDOUT: 
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows: STDERR: ERROR:  While executing gem ... (ArgumentError)
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows:     Illformed requirement [""]
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows: ---- End output of C:\opscode\chef\embedded\bin\gem install C:\Users\ADMINI~1\AppData\Local\Temp\kitchen\cache/rubyzip-1.2.0.gem -q --no-rdoc --no-ri -v "" ----
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows: Ran C:\opscode\chef\embedded\bin\gem install C:\Users\ADMINI~1\AppData\Local\Temp\kitchen\cache/rubyzip-1.2.0.gem -q --no-rdoc --no-ri -v "" returned 1
E, [2017-03-24T15:17:56.454839 #2848] ERROR -- enable-windows: Converge failed on instance .
E, [2017-03-24T15:17:56.454839 #2848] ERROR -- enable-windows: ------Exception-------
E, [2017-03-24T15:17:56.454839 #2848] ERROR -- enable-windows: Class: Kitchen::ActionFailed
E, [2017-03-24T15:17:56.454839 #2848] ERROR -- enable-windows: Message: WinRM exited (1) for command: [
$env:PATH = [System.Environment]::GetEnvironmentVariable("PATH","Machine")
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows: Compiled Resource:
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows: ------------------
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows: # Declared in C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/cookbooks/common_libs/libraries/unzip.rb:15:in `block in install_zip_gems'
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows: 
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows: gem_package("rubyzip-1.2.0.gem") do
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows:   provider Chef::Provider::Package::Rubygems
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows:   action [:install]
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows:   retries 0
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows:   retry_delay 2
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows:   guard_interpreter :default
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows:   package_name "rubyzip-1.2.0.gem"
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows:   source "C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\kitchen\\cache/rubyzip-1.2.0.gem"
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows:   cookbook_name "backup"
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows:   recipe_name "_install_windows"
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows:   gem_binary "C:\\opscode\\chef\\embedded\\bin\\gem"
I, [2017-03-24T15:17:54.108999 #2848]  INFO -- enable-windows: end

此错误仅在测试厨房中出现,当我直接在VM上运行chef-client时,我不会收到此错误。

在common_libs / libraries / unzip.rb中,

node['common_libs']['ruby_gem']['installers'].each do |gem_file|
Chef::Log.info("Missing gem '#{gem_file}'...installing now.")

remote_file "#{Chef::Config[:file_cache_path]}/#{gem_file}" do
  source "#{node['common_libs']['ruby_gem']['url']}/#{gem_file}"
  action :create
end

gem_package gem_file do
  source "#{Chef::Config[:file_cache_path]}/#{gem_file}"
  action :install
end
end

在属性文件中,

default['common_libs']['ruby_gem']['installers'] = %w(rubyzip-1.2.0.gem zip-zip-0.3.gem)

0 个答案:

没有答案