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。
临时修复方案
- 回退版本:暂时切回Chef 18.6.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
相关产品推荐
相关产品推荐

