Bookmark this page

Guided Exercise: Export and Import Content Views

Export content view packages to file system storage, and query the resulting package storage structure.

Outcomes

  • Export a content view to disk.

  • View the layout of the content view archive.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command prepares your environment and ensures that all required resources are available.

[student@workstation ~]$ lab start maintain-views

Instructions

  1. Log in to the Satellite Server web UI, https://satellite.lab.example.com, as the admin user with redhat as the password.

  2. In the upper-left corner of the web page, set the organization to Operations. Set the location to Any Location.

  3. Verify that the download policy for the Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs 9 repository is set to Immediate.

    1. Click ContentProducts, and then click Red Hat Enterprise Linux for x86_64.

    2. Click Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs 9. Verify that the Download Policy setting is Immediate.

    3. Click Select Action, and then click Sync Now. Wait for the task to complete.

  4. Verify that the Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs 9 repository is included in the OperationsServerBase content view.

    1. Click ContentContent Views, and then click OperationsServerBase.

    2. Click Version 1.0, and verify that the Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs 9 repository is present.

  5. Export the OperationsServerBase 1.0 content view.

    1. Log in to the satellite system as the student user and switch to the root user.

      [student@workstation ~]$ ssh satellite
      [student@satellite ~]$ sudo -i
      [sudo] password for student: student
      [root@satellite ~]#
    2. List the content views for the Operations organization. Note the ID for the OperationsServerBase 1.0 content view.

      [root@satellite ~]# hammer --output base \
      content-view version list \
      --organization Operations
      Id:                     5
      Name:                   OperationsServerBase 2.0
      Version:                2.0
      Description:            Base Repositories v2
      Lifecycle Environments: Library, Development
      
      Id:                     4
      Name:                   OperationsServerBase 1.0
      Version:                1.0
      Description:            Base Repositories
      Lifecycle Environments:
      
      Id:                     3
      Name:                   Default Organization View 1.0
      Version:                1.0
      Description:
      Lifecycle Environments: Library
    3. Export the OperationsServerBase 1.0 content view.

      [root@satellite ~]# hammer content-export complete version \
      --content-view Base \
      --id 4 \
      --organization Operations
      [....................................................................] [100%]
      Generated /var/lib/pulp/exports/Operations/OperationsServerBase/1.0/2022-08-08T20-58-12-04-00/metadata.json
    4. Examine the archive that contains the exported version of the content view. Change directory to the archive directory from the previous command output.

      [root@satellite ~]# cd \
      /var/lib/pulp/exports/Operations/OperationsServerBase/1.0/2022-08-08T20-58-12-04-00/
    5. Explore the contents of the content view archive. Your file size and attributes would differ from this example.

      [root@satellite 2022-08-08T20-58-12-04-00]# ls -lh
      total 1.1G
      -rw-r--r--. 1 pulp pulp 1.1G Aug  8 20:59 export-4689127b-7fc1-4d3c-aaeb-3c833828e2a3-20220809_0058.tar.gz
      -rw-r--r--. 1 pulp pulp  333 Aug  8 20:59 export-4689127b-7fc1-4d3c-aaeb-3c833828e2a3-20220809_0058-toc.json
      -rw-r--r--. 1 root root 1.1K Aug  8 20:59 metadata.json
    6. View the metadata.json file content.

      [root@satellite 2022-08-08T20-58-12-04-00]# cat metadata.json | json_reformat
      {
          organization: Operations,
          repositories: {
              Red_Hat_Enterprise_Linux_9_for_x86_64_-BaseOS_RPMs_9-102922: {
                  name: Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs 9,
                  label: Red_Hat_Enterprise_Linux_9_for_x86_64-_BaseOS_RPMs_9,
      ...output omitted...
                  os_versions: [
      
                  ],
                  major: 4,
                  minor: 4,
                  download_policy: immediate,
                  mirroring_policy: mirror_complete,
                  product: {
                      label: Red_Hat_Enterprise_Linux_for_x86_64
                  },
      ...output omitted...
    7. Return to the workstation system as the student user.

      [root@satellite 2022-08-08T20-58-12-04-00]# exit
      logout
      [student@satellite ~]$ exit
      logout
      Connection to satellite closed.
      [student@workstation ~]$

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish maintain-views

Revision: rh403-6.11-3ad886e