Uploaded image for project: 'Insights Experiences'
  1. Insights Experiences
  2. HMS-3599

Update candlepin on Content Template Create & Update

      Goal: 

      • Manage all entities in candlepin related to a content template

      Acceptance Criteria:

      As part of Content Template creation (or update), we need tasks to be run that create all the entities we need to represent the repositories and template in candlepin.  For create/Update, you'll use these apis:

       

       

      # Create a product for all custom repos, if it doesn't exist.  The creation would only ever happen once.
      OwnerProductApi.CreateProduct
      POST /owners/{owner_key}/products
      
      # Create a Pool to act as the subscripotion for the custom product. The creation would only ever happen once.
      OwnersApi.CreatePool
      POST /owners/{owner_key}/pools
        * Expiration date at some point in the future (satellite uses a static end date in 2049 https://github.com/Katello/katello/blob/master/app/lib/katello/resources/candlepin/product.rb#L80)
      
      #For each repository, create a content set
      OwnerContetAPI.CreateContent (or CreateContentBatch)
      POST /owners/{owner_key}/content
       * GgpURL should point to the GPG key url
      
      # Add each content to the product (if not already)
      OwnerProductApi.AddContentToProduct
      POST /owners/{owner_key}/products/{product_id}/content/{content_id}
       * Set enabled to true
      
      
      # Create an enviornment for the content template
      OwnersAPI.CreateEnv
      POST /owners/{owner_key}/environments
       * Set env prefix accordingly
       * (pulp-content path):  https://cert.console.redhat.com/api/pulp-content/   with the red hat domain path, template path: /$RH_DOMAIN/$TEMPLATE_UUID/
       * so then  when red hat content set with some path (/content/os/rhel/9/x86_64/os/)  is promoted to it, it'll use the full URL of:  https://cert.console.redhat.com/api/pulp-content/$RH_DOMAIN/$TEMPLATE_UUID/content/os/rhel/9/x86_64/os/
      
      
      # Add content to environment (set enabled= true)
      POST /environments/{env_id}/content
      EnvironmentAPI.PromoteContent
      
      # Remove content that shouldn't be there (on update if repos are added/removed)
      EnvironmentApi.DemoteContent
      Delete /environments/{env_id}/content

       

       

      As part of this, we should write an integration test.

       

      Owner_key here is the org_id

       

      At the end of this ticket, i wouldn't expect candlepin support to be turned on in stage/prod

              rverdile@redhat.com Ryan Verdile
              rhn-engineering-jsherrill Justin Sherrill
              None
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: