Chef Elementory OS(在资源'package [apache2]'上执行操作`install`时出错)

问题描述 投票:0回答:2
 * package[tree] action install[2020-02-18T15:27:02+05:30] INFO: Processing package[tree] action install (starter::default line 8)


    ================================================================================
    Error executing action `install` on resource 'package[tree]'
    ================================================================================

    Chef::Exceptions::ProviderNotFound
    ----------------------------------
    Cannot find a provider for package[tree] on elementary version 5.1.2

    Resource Declaration:
    ---------------------
    # In /home/mrunknown/Downloads/chef-repo/.chef/local-mode-cache/cache/cookbooks/starter/recipes/default.rb

      8: package "tree"
      9: 

    Compiled Resource:
    ------------------
    # Declared in /home/mrunknown/Downloads/chef-repo/.chef/local-mode-cache/cache/cookbooks/starter/recipes/default.rb:8:in `from_file'

代码:

package("tree") do
  package_name "tree"
  action [:install]
  default_guard_interpreter :default
  declared_type :package
  cookbook_name "starter"
  recipe_name "default"
end

系统信息:

chef_version=15.7.32
platform=elementary
platform_version=5.1.2
ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
program_name=/usr/bin/chef-client
executable=/opt/chef-workstation/bin/chef-client
chef devops
2个回答
0
投票

终于我得到了这个问题的解决方案,请参考此链接https://docs.chef.io/resource_gem_package.html

它使用gem_package


0
投票

快速搜索显示Elementary OS使用apt,因此您绝对需要使用apt_package

apt_package 'tree' do
  action :install
end

但是您说这对您不起作用。我猜您遇到了一些apt错误,该错误表明找不到软件包tree的候选对象。那是因为您需要在安装软件包之前运行apt update。您可以通过在包资源之前添加apt_update资源来实现此目的。

apt_update 'update' do
  action :update
end

apt_package 'tree' do
  action :install
end
© www.soinside.com 2019 - 2024. All rights reserved.