Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-19962

promoting a CCV with a docker repo to LE with Registry Name Pattern raises NilClass::Jail exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 6.13.0
    • Content Views
    • Sprint 123, Sprint 124, Sprint 125
    • Important
    • None

      Description of problem:
      Having a LE with Registry Name Pattern referring to either repository.* variable, and promoting a CCV with a docker repo to this LE raises exception like:

      2023-09-08T11:55:26 [E|bac|e990f9c3] undefined method '#label' for NilClass::Jail (NilClass) (Safemode::NoMethodError)
      e990f9c3 | /usr/share/gems/gems/safemode-1.3.8/lib/safemode/jail.rb:22:in `method_missing'
      e990f9c3 | /usr/share/gems/gems/safemode-1.3.8/lib/safemode.rb:55:in `initialize'
      e990f9c3 | /usr/share/gems/gems/safemode-1.3.8/lib/safemode.rb:52:in `eval'
      e990f9c3 | /usr/share/gems/gems/katello-4.7.0.31/app/models/katello/repository.rb:875:in `safe_render_container_name'
      e990f9c3 | /usr/share/gems/gems/katello-4.7.0.31/app/lib/katello/validators/environment_docker_repositories_validator.rb:25:in `block in validate_repositories'
      e990f9c3 | /usr/share/gems/gems/katello-4.7.0.31/app/lib/katello/validators/environment_docker_repositories_validator.rb:24:in `each'
      e990f9c3 | /usr/share/gems/gems/katello-4.7.0.31/app/lib/katello/validators/environment_docker_repositories_validator.rb:24:in `validate_repositories'
      e990f9c3 | /usr/share/gems/gems/katello-4.7.0.31/app/models/katello/content_view.rb:617:in `block in check_docker_repository_names!'

      The reason is here in /usr/share/gems/gems/katello-4.7.0.31/app/models/katello/content_view.rb :

      def publish_repositories(override_components = nil)
      repositories = composite? ? repositories_to_publish_by_library_instance(override_components).values : repositories_to_publish
      repositories.each do |repos|
      if repos.is_a? Array
      yield repos
      else
      yield [repos]
      end
      end
      end

      or more precisely in:

      def repositories_to_publish_by_library_instance(override_components = nil)

      1. retrieve the list of repositories in a hash, where the key
      2. is the library instance id, and the value is an array
      3. of the repositories for that instance.
        repositories_to_publish(override_components).inject({}) do |result, repo|
        result[repo.library_instance] ||= []
        result[repo.library_instance] << repo
        result
        end
        end

      which for CCV returns an Array of Array of Katello::Repository

      While "repositories_to_publish" method itself (used for non-composite CVs) returns Katello::Repository::ActiveRecord_Relation .

      Version-Release number of selected component (if applicable):
      Sat 6.11 till 6.13 (at least)

      How reproducible:
      100%

      Steps to Reproduce:
      1. Have a docker repo (optionally synced, that doesnt matter)
      2. Have a LE with "Registry Name Pattern:" set to e.g.:

      <%= organization.label %><%= lifecycle_environment.label %><%= content_view.label %><%= product.label %><%= repository.label %>

      (or any other variable from:

      repository.name
      repository.label
      repository.docker_upstream_name

      )

      3. Have a CV with the docker repo, promoted to that LE
      4. Have a CCV with that CV and try promoting it to the LE

      Actual results:
      4. raises exception as above

      Expected results:
      4. no exception raised

      Additional info:

              jira-bugzilla-migration RH Bugzilla Integration
              jira-bugzilla-migration RH Bugzilla Integration
              RH Bugzilla Integration RH Bugzilla Integration
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: