You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Chef Infra 18.7.3中apt_repository报错TargetIO未初始化,求排查

Chef 18.7.3中apt_repository报错的原因与解决办法

这是Chef Infra Client 18.7.3版本的已知bug,和你的代码无关。

问题根源

18.7.3版本对apt_repository资源做了更新,但更新中错误引用了未定义的TargetIO常量,导致执行时触发NameError。

临时修复方案

  1. 回退版本:暂时切回Chef 18.6.2,等官方发布修复补丁后再升级。
  2. 手动替代资源:如果不能回退,用手动创建源文件的方式替代apt_repository资源,代码示例:
    # 创建Cassandra源文件
    file '/etc/apt/sources.list.d/cassandra.list' do
      content "deb https://debian.cassandra.apache.org 50x main"
      mode '0644'
    end
    
    # 添加GPG密钥
    execute 'import cassandra gpg key' do
      command 'curl -fsSL https://downloads.apache.org/cassandra/KEYS | apt-key add -'
      not_if 'apt-key list | grep -q Cassandra'
    end
    
    # 更新apt缓存
    execute 'apt update' do
      action :run
    end
    

后续建议

留意Chef官方的版本更新,这类引入的bug通常会在后续小版本中快速修复。

内容的提问来源于stack exchange,提问作者Roman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 12:54:56