Show Table of Contents
4.6. ライフサイクル環境との作業
『Server Administration Guide』の「Life Cycle Environments」 セクションで説明されているように、アプリケーションのライフサイクルは ライフサイクル環境 に分類され、各ライフサイクル環境はアプリケーションライフサイクルの各ステージを表します。ライフサイクル環境は連携し、環境パス を形成します。API を使用してライフサイクル環境を連携させるには、
prior_id パラメーターを使用します。
https://satellite6.example.com/apidoc/v2/lifecycle_environments.html でライフサイクル環境に関する同梱の API リファレンスを参照できます。API ルートには、/katello/api/environments および /katello/api/organizations/:organization_id/environments が含まれます。
Satellite で、デフォルトの組織
1 に対する現在のライフサイクル環境すべてを以下のように表示することができます。
$curl -H "Accept:application/json,version=2" \-H "Content-Type:application/json" -X GET \-u sat_user:sat_password -k \https://satellite6.example.com/katello/api/organizations/1/environments | python -m json.tool
新規インストールした Satellite の出力では、以下のようなセクションが表示されるはずです。
出力省略 "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, 出力省略
以下の手順では、ID が
1 のデフォルトのライブラリー環境 が、ライフサイクル環境作成の開始点として使用されています。
手順4.3 ライフサイクル環境のリンク作成
- 開始点として使用する既存のライフサイクル環境を選択します。その ID を使用して環境を表示します。今回の例では、ID が
1の環境を使用します。$
curl -X GET -s -k -u sat_user:sat_password \https://satellite6.example.com/katello/api/environments/1 | python -m json.tool出力省略 "id": 1, "label": "Library", 出力省略 "prior": null, "successor": null, 出力省略 1に設定したpriorオプションを使用して、新しいライフサイクル環境を作成します。- 内容が
{"organization_id":1,"label":"api-dev","name":"API Development","prior":1}のlife-cycle.jsonなどの JSON ファイルを作成します。 - 以下のようなコマンドを入力します。
$
curl -H "Accept:application/json,version=2" \-H "Content-Type:application/json" -X POST \-u sat_user:sat_password -k \-d @life-cycle.json \https://satellite6.example.com/katello/api/environments \| python -m json.tool出力省略 "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" }, 出力省略
以下のコマンドの出力では、ライフサイクル環境の ID が2で、これの 1 つ前のライフサイクル環境は1であると分かります。これは、1と2がリンクされていることを示します。この環境の後継を作成する場合に、ライフサイクル環境 ID2が使用されます。2に設定したpriorオプションを使用して、別のライフサイクル環境を作成します。- 以前に作成した
life-cycle.jsonを編集して、label、name、priorの値を{"organization_id":1,"label":"api-qa","name":"API QA","prior":2}のように更新します。 - 以下のようなコマンドを入力します。
$
curl -H "Accept:application/json,version=2" \-H "Content-Type:application/json" -X POST \-u sat_user:sat_password -k \-d @life-cycle.json \https://satellite6.example.com/katello/api/environments \| python -m json.tool出力省略 "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, 出力省略
以下のコマンドの出力では、ライフサイクル環境の ID が3で、これの 1 つ前のライフサイクル環境は1であると分かります。これは、2と3がリンクされていることを示します。
ライフサイクル環境の更新
以下のように、ライフサイクル環境は PUT コマンドを使用して更新できます。
$curl -H "Accept:application/json,version=2" \-H "Content-Type:application/json" -X POST \-u sat_user:sat_password -k \-d '{"description":"Quality Acceptance Testing"}' \https://satellite6.example.com/katello/api/environments/3 \| python -m json.tool出力省略 "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" }, 出力省略
ライフサイクル環境の削除
後継する環境がない場合には、ライフサイクル環境を削除できます。そのため、
curl -X DELETE -s -k -u sat_user:sat_password https://satellite6.example.com/katello/api/environments/:idの形式のコマンドを使用して、逆の順番で環境を削除します。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.