view_facts 权限在工头中不起作用 restful API

view_facts permission doesn't work in foreman restful API

我在使用 foreman 1.7.4 版本时遇到了一个 foreman restful API 问题

当我尝试使用具有 view_facts 权限的帐户通过 foreman restful API 查询给定主机的事实时,它只是显示为空,而我可以查询事实Web 界面中的给定主机。

我可以通过 restful API 查询事实,只有当我给了帐户管理员权限时,这不是我想要的。因为管理员权限不仅可以查询还可以change/write something.

已获得 view_facts 权限但未获得管理员权限

curl -s -k -u user:passwd -H "Accept: version=2,application/json" https://sjengpptmst01/api/hosts/test.sample.com/facts

{
  "total": 0,
  "subtotal": 0,
  "page": 1,
  "per_page": 20,
  "search": " host = test.sample.com",
  "sort": {
    "by": null,
    "order": null
  },
  "results": {}
}

Gavin 管理员权限

{
  "total": 22066,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": " host = test.sample.com",
  "sort": {
    "by": null,
    "order": null
  },
  "results": {"test.sample.com": 
   {"root_home":"/root","path":"/usr/bin:/sbin:/bin:/usr/sbin","rubysitedir":"/usr/lib/ruby/site_ruby/1.8","puppet_vardir":"/var/lib/puppet","unlabeled_dev_count":"0\n","macaddress_eth0":"00:50:56:A9:F0:DC","macaddress":"00:50:56:A9:F0:DC","bios_release_date":"06/22/2012","uniqueid":"090a444c","augeasversion":"1.0.0","rubyversion":"1.8.7","network_eth0":"10.9.76.0","ipaddress":"10.9.76.68","ipaddress_eth0":"10.9.76.68","blockdevice_sr0_size":"1073741312","network_lo":"127.0.0.0","ipaddress_lo":"127.0.0.1","uptime_hours":"143","mtu_eth0":"1500","facterversion":"2.4.3"}}
}

但是当我在没有管理员权限的情况下使用 firefox 使用给定帐户访问给定主机时,它可能会在网络浏览器上显示事实。

这被报告为 Foreman bug #9793,它已在 Foreman 1.9.0 中修复,因此您应该考虑从 1.7 升级到更新的版本。

升级时,建议您浏览每个主要版本,因为跨多个版本的跳转未经测试,可能会出现问题。

http://theforeman.org/manuals/1.8/index.html#3.6Upgrade http://theforeman.org/manuals/1.9/index.html#3.6Upgrade http://theforeman.org/manuals/1.10/index.html#3.6Upgrade

撰写本文时稳定版本为 1.10.x,其中 1.11.x 处于候选发布状态。