无法列出 Puppet 环境:无法查询 Puppet 查找环境 API (400):环境必须是纯字母数字,而不是 'v2.0'

Failed to list puppet environments: Failed to query Puppet find environments API (400): The environment must be purely alphanumeric, not 'v2.0'

我收到以下错误:

错误 -- :无法列出人偶环境:无法查询 Puppet 查找环境 API (400):环境必须是纯字母数字,而不是 'v2.0'

错误原因描述如下: http://projects.theforeman.org/projects/foreman/wiki/ERF12-2749

建议的解决方案:确保在使用 Puppet 3.6+ 和目录环境("environmentpath" 设置)时拥有 foreman-proxy 1.5.2 或更高版本。

我的环境拓扑

--- IP1 上带工头的人偶大师

Puppet 3.7.5, foreman-1.8.2-1.el6.noarch, ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]

--- 在连接到 IP1 的 IP2 上带有 Foreman 代理的 Puppet Master

Puppet 3.7.5, foreman-proxy-1.7.5-1.el6.noarch and ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]

两个人偶大师都以相同的方式配置目录环境路径。我可以从工头所在的 IP1 导入 类。但不是来自只安装了 foreman-proxy 的 IP2。

我可以看到 IP2 注册到 IP1。

尝试从坐在 IP1 上的工头从 IP2 导入人偶 类 会引发上述错误。

命令从 IP1 尝试列出 IP2 的人偶环境:(这是为了复制我从 CLI 中得到的工头错误)

curl -vs \
  --key /var/lib/puppet/ssl/private_keys/ip2.dns.com.pem \
  --cacert /var/lib/puppet/ssl/certs/ca.pem \
  --cert /var/lib/puppet/ssl/certs/ip2-dns.com.pem  \
  https://ip2-dns.com:8443/puppet/environments

ip2 代理日志中报告的错误:

[root@ip2 httpd]# tail -f /var/log/foreman-proxy/proxy.log
E, [2015-09-10T14:52:10.201506 #24275] ERROR -- : Failed to list puppet environments: Failed to query Puppet find environments API (400): The environment must be purely alphanumeric, not 'v2.0'
ip1 - - [10/Sep/2015 14:52:10] "GET /environments HTTP/1.1" 406 143 1.8941
E, [2015-09-10T14:53:33.477247 #24275] ERROR -- : Failed to list puppet environments: Failed to query Puppet find environments API (400): The environment must be purely alphanumeric, not 'v2.0'
ip1 - - [10/Sep/2015 14:53:33] "GET /environments HTTP/1.1" 406 143 0.5582
E, [2015-09-10T14:56:59.390056 #24275] ERROR -- : Failed to list puppet environments: Failed to query Puppet find environments API (400): The environment must be purely alphanumeric, not 'v2.0'
ip1 - - [10/Sep/2015 14:56:59] "GET /environments HTTP/1.1" 406 143 0.5364
E, [2015-09-10T14:57:11.816250 #24275] ERROR -- : Failed to list puppet environments: Failed to query Puppet find environments API (400): The environment must be purely alphanumeric, not 'v2.0'
ip1 - - [10/Sep/2015 14:57:11] "GET /environments HTTP/1.1" 406 143 0.5434
E, [2015-09-11T09:18:12.636880 #24275] ERROR -- : Failed to list puppet environments: Failed to query Puppet find environments API (400): The environment must be purely alphanumeric, not 'v2.0'
ip1 - - [11/Sep/2015 09:18:12] "GET /environments HTTP/1.1" 406 143 0.5595

在工头中导入 类 时出错:

Warning!
ERF12-2749 [ProxyAPI::ProxyException]: Unable to get environments from Puppet ([RestClient::NotAcceptable]: 406 Not Acceptable) for proxy https://ip2:8443/puppet

如果您认为这是 Foreman 本身的错误,请打开一个关于 Foreman 工单系统的新问题,您可能需要附上完整的跟踪和相关日志条目。

ProxyAPI::ProxyException
ERF12-2749 [ProxyAPI::ProxyException]: Unable to get environments from Puppet ([RestClient::NotAcceptable]: 406 Not Acceptable) for proxy https://devci2-puppet.vzbi.com:8443/puppet
lib/proxy_api/puppet.rb:11:in `rescue in environments'
lib/proxy_api/puppet.rb:9:in `environments'
app/services/puppet_class_importer.rb:131:in `actual_environments'
app/services/puppet_class_importer.rb:23:in `changes'
app/controllers/concerns/foreman/controller/environments.rb:11:in `import_environments'
app/controllers/concerns/application_shared.rb:13:in `set_timezone'
app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call' 

http://projects.theforeman.org/issues/11780

问题似乎是安装了 puppet 包和 puppet gem。 Puppet 包是版本 2.7.x 和 puppet gem 是版本 3.7.x

我必须更正这个问题。