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 ドキュメントを参照して、エラータ適用に使用する URL を検索します。Satellite Web UI で、検索クエリーの形式を確認できます。ホスト > ホストコレクション に移動して、ホストコレクションを選択します。コレクションアクション > エラータのインストール に移動して、検索クエリーボックスの内容を確認します。たとえば、my-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

ホストコレクションへのエラータの適用

以下の例では、Satellite Web UI に表示されているように、検索文字列 host_collection="my-collection" を渡すのに必要なエスケープレベルに注目してください。

要求例:

$ 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