我正在开发一系列配方,以帮助在云中配置Windows服务器。
到目前为止,我已经能够使用Windows软件包取得了巨大成功。但是,当谈到SQL Express时,我在尝试接受许可条款时遇到了问题。
# prerequisite for Azure Storage Emulator
%w{ SqlLocalDB.msi }.each do |pkg|
windows_package "#{pkg}" do
source "https://s3-eu-west-1.amazonaws.com/qainstallerfiles/#{pkg}"
accept_license "true"
action :install
end
end
我收到以下错误,我理解这意味着Windows程序包没有accept_licence属性。
NoMethodError: undefined method `accept_license' for Chef::Resource::WindowsPackage
经过一番挖掘,我发现了ips_package,这似乎正是我所需要的。所以我尝试了以下内容:
ips_package "SqlLocalDB.msi" do
source "https://s3-eu-west-1.amazonaws.com/qainstallerfiles/SqlLocalDB.msi"
accept_license true
action :install
end
这次我收到以下错误:
STDERR: 'pkg' is not recognized as an internal or external command,
我看不到pkg的痕迹。我在其他陈述中使用它,但不是在这里。
任何人都可以帮助确定问题,更好的是,建议我如何通过让Chef接受许可条款来安装SqlLocalDB.msi(可能还有更多)?
修改
塞特。回答你的问题:Windows Server 2012 R2,Chef Solo chef-client-11.8.2-1.windows,这里是堆栈跟踪:
Generated at 2014-07-03 20:43:48 +0000
Mixlib::ShellOut::ShellCommandFailed: ips_package[SqlLocalDB.msi] (azure_sdk::default
line 2) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit
with [0], but received '1'
---- Begin output of pkg info -r SqlLocalDB.msi ----
STDOUT:
STDERR: 'pkg' is not recognized as an internal or external command,operable program or
batch file.
---- End output of pkg info -r SqlLocalDB.msi ----
Ran pkg info -r SqlLocalDB.msi returned 1
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.2.0-x86-
mingw32/lib/mixlib/shellout.rb:251:in `invalid!'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.2.0-x86-
mingw32/lib/mixlib/shellout.rb:237:in `error!'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/mixin/shell_out.rb:45:in `shell_out!'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/provider/package/ips.rb:56:in `check_package_state'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/provider/package/ips.rb:47:in `load_current_resource'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/provider.rb:97:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/resource.rb:625:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/runner.rb:49:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/runner.rb:81:in `block (2 levels) in converge'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/runner.rb:81:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/runner.rb:81:in `block in converge'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/resource_collection.rb:98:in `block in execute_each_resource'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/resource_collection.rb:96:in `execute_each_resource'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/runner.rb:80:in `converge'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/client.rb:433:in `converge'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/client.rb:500:in `do_run'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/client.rb:213:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/application.rb:208:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/application/solo.rb:221:in `block in run_application'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/application/solo.rb:213:in `loop'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/application/solo.rb:213:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-
mingw32/lib/chef/application.rb:66:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.8.2-x86-mingw32/bin/chef-
solo:25:in `<top (required)>'
C:/opscode/chef/bin/chef-solo:23:in `load'
C:/opscode/chef/bin/chef-solo:23:in `<main>'
非常感谢