Revision 4b2b7c9a
Added by Justin Sherrill about 10 years ago
app/controllers/katello/api/v1/candlepin_proxies_controller.rb | ||
---|---|---|
get_content_view_environment("cp_id", id)
|
||
end
|
||
|
||
def get_content_view_environments(name = nil)
|
||
def get_content_view_environments(label = nil)
|
||
environments = ContentViewEnvironment.joins(:content_view => :organization).
|
||
where("#{Organization.table_name}.id = ?", @organization.id)
|
||
environments = environments.where("#{Katello::ContentViewEnvironment.table_name}.name = ?", name) if name
|
||
|
||
if environments.empty?
|
||
environments = ContentViewEnvironment.joins(:content_view => :organization).
|
||
where("#{Organization.table_name}.id = ?", @organization.id)
|
||
environments = environments.where("#{Katello::ContentViewEnvironment.table_name}.label = ?", name) if name
|
||
end
|
||
environments = environments.where("#{Katello::ContentViewEnvironment.table_name}.label = ?", label) if label
|
||
|
||
# remove any content view environments that aren't readable
|
||
unless @organization.readable?
|
app/models/katello/content_view.rb | ||
---|---|---|
# candlepin to become aware that the view is available for consumers.
|
||
def add_environment(env)
|
||
if self.content_view_environments.where(:environment_id => env.id).empty?
|
||
ContentViewEnvironment.create!(:name => env.name,
|
||
:label => self.generate_cp_environment_label(env),
|
||
label = self.generate_cp_environment_label(env)
|
||
ContentViewEnvironment.create!(:name => label,
|
||
:label => label,
|
||
:cp_id => self.generate_cp_environment_id(env),
|
||
:environment_id => env.id,
|
||
:content_view => self)
|
Also available in: Unified diff
fixes 4655 - fixing registration to Library attaching to incorrect content view
previously content view environment names were set to the environment namethis would result in a system subscribing to "Library" being subscribed to
a random content view in library. This fix does two things: