搜索

此内容没有您所选择的语言版本。

Chapter 8. Managing Content Views

download PDF

Red Hat Satellite 6 uses Content Views to create customized repositories from the repositories. To do this, you must define which repositories to use and then apply certain filters to the content. These filters include both package filters, package group filters, and errata filters. You can use Content Views to define which software versions a particular environment uses. For example, a Production environment might use a Content View containing older package versions, while a Development environment might use a Content View containing newer package versions.

Each Content View creates a set of repositories across each environment, which Satellite Server stores and manages. When you promote a Content View from one environment to the next environment in the application life cycle, the respective repository on Satellite Server updates and publishes the packages.

 DevelopmentTestingProduction

Content View Version and Contents

Version 2 - example_software-1.1-0.noarch.rpm

Version 1 - example_software-1.0-0.noarch.rpm

Version 1 - example_software-1.0-0.noarch.rpm

The repositories for Testing and Production contain the example_software-1.0-0.noarch.rpm package. If you promote Version 2 of the Content View from Development to Testing, the repository for Testing regenerates and then contains the example_software-1.1-0.noarch.rpm package:

 DevelopmentTestingProduction

Content View Version and Contents

Version 2 - example_software-1.1-0.noarch.rpm

Version 2 - example_software-1.1-0.noarch.rpm

Version 1 - example_software-1.0-0.noarch.rpm

This ensures systems are designated to a specific environment but receive updates when that environment uses a new version of the Content View.

The general workflow for creating Content Views for filtering and creating snapshots is as follows:

  1. Create a Content View.
  2. Add the repository and the Puppet modules that you want to the Content View.
  3. Optionally, create one or more filters to refine the content of the Content View.
  4. Optionally, resolve any package dependencies for a Content View.
  5. Publish the Content View.
  6. Optionally, promote the Content View to another environment.
  7. Attach the content host to the Content View.

If a repository is not associated with the Content View, the file /etc/yum.repos.d/redhat.repo remains empty and systems registered to it cannot receive updates.

Hosts can only be associated with a single Content View. To associate a host with multiple Content Views, create a composite Content View. For more information, see Section 8.7, “Creating a Composite Content View”.

Package Dependency Resolution

Package dependency is a complication of package management. For more information about how to manage package dependencies within Content Views, see Section 8.9, “Resolving Package Dependencies”.

8.1. Creating a Content View

Use this procedure to create a simple Content View.

Prerequisites

While you can stipulate whether you want to resolve any package dependencies on a Content View by Content View basis, you might want to change the default Satellite settings to enable or disable package resolution for all Content Views. For more information, see Section 8.9, “Resolving Package Dependencies”.

Procedure

To create a content view, complete the following steps:

  1. In the Satellite web UI, navigate to Content > Content Views and click Create New View.
  2. In the Name field, enter a name for the view. Satellite automatically completes the Label field from the name you enter.
  3. In the Description field, enter a description of the view.
  4. Optional: if you want to solve dependencies automatically every time you publish this Content View, select the Solve Dependencies check box. Dependency solving slows the publishing time and might ignore any Content View filters you use. This can also cause errors when resolving dependencies for errata.
  5. Click Save to create the Content View.
  6. In the Repository Selection area, select the repositories that you want to add to your Content View, then click Add Repositories.
  7. Click Publish New Version and in the Description field, enter information about the version to log changes.
  8. Click Save.
  9. Optional: to force metadata regeneration on Yum repositories, from the Actions list for your Content View versions, select Regenerate Repository Metadata.

You can view the Content View in the Content Views window. To view more information about the Content View, click the Content View name.

To register a host to your content view, see Registering Hosts in the Managing Hosts guide.

Creating a Content View with Hammer CLI

  1. Obtain a list of repository IDs:

    # hammer repository list --organization "My_Organization"
  2. Create the Content View and add repositories:

    # hammer content-view create \
    --name "Example_Content_View" \
    --description "Example Content View" \
    --repository-ids 1,2 \
    --organization "My_Organization"

    For the --repository-ids option, you can find the IDs in the output of the hammer repository list command.

  3. Publish the view:

    # hammer content-view publish \
    --name "Example_Content_View" \
    --description "Example Content View" \
    --organization "My_Organization"
  4. Optional: To add a repository to an existing Content View, enter the following command:

    # hammer content-view add-repository \
    --name "Example_Content_View" \
    --organization "My_Organization" \
    --repository-id repository_ID

Satellite Server creates the new version of the view and publishes it to the Library environment.

8.2. Viewing Module Streams

In Satellite, you can view the module streams of the repositories in your Content Views.

Procedure

To view module streams for the repositories in your content view, complete the following steps:

  1. In the Satellite web UI, navigate to Content > Content Views, and select the Content View that contains the modules you want to view.
  2. Click the Versions tab and select the Content View version that you want to view.
  3. Click the Module Streams tab to view the module streams that are available for the Content View.
  4. Use the Filter field to refine the list of modules.
  5. To view the information about the module, click the module.

8.3. Creating a Content View with a Puppet Module

Use this procedure to create a Content View using one repository and no filters.

Prerequisites

Before you begin, upload the required Puppet module to a repository within a custom product. For more information, see Adding Puppet Modules to Red Hat Satellite 6 in the Puppet Guide.

Procedure

To create a Content View with a Puppet module, complete the following steps:

  1. In the Satellite web UI, navigate to Content > Content Views and click Create New View.
  2. In the Name field, enter a name for the view. Red Hat Satellite 6 automatically completes the Label field from the name you enter.
  3. In the Description field, enter a description of the view.
  4. Click Save to complete.
  5. In the Repository Selection area, select the repositories that you want to add to your Content View, then click Add Repositories.
  6. Click the Puppet Modules tab, then click Add New Module.
  7. Search for the module that you want to add and click Select a Version.
  8. Navigate to the entry for Use Latest and click Select Version in the Actions column.
  9. To publish, click the Versions tab and click Publish New Version. In the Description field, enter a description to log the changes and click Save.

To register a host to your content view, see Registering Hosts in the Managing Hosts guide.

For CLI Users

To add a Puppet module to a Content View, enter the following command:

# hammer content-view puppet-module add \
--content-view cv_name \
--name module_name

8.4. Promoting a Content View

Use this procedure to promote Content Views across different lifecycle environments.

Permission Requirements for Content View Promotion

Non-administrator users require two permissions to promote a Content View to an environment:

  1. promote_or_remove_content_views
  2. promote_or_remove_content_views_to_environment.

The promote_or_remove_content_views permission restricts which Content Views a user can promote.

The promote_or_remove_content_views_to_environment permission restricts the environments to which a user can promote Content Views.

With these permissions you can assign users permissions to promote certain Content Views to certain environments, but not to other environments. For example, you can limit a user so that they are permitted to promote to test environments, but not to production environments.

You must assign both permissions to a user to allow them to promote Content Views.

Procedure

To promote a Content View, complete the following steps:

  1. In the Satellite web UI, navigate to Content > Content Views and select the Content View that you want to promote.
  2. Click the Versions tab for the Content View.
  3. Select the version that you want to promote and in the Actions column, click Promote.
  4. Select the environment where you want to promote the Content View, and click Promote Version.
  5. Click the Promote button again. This time select the Testing environment and click Promote Version.
  6. Finally click on the Promote button again. Select the Production environment and click Promote Version.

Now the repository for the Content View appears in all environments.

For CLI Users

  • Promote the Content View using the hammer content-view version promote each time:

    # hammer content-view version promote \
    --content-view "Database" \
    --version 1 \
    --to-lifecycle-environment "Development" \
    --organization "My_Organization"
    # hammer content-view version promote \
    --content-view "Database" \
    --version 1 \
    --to-lifecycle-environment "Testing" \
    --organization "My_Organization"
    # hammer content-view version promote \
    --content-view "Database" \
    --version 1 \
    --to-lifecycle-environment "Production" \
    --organization "My_Organization"

    Now the database content is available in all environments.

To register a host to your content view, see Registering Hosts in the Managing Hosts guide.

8.5. Promoting a Content View Across All Life Cycle Environments within an Organization

Use this procedure to promote Content Views across all lifecycle environments within an organization.

Procedure

To promote a Content Views version across all lifecycle environments within an organization, complete the following steps:

  1. To promote a selected Content View version from Library across all life cycle environments within an organization, run the following Bash script:

    ORG="Your_Organization"
    CVV_ID=3
    
    for i in $(hammer --no-headers --csv lifecycle-environment list --organization $ORG | awk -F, {'print $1'} | sort -n)
    do
       hammer content-view version promote --organization $ORG --to-lifecycle-environment-id $i --id $CVV_ID
    done
  2. Display information about your Content View version to verify that it is promoted to the required lifecycle environments:

    # hammer content-view version info --id 3

8.6. Composite Content Views Overview

A Composite Content View combines the content from several Content Views. For example, you might have separate Content Views to manage an operating system and an application individually. You can use a Composite Content View to merge the contents of both Content Views into a new repository. The repositories for the original Content Views still exist but a new repository also exists for the combined content.

If you want to develop an application that supports different database servers. The example_application appears as:

example_software

Application

Database

Operating System

Example of four separate Content Views:

  • Red Hat Enterprise Linux (Operating System)
  • PostgreSQL (Database)
  • MariaDB (Database)
  • example_software (Application)

From the previous Content Views, you can create two Composite Content Views.

Example Composite Content View for a PostgreSQL database:

Composite Content View 1 - example_software on PostgreSQL

example_software (Application)

PostgreSQL (Database)

Red Hat Enterprise Linux (Operating System)

Example Composite Content View for a MariaDB:

Composite Content View 2 - example_software on MariaDB

example_software (Application)

MariaDB (Database)

Red Hat Enterprise Linux (Operating System)

Each Content View is then managed and published separately. When you create a version of the application, you publish a new version of the Composite Content Views. You can also select the Auto Publish option when creating a Composite Content View, and then the Composite Content View is automatically republished when a Content View it includes is republished.

Repository Restrictions

You cannot include more than one of each repository in Composite Content Views. For example, if you attempt to include two Content Views using the same repository in a Composite Content View, Satellite Server reports an error.

8.7. Creating a Composite Content View

Procedure

To create a Composite Content View, complete the following steps:

  1. In the Satellite web UI, navigate to Content > Content Views and click Create New View.
  2. In the Name field, enter a name for the view. Red Hat Satellite 6 automatically completes the Label field from the name you enter.
  3. In the Description field, enter a description of the view.
  4. Select the Composite View? check box to create a Composite Content View.
  5. Optional: select the Auto Publish check box if you want the Composite Content View to be republished automatically when a Content View is republished.
  6. Click Save.
  7. In the Add Content Views area, select the Content Views that you want to add to the Composite Content View, and then click Add Content Views.
  8. Click Publish New Version to publish the Composite Content View. In the Description field, enter a description and click Save.
  9. Click Promote and select the lifecycle environments to promote the Composite Content View to, enter a description, and then click Promote Version.

For CLI Users

  1. Before you create the Composite Content Views, list the version IDs for your existing Content Views:

    # hammer content-view version list \
    --organization "My_Organization"
  2. Create a new Composite Content View. When the --auto-publish option is set to yes, the Composite Content View is automatically republished when a Content View it includes is republished:

    # hammer content-view create \
    --composite \
    --auto-publish yes \
    --name "Example_Composite_Content_View" \
    --description "Example Composite Content View" \
    --organization "My_Organization"
  3. Add a component Content View to the Composite Content View. You must include the Content View Version ID and use the --latest option. To include multiple component Content Views to the Composite Content View, repeat this step for every Content View you want to include:

    # hammer content-view component add \
    --component-content-view-id Content_View_Version_ID \
    --latest \
    --composite-content-view "Example_Composite_Content_View"
  4. Publish the Composite Content View:

    # hammer content-view publish \
    --name "Example_Composite_Content_View" \
    --description "Initial version of Composite Content View" \
    --organization "My_Organization"
  5. Promote the Composite Content View across all environments:

    # hammer content-view version promote \
    --content-view "Example_Composite_Content_View" \
    --version 1 \
    --to-lifecycle-environment "Development" \
    --organization "My_Organization"
    # hammer content-view version promote \
    --content-view "Example_Composite_Content_View" \
    --version 1 \
    --to-lifecycle-environment "Testing" \
    --organization "My_Organization"
    # hammer content-view version promote \
    --content-view "Example_Composite_Content_View" \
    --version 1 \
    --to-lifecycle-environment "Production" \
    --organization "My_Organization"

8.8. Content Filter Overview

Content Views also use filters to include or restrict certain RPM content. Without these filters, a Content View includes everything from the selected repositories.

There are two types of content filters:

Table 8.1. Filter Types
Filter TypeDescription

Include

You start with no content, then select which content to add from the selected repositories. Use this filter to combine multiple content items.

Exclude

You start with all content from selected repositories, then select which content to remove. Use this filter when you want to use most of a particular content repository but exclude certain packages, such as blacklisted packages. The filter uses all content in the repository except for the content you select.

Include and Exclude Filter Combinations

If using a combination of Include and Exclude filters, publishing a Content View triggers the include filters first, then the exclude filters. In this situation, select which content to include, then which content to exclude from the inclusive subset.

Content Types

There are also four types of content to filter:

Table 8.2. Content Types
Content TypeDescription

Package

Filter packages based on their name and version number.

Package Group

Filter packages based on package groups. The list of package groups is based on the repositories added to the Content View.

Erratum (by ID)

Select which specific errata to add to the filter. The list of Errata is based on the repositories added to the Content View.

Erratum (by Date and Type)

Select a issued or updated date range and errata type (Bugfix, Enhancement, or Security) to add to the filter.

8.9. Resolving Package Dependencies

In Satellite, you can use the package dependency resolution feature to ensure that any dependencies that packages have within a Content View are added to the dependent repository as part of the Content View publication process.

You can select to resolve package dependencies for any Content View that you want, or you can change the default setting to enable or disable resolving package dependencies for all new Content Views.

Note that resolving package dependencies can cause significant delays to Content View promotion. The package dependency resolution feature does not consider packages that are installed on your system independently of the Content View or solve dependencies across repositories.

Resolving Package Dependencies and Filters

Filters do not resolve any dependencies of the packages listed in the filters. This might require some level of testing to determine what dependencies are required.

If you add a filter that excludes some packages that are required and the Content View has dependency resolution enabled, Satellite ignores the rules you create in your filter in favor of resolving the package dependency.

If you create a content filter for security purposes, to resolve a package dependency, Satellite can add packages that you might consider insecure.

Procedure

To resolve package dependencies by default, complete the following steps:

  1. In the Satellite web UI, navigate to Administer > Settings and click the Content tab.
  2. Locate the Content View Dependency Solving Default, and select Yes.

You can also set the default level of dependency resolution that you want. You can select between adding packages to solve dependencies only if the required package does not exist, or to add the latest packages to resolve the dependency even if the package exists in the repository.

To set the default level of dependency resolution, complete the following steps:

  1. In the Satellite web UI, navigate to Administer > Settings and click the Content tab.
  2. Locate the Content View Dependency Solving Algorithm and select one of the following options:

    • To add the package that resolves the dependency only if it does not exist in the repository, select Conservative.
    • To add the package that resolves the dependency regardless of whether or not it exists in the repository, select Greedy.

8.10. Content Filter Examples

Use any of the following examples with the procedure that follows to build custom content filters.

Example 1

Create a repository with the base Red Hat Enterprise Linux packages. This filter requires a Red Hat Enterprise Linux repository added to the Content View.

Filter:

  • Inclusion Type: Include
  • Content Type: Package Group
  • Filter: Select only the Base package group

Example 2

Create a repository that excludes all errata, except for security updates, after a certain date. This is useful if you want to perform system updates on a regular basis with the exception of critical security updates, which must be applied immediately. This filter requires a Red Hat Enterprise Linux repository added to the Content View.

Filter:

  • Inclusion Type: Exclude
  • Content Type: Erratum (by Date and Type)
  • Filter: Select only the Bugfix and Enhancement errata types, and clear the Security errata type. Set the Date Type to Updated On. Set the Start Date to the date you want to restrict errata. Leave the End Date blank to ensure any new non-security errata is filtered.

Example 3

A combination of Example 1 and Example 2 where you only require the operating system packages and want to exclude recent bug fix and enhancement errata. This requires two filters attached to the same Content View. The Content View processes the Include filter first, then the Exclude filter.

Filter 1:

  • Inclusion Type: Include
  • Content Type: Package Group
  • Filter: Select only the Base package group

Filter 2:

  • Inclusion Type: Exclude
  • Content Type: Erratum (by Date and Type)
  • Filter: Select only the Bugfix and Enhancement errata types, and clear the Security errata type. Set the Date Type to Updated On. Set the Start Date to the date you want to restrict errata. Leave the End Date blank to ensure any new non-security errata is filtered.

For another example of how content filters work, see the following article: "How do content filters work in Satellite 6"

8.11. Creating a Content Filter

Use this procedure to create a content filter. For examples of how to build a filter, see Section 8.10, “Content Filter Examples”

Procedure

To create a content filter, complete the following steps:

  1. In the Satellite web UI, navigate to Content > Content Views and select a Content View.
  2. Navigate to Yum Content > Filters and click New Filter.
  3. In the Name field, enter a name for your filter.
  4. From the Content Type list, select the content type that you want to filter. Depending on what you select for the new filter’s content type, different options appear.
  5. From the Inclusion Type list, select either Include or Exclude.
  6. In the Description field, enter a description for the filter, and click Save.
  7. Depending on what you enter for Content Type, add rules to create the filter that you want.
  8. Click the Affected repositories tab to select which specific repositories use this filter.
  9. Click Publish New Version to publish the filtered repository. In the Description field, enter a description of the changes, and click Save.

You can promote this Content View across all environments.

For CLI Users

  1. Add a filter to the Content View. Use the --inclusion false option to set the filter to an Exclude filter:

    # hammer content-view filter create \
    --name "Errata Filter" \
    --type erratum --content-view "Example_Content_View" \
    --description "My latest filter" \
    --inclusion false \
    --organization "My_Organization"
  2. Add a rule to the filter:

    # hammer content-view filter rule create \
    --content-view "Example_Content_View" \
    --content-view-filter "Errata Filter" \
    --start-date "YYYY-MM-DD" \
    --types enhancement,bugfix \
    --date-type updated \
    --organization "My_Organization"
  3. Publish the Content View:

    # hammer content-view publish \
    --name "Example_Content_View" \
    --description "Adding errata filter" \
    --organization "My_Organization"
  4. Promote the view across all environments:

    # hammer content-view version promote \
    --content-view "Example_Content_View" \
    --version 1 \
    --to-lifecycle-environment "Development" \
    --organization "My_Organization"
    # hammer content-view version promote \
    --content-view "Example_Content_View" \
    --version 1 \
    --to-lifecycle-environment "Testing" \
    --organization "My_Organization"
    # hammer content-view version promote \
    --content-view "Example_Content_View" \
    --version 1 \
    --to-lifecycle-environment "Production" \
    --organization "My_Organization"
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.