5.2. ライフサイクル環境の使用
Satellite は、アプリケーションのライフサイクルを、ライフサイクル環境に分割します。ライフサイクル環境は、アプリケーションのライフサイクルの各ステージを表します。ライフサイクル環境は、環境パスからリンクされます。リンクされたライフサイクル環境を API で作成するには、prior_id
パラメーターを使用します。
https://satellite.example.com/apidoc/v2/lifecycle_environments.html
で、ライフサイクル環境に関する、同梱の API リファレンスを確認できます。API ルートには /katello/api/environments
および /katello/api/organizations/:organization_id/environments
が含まれます。
以下の要求例では、python3
を使用して Satellite Server からの応答をフォーマットしています。RHEL 7 およびそれ以前の一部のシステムでは、python3
の代わりに python
を使用する必要があります。
ライフサイクル環境の表示
以下の API 呼び出しを使用して、Satellite にある ID が 1
のデフォルトの組織に対する現在の全ライフサイクル環境を表示します。
要求例:
curl --header "Accept:application/json" \ --header "Content-Type:application/json" \ --request GET --user sat_username:sat_password --insecure \ https://satellite.example.com/katello/api/organizations/1/environments \ | python3 -m json.tool`
$ curl --header "Accept:application/json" \
--header "Content-Type:application/json" \
--request GET --user sat_username:sat_password --insecure \
https://satellite.example.com/katello/api/organizations/1/environments \
| python3 -m json.tool`
応答例:
output omitted "description": null, "id": 1, "label": "Library", "library": true, "name": "Library", "organization": { "id": 1, "label": "Default_Organization", "name": "Default Organization" }, "permissions": { "destroy_lifecycle_environments": false, "edit_lifecycle_environments": true, "promote_or_remove_content_views_to_environments": true, "view_lifecycle_environments": true }, "prior": null, "successor": null, output truncated
output omitted
"description": null,
"id": 1,
"label": "Library",
"library": true,
"name": "Library",
"organization": {
"id": 1,
"label": "Default_Organization",
"name": "Default Organization"
},
"permissions": {
"destroy_lifecycle_environments": false,
"edit_lifecycle_environments": true,
"promote_or_remove_content_views_to_environments": true,
"view_lifecycle_environments": true
},
"prior": null,
"successor": null,
output truncated
ライフサイクル環境のリンク作成
以下の例を使用して、ライフサイクル環境のパスを作成します。
以下の手順では、ID が 1
のデフォルトのライブラリー環境が、ライフサイクル環境作成の開始点として使用されています。
開始点として使用する既存のライフサイクル環境を選択します。その ID を使用して環境を表示します。今回の例では、ID が
1
の環境を使用します。要求例:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow curl --request GET --user sat_username:sat_password --insecure \ https://satellite.example.com/katello/api/environments/1 \ | python3 -m json.tool
$ curl --request GET --user sat_username:sat_password --insecure \ https://satellite.example.com/katello/api/environments/1 \ | python3 -m json.tool
応答例:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow output omitted "id": 1, "label": "Library", output omitted "prior": null, "successor": null, output truncated
output omitted "id": 1, "label": "Library", output omitted "prior": null, "successor": null, output truncated
以下のコンテンツを含めて、
life-cycle.json
などの JSON ファイルを作成します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow {"organization_id":1,"label":"api-dev","name":"API Development","prior":1}
{"organization_id":1,"label":"api-dev","name":"API Development","prior":1}
prior
オプションを1
に設定して、ライフサイクル環境を作成します。要求例:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow curl --header "Accept:application/json" \ --header "Content-Type:application/json" \ --request POST --user sat_username:sat_password --insecure \ --data @life-cycle.json \ https://satellite.example.com/katello/api/environments \ | python3 -m json.tool
$ curl --header "Accept:application/json" \ --header "Content-Type:application/json" \ --request POST --user sat_username:sat_password --insecure \ --data @life-cycle.json \ https://satellite.example.com/katello/api/environments \ | python3 -m json.tool
応答例:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow output omitted "description": null, "id": 2, "label": "api-dev", "library": false, "name": "API Development", "organization": { "id": 1, "label": "Default_Organization", "name": "Default Organization" }, "permissions": { "destroy_lifecycle_environments": true, "edit_lifecycle_environments": true, "promote_or_remove_content_views_to_environments": true, "view_lifecycle_environments": true }, "prior": { "id": 1, "name": "Library" }, output truncated
output omitted "description": null, "id": 2, "label": "api-dev", "library": false, "name": "API Development", "organization": { "id": 1, "label": "Default_Organization", "name": "Default Organization" }, "permissions": { "destroy_lifecycle_environments": true, "edit_lifecycle_environments": true, "promote_or_remove_content_views_to_environments": true, "view_lifecycle_environments": true }, "prior": { "id": 1, "name": "Library" }, output truncated
以下のコマンドの出力では、ライフサイクル環境の ID が
2
で、その 1 つ前のライフサイクル環境は1
であると分かります。ID が2
のライフサイクル環境を使用して、この環境の後継を作成します。以前作成した
life-cycle.json
ファイルを編集して、label
、name
、prior
の値を更新します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow {"organization_id":1,"label":"api-qa","name":"API QA","prior":2}
{"organization_id":1,"label":"api-qa","name":"API QA","prior":2}
prior
オプションを2
に設定して、ライフサイクル環境を作成します。要求例:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow curl --header "Accept:application/json" \ --header "Content-Type:application/json" \ --request POST --user sat_username:sat_password --insecure \ --data @life-cycle.json \ https://satellite.example.com/katello/api/environments \ | python3 -m json.tool
$ curl --header "Accept:application/json" \ --header "Content-Type:application/json" \ --request POST --user sat_username:sat_password --insecure \ --data @life-cycle.json \ https://satellite.example.com/katello/api/environments \ | python3 -m json.tool
応答例:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow output omitted "description": null, "id": 3, "label": "api-qa", "library": false, "name": "API QA", "organization": { "id": 1, "label": "Default_Organization", "name": "Default Organization" }, "permissions": { "destroy_lifecycle_environments": true, "edit_lifecycle_environments": true, "promote_or_remove_content_views_to_environments": true, "view_lifecycle_environments": true }, "prior": { "id": 2, "name": "API Development" }, "successor": null, output truncated
output omitted "description": null, "id": 3, "label": "api-qa", "library": false, "name": "API QA", "organization": { "id": 1, "label": "Default_Organization", "name": "Default Organization" }, "permissions": { "destroy_lifecycle_environments": true, "edit_lifecycle_environments": true, "promote_or_remove_content_views_to_environments": true, "view_lifecycle_environments": true }, "prior": { "id": 2, "name": "API Development" }, "successor": null, output truncated
以下のコマンドの出力では、ライフサイクル環境の ID が
3
で、その 1 つ前のライフサイクル環境は2
であると分かります。
ライフサイクル環境の更新
PUT コマンドを使用して、ライフサイクル環境を更新できます。
以下の要求例では、ID が 3
のライフサイクル環境の説明を更新します。
要求例:
curl --header "Accept:application/json" \ --header "Content-Type:application/json" \ --request POST --user sat_username:sat_password --insecure \ --data '{"description":"Quality Acceptance Testing"}' \ https://satellite.example.com/katello/api/environments/3 \ | python3 -m json.tool
$ curl --header "Accept:application/json" \
--header "Content-Type:application/json" \
--request POST --user sat_username:sat_password --insecure \
--data '{"description":"Quality Acceptance Testing"}' \
https://satellite.example.com/katello/api/environments/3 \
| python3 -m json.tool
応答例:
output omitted "description": "Quality Acceptance Testing", "id": 3, "label": "api-qa", "library": false, "name": "API QA", "organization": { "id": 1, "label": "Default_Organization", "name": "Default Organization" }, "permissions": { "destroy_lifecycle_environments": true, "edit_lifecycle_environments": true, "promote_or_remove_content_views_to_environments": true, "view_lifecycle_environments": true }, "prior": { "id": 2, "name": "API Development" }, output truncated
output omitted
"description": "Quality Acceptance Testing",
"id": 3,
"label": "api-qa",
"library": false,
"name": "API QA",
"organization": {
"id": 1,
"label": "Default_Organization",
"name": "Default Organization"
},
"permissions": {
"destroy_lifecycle_environments": true,
"edit_lifecycle_environments": true,
"promote_or_remove_content_views_to_environments": true,
"view_lifecycle_environments": true
},
"prior": {
"id": 2,
"name": "API Development"
},
output truncated
ライフサイクル環境の削除
後継がない前提でライフサイクル環境を削除できます。このような理由から、以下の形式のコマンドを使用して、逆順にライフサイクル環境を削除します。
要求例:
curl --request DELETE --user sat_username:sat_password --insecure \ https://satellite.example.com/katello/api/environments/:id
$ curl --request DELETE --user sat_username:sat_password --insecure \
https://satellite.example.com/katello/api/environments/:id