已安装puppetlabs-registry仍提示'registry_value'未知资源类型求助
Puppet Chocolatey模块报错:未知'registry_value'资源类型
我是Puppet新手,正尝试为Windows客户端使用chocolatey模块,已安装全部依赖模块,模块列表如下:
root@puppet:/etc/puppetlabs/code/environments/production/modules/chocolatey/manifests# puppet module list --environment production /etc/puppetlabs/code/environments/production/site-modules ├── adhoc (???) ├── profile (???) └── role (???) /etc/puppetlabs/code/environments/production/modules ├── puppetlabs-acl (v5.0.0) ├── puppetlabs-apt (v9.4.0) ├── puppetlabs-chocolatey (v8.0.0) ├── puppetlabs-concat (v9.0.2) ├── puppetlabs-facts (v1.4.0) ├── puppetlabs-inifile (v6.1.1) ├── puppetlabs-powershell (v6.0.0) ├── puppetlabs-puppet_agent (v4.19.0) ├── puppetlabs-pwshlib (v1.1.1) ├── puppetlabs-reboot (v5.0.0) ├── puppetlabs-registry (v5.0.1) ├── puppetlabs-ruby_task_helper (v0.6.1) └── puppetlabs-stdlib (v9.6.0) /etc/puppetlabs/code/modules (no modules installed) /opt/puppetlabs/puppet/modules (no modules installed)
但执行puppet agent --test --trace --debug --verbose命令时,出现如下错误:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Unknown resource type: 'registry_value' (file: /etc/puppetlabs/code/environments/production/modules/chocolatey/manifests/install.pp, line: 38, column: 3) on node desktop-pmmjds3.wftigers.org C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/rest.rb:48:in `rescue in find' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/rest.rb:9:in `find' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:230:in `find' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:731:in `block in retrieve_new_catalog' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/util.rb:518:in `block in thinmark' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/3.2.0/benchmark.rb:311:in `realtime' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/util.rb:517:in `thinmark' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:730:in `retrieve_new_catalog' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:84:in `retrieve_catalog' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:269:in `prepare_and_retrieve_catalog' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:430:in `run_internal' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:341:in `run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:85:in `block (6 levels) in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/context.rb:64:in `override' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet.rb:288:in `override' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:84:in `block (5 levels) in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/3.2.0/timeout.rb:189:in `block in timeout' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/3.2.0/timeout.rb:196:in `timeout' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:83:in `block (4 levels) in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent/locker.rb:23:in `lock' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:73:in `block (3 levels) in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:164:in `with_client' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:69:in `block (2 levels) in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:129:in `run_in_fork' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:68:in `block in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application.rb:174:in `controlled_run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:49:in `run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:437:in `onetime' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:394:in `block in run_command' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/context.rb:64:in `override' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet.rb:288:in `override' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:391:in `run_command' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application.rb:423:in `block in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/util.rb:706:in `exit_on_fail' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/application.rb:423:in `run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:145:in `run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:79:in `execute' C:/Program Files/Puppet Labs/Puppet/puppet/bin/puppet:5:in `<main>' Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run
已安装registry模块,为何仍会提示未知'registry_value'资源类型?
解决办法
1. 显式引入registry模块
Puppet不会自动加载所有安装的模块,需要在你的manifest中显式引入registry模块,或者在使用Chocolatey的类中声明依赖:
# 在site.pp或对应profile类中添加 include registry include chocolatey # 或者在类中声明依赖 class profile::windows::chocolatey { require registry include chocolatey }
2. 重新安装Chocolatey模块确保依赖完整
可能安装Chocolatey模块时依赖未正确拉取,重新安装:
puppet module install puppetlabs-chocolatey --force --environment production
3. 验证模块路径与加载状态
在Puppet Server上执行以下命令,确认registry模块被当前环境识别:
puppet module list --environment production | grep puppetlabs-registry
如果无输出,说明模块路径错误,需确保模块在/etc/puppetlabs/code/environments/production/modules目录下。
4. 清除Puppet Server缓存并重启服务
Puppet Server可能缓存了旧的模块信息,重启服务刷新:
systemctl restart puppetserver
5. 检查版本兼容性
Chocolatey v8.0.0与Registry v5.0.1可能存在兼容性问题,尝试调整版本:
# 降级registry模块到指定版本 puppet module install puppetlabs-registry --version 4.2.0 --force --environment production
内容的提问来源于stack exchange,提问作者Cory Robbins
相关产品推荐
相关产品推荐

