Chefspec失败了,“无法加载“ ffi-libarchive”。

发布于 2025-01-29 08:54:01 字数 1356 浏览 3 评论 0原文

我是厨师的新手。最近,我正在研究如何使用ChefSpec测试食谱。但是我总是因为“无法加载FFI-Libarchive”的错误失败。这是我的步骤。

  1. 我使用GEM安装ChefSpec- 宝石安装“ Chefspec” 它已成功安装。

  2. 然后我写了一本测试食谱 - 示例,带有配方default.rb-

    软件包'apache2' 服务“ apache2”做 动作[:启用,:开始] 结束

    文件'/srv/www/htdocs/index.html'do 内容 '

    欢迎!您已经成功配置了厨师节点。

    ' 结束

  3. 然后在c:\ work \ work \ chef-repo \ cookbooks \ sample \ spec中,我创建default_spec.rb -

    需要'Chefspec'

    描述'索引html'做 LET(:CHEF_RUN){CHEFSPEC :: SORORUNNER.NEW(平台:'suse',版本:'12 .4')。commenge(Diccition_recipe)}

     它'删除具有显式操作的文件'
      期待(chef_run).to create_file_with_content('/www/srv/index.html','欢迎!您已经成功配置了厨师节点。')
      期待(chef_run).to_not delete_file('/tmp/e.log')
    结尾
     

    结束

  4. 然后我尝试了RSPEC,但它失败了 -

    c:\ work \ chef-repo> rspec cookbooks \ sample \ spec \ default_spec.rb 无法加载ffi-libarchive,libarchive可能未安装在系统上,aCRIVE_FILE将不可用 f

    失败:

    1. 索引html删除具有明确操作的文件......
  5. ,我再次安装了ffi-libarchive,但是RSPEC仍然失败 -

    c:\ work \ chef-repo> gem安装'ffi-libarchive' 成功安装了FFI-Libarchive-1.1.3 FFI-Libarchive-1.1.3的解析文档 完成3秒后安装FFI-Libarchive的文档 安装了1个宝石

    c:\ work \ chef-repo> rspec cookbooks \ sample \ spec \ default_spec.rb 无法加载ffi-libarchive,libarchive可能未安装在系统上,aCRIVE_FILE将无法使用

    请帮助。预先感谢您的任何想法。

I'm new to chef. Recently, I'm studying how to use chefspec to test recipe. But I always failed with "ffi-libarchive could not be loaded" error. Here's my steps.

  1. I use gem to install chefspec --
    gem install 'chefspec'
    It's successfully installed.

  2. Then I write a test cookbook -- sample, with a recipe default.rb --

    package 'apache2'
    service 'apache2' do
    action [:enable, :start]
    end

    file '/srv/www/htdocs/index.html' do
    content '

    Welcome! You have successfully configured your chef node.

    '
    end

  3. Then in c:\work\chef-repo\cookbooks\sample\spec, I create default_spec.rb --

    require 'chefspec'

    describe 'index html' do
    let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'suse', version: '12.4').converge(described_recipe) }

    it 'deletes a file with an explicit action' do
      expect(chef_run).to create_file_with_content('/www/srv/index.html','Welcome! You have successfully configured your chef node.')
      expect(chef_run).to_not delete_file('/tmp/e.log')
    end
    

    end

  4. Then I tried rspec , but it failed --

    C:\Work\chef-repo>rspec cookbooks\sample\spec\default_spec.rb
    ffi-libarchive could not be loaded, libarchive is probably not installed on system, archive_file will not be available
    F

    Failures:

    1. index html deletes a file with an explicit action......
  5. So I installed ffi-libarchive again, but the rspec still failed --

    C:\Work\chef-repo>gem install 'ffi-libarchive'
    Successfully installed ffi-libarchive-1.1.3
    Parsing documentation for ffi-libarchive-1.1.3
    Done installing documentation for ffi-libarchive after 3 seconds
    1 gem installed

    C:\Work\chef-repo>rspec cookbooks\sample\spec\default_spec.rb
    ffi-libarchive could not be loaded, libarchive is probably not installed on system, archive_file will not be available

    Please kind help. Thanks in advance for any idea.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文