5.4. 将勘误应用到主机或主机组
您可以使用 API 将勘误表应用到主机、主机组或主机组。以下是 PUT 请求的基本语法:
$ curl --header "Accept:application/json" \ --header "Content-Type:application/json" --request PUT \ --user sat_username:sat_password --insecure \ --data json-formatted-data https://satellite7.example.com
您可以浏览 API doc 中的内置,以查找用于应用勘误的 URL。您可以使用 Satellite Web UI 帮助发现搜索查询的格式。导航到 Hosts > Host Collections 并选择主机聚合。进入 Collection Actions > Errata Installation,并注意搜索查询复选框内容。例如,对于名为 my-collection 的 Host Collection,搜索框包含 host_collection="my-collection"
。
将勘误应用到主机
本例对批量操作 /katello/api/hosts/bulk/install_content
使用 API URL 来显示简单搜索所需的格式。
请求示例:
$ curl --header "Accept:application/json" \ --header "Content-Type:application/json" --request PUT \ --user sat_username:sat_password --insecure \ --data "{\"organization_id\":1,\"included\":{\"search\":\"my-host\"},\"content_type\":\"errata\",\"content\":[\"RHBA-2016:1981\"]}" \ https://satellite.example.com/api/v2/hosts/bulk/install_content
将勘误应用到主机组
在本例中,请注意需要传递搜索字符串 host_collection="my-collection"
所需的转义级别,如 Satellite Web UI 中所示。
请求示例:
$ curl --header "Accept:application/json" \ --header "Content-Type:application/json" --request PUT \ --user sat_username:sat_password --insecure \ --data "{\"organization_id\":1,\"included\":{\"search\":\"host_collection=\\\"my-collection\\\"\"},\"content_type\":\"errata\",\"content\":[\"RHBA-2016:1981\"]}" \ https://satellite.example.com/api/v2/hosts/bulk/install_content