Skip to content

Commit

Permalink
Fixes #36776 - Fixed issue where composite content views promoted to …
Browse files Browse the repository at this point in the history
…lifecycle environments referencing the env name would error on promotion.

Changed env replacement source.
  • Loading branch information
qcjames53 committed Sep 25, 2023
1 parent e75f1f1 commit 258ae59
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions app/models/katello/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -862,11 +862,20 @@ def self.search_by_content_label(_key, operator, value)
def self.safe_render_container_name(repository, pattern = nil)
if (pattern && !pattern.blank?) || (repository.environment && !repository.environment.registry_name_pattern.empty?)
pattern ||= repository.environment.registry_name_pattern
environment = repository.environment
# For archived repositories, environment will be nil. In this case, get a
# valid env from the first non-archived repository.
environment ||= repository.content_view.repositories.first.environment
allowed_methods = {}
allowed_vars = {}
scope_variables = {repository: repository, organization: repository.organization, product: repository.product,
lifecycle_environment: repository.environment, content_view: repository.content_view_version.content_view,
content_view_version: repository.content_view_version}
scope_variables = {
repository: repository,
organization: repository.organization,
product: repository.product,
lifecycle_environment: environment,
content_view: repository.content_view_version.content_view,
content_view_version: repository.content_view_version
}
box = Safemode::Box.new(repository, allowed_methods)
erb = ERB.new(pattern)
pattern = box.eval(erb.src, allowed_vars, scope_variables)
Expand Down

0 comments on commit 258ae59

Please sign in to comment.