4.6. Working with Life Cycle Environments


As explained in the Life Cycle Environments section of the Architecture Guide, application life cycles are divided into life cycle environments, which represent each stage of the application life cycle. Life cycle environments are linked to from an environment path. To create linked Life Cycle Environments using the API, make use of the prior_id parameter.
You can find the built-in API reference for Life Cycle Environments at https://satellite6.example.com/apidoc/v2/lifecycle_environments.html. The API routes include /katello/api/environments and /katello/api/organizations/:organization_id/environments.
You can list all the current Life Cycle Environments on your Satellite, for the default organization 1, as follows:
$ 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
Copy to Clipboard
A newly installed Satellite would have an output with a section similar to the following:
      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
Copy to Clipboard
In the procedure below the default Library environment, with ID 1, is used as the starting point for creating Life Cycle Environments.

Procedure 4.3. Creating Linked Life Cycle Environments

  1. Choose an existing Life Cycle Environment that you want to use as a starting point. List the environment using its ID, in this case the environment with ID 1:
    $ curl -X GET -s -k -u sat_user:sat_password \
    https://satellite6.example.com/katello/api/environments/1 | python -m json.tool
    	output omitted
       "id": 1,
       "label": "Library",
    	output omitted
        "prior": null,
        "successor": null,
    	output truncated
    Copy to Clipboard
  2. Create a new Life Cycle Environment using the prior option set to 1:
    1. Create a JSON file, for example, life-cycle.json, with the following contents: {"organization_id":1,"label":"api-dev","name":"API Development","prior":1}
    2. Enter a command as follows:
      $ 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
            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
      Copy to Clipboard
    In the command output you can see the ID for this Life Cycle Environment is 2, and the Life Cycle Environment prior to this one is 1. This signifies that Life Cycle Environment 1 and 2 are linked. The Life Cycle Environment ID 2 is used when creating a successor to this environment.
  3. Create another Life Cycle Environment, using the prior option set to 2:
    1. Edit the previously created life-cycle.json, updating the label, name, and prior values: {"organization_id":1,"label":"api-qa","name":"API QA","prior":2}
    2. Enter a command as follows:
      $ 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
            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
      Copy to Clipboard
    In the command output you can see the ID for this Life Cycle Environment is 3, and the Life Cycle Environment prior to this one is 2. This signifies that Life Cycle Environment 2 and 3 are linked.

Updating a Life Cycle Environment

A Life Cycle Environment can be updated using a PUT command. For example:
$ 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
      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
Copy to Clipboard

Deleting a Life Cycle Environment

A Life Cycle Environment can be deleted provided it has no successor. Therefore, delete them in reverse order using a command in the following format:
curl -X DELETE -s -k -u sat_user:sat_password https://satellite6.example.com/katello/api/environments/:id
Copy to Clipboard
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat