我正在尝试运行Chef食谱来安装特定版本的软件包,但出现奇怪的错误:
================================================================================
Error executing action `install` on resource 'yum_package[update_ghostscript]'
================================================================================
Chef::Exceptions::Package
-------------------------
No version specified, and no candidate version available for ghostscript
当配方名称为包装名称时,此方法正常工作,但我想更改格式。
这是食谱:
package 'update_ghostscript' do
action :install
package_name 'ghostscript'
version 'ghostscript-9.07-31.el7_6.6.x86_64'
allow_downgrade false
only_if { node['packages'].keys.include? 'ghostscript' }
ignore_failure true
notifies :run, 'ruby_block[updated_version_ghostscript]', :immediate
end
这是编译的版本:
yum_package("update_ghostscript") do
package_name "ghostscript"
action [:install]
default_guard_interpreter :default
declared_type :package
cookbook_name "redacted"
recipe_name "redacted"
version "ghostscript-9.07-31.el7_6.6.x86_64"
ignore_failure true
only_if { #code block }
end
如果有帮助,这是系统信息:
System Info:
------------
chef_version=15.1.36
platform=centos
platform_version=7.5.1804
ruby=ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
program_name=/opt/chef/bin/chef-client
executable=/opt/chef/bin/chef-client
这里有什么我想念的吗?
答案 0 :(得分:0)
尝试将version
而不是9.07-31.el7_6.6
指定为ghostscript-9.07-31.el7_6.6.x86_64
。也许您也可以指定x86_64
的版本,或使用单独的arch
属性