标签: theforeman

使用Foreman API更新主机的Python脚本

我想用Python编写一个脚本,该脚本提供了两个参数host&hostgroup,使用Foreman API(http://theforeman.org/api/apidoc/v1/hosts/update.html)更改了主机的主机组。

要执行此操作的cURL命令如下所示(有效!):

curl -s -H "Accept:application/json" -X PUT --insecure --negotiate -u : -d "host[hostgroup_id]=ZZZZZ" https://foreman.mydomain.com:443/api/hosts/XXXX
Run Code Online (Sandbox Code Playgroud)

但是现在,我想使用Python脚本来做到这一点。

我使用的Python 请求库没有问题,直到我必须传递参数时为止。

我正在关注此信息http://docs.python-requests.org/en/latest/user/quickstart/#passing-parameters-in-urls,但显然这是行不通的,因为这不是领班API期望的方式接收参数。

那么,有什么想法可以以Foreman可以理解的方式传递参数吗?

在此先感谢您的帮助!

python curl kerberos httprequest theforeman

5
推荐指数
1
解决办法
5017
查看次数

卸载领班

我按照此处的说明在Ubuntu Server 12.04上安装了The Foreman:

http://theforeman.org/manuals/1.2/quickstart_guide.html#Installation

我现在已经决定它不适合我 - 但我找不到有关如何卸载的任何说明.宝石卸载工头等各种命令失败,因为它似乎是作为宝石安装的.

任何帮助将不胜感激.谢谢,克里斯蒂亚诺

ruby puppet theforeman

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

theforeman ×2

curl ×1

httprequest ×1

kerberos ×1

puppet ×1

python ×1

ruby ×1