Class: Katello::ContentView
Overview
rubocop:disable Metrics/ClassLength
Defined Under Namespace
Classes: Jail
Constant Summary
collapse
- CONTENT_DIR =
"content_views".freeze
- IMPORT_LIBRARY =
"Import-Library".freeze
- EXPORT_LIBRARY =
"Export-Library".freeze
Class Method Summary
collapse
Instance Method Summary
collapse
#deletable?, #editable?, #promotable_or_removable?, #publishable?, #readable?
included, #label_not_changed, #setup_label_from_name
Methods inherited from Model
#destroy!
Class Method Details
.humanize_class_name(_name = nil) ⇒ Object
706
707
708
|
# File 'app/models/katello/content_view.rb', line 706
def self.humanize_class_name(_name = nil)
_("Content Views")
end
|
.in_environment(env) ⇒ Object
134
135
136
137
|
# File 'app/models/katello/content_view.rb', line 134
def self.in_environment(env)
joins(:content_view_environments).
where("#{Katello::ContentViewEnvironment.table_name}.environment_id = ?", env.id)
end
|
.in_organization(org) ⇒ Object
143
144
145
|
# File 'app/models/katello/content_view.rb', line 143
def self.in_organization(org)
where(organization_id: org.id) unless org.nil?
end
|
.published_with_repositories(root_repository) ⇒ Object
139
140
141
|
# File 'app/models/katello/content_view.rb', line 139
def self.published_with_repositories(root_repository)
joins(:content_view_versions => :repositories).where("katello_repositories.root_id" => root_repository.id).uniq
end
|
Instance Method Details
#add_components(components_to_add) ⇒ Object
Adds content view components based on the input
- :latest=> false, :latest=> true ..
181
182
183
184
185
|
# File 'app/models/katello/content_view.rb', line 181
def add_components(components_to_add)
components_to_add.each do |cvc|
content_view_components.build(cvc)
end
end
|
#add_environment(env, version) ⇒ Object
Associate an environment with this content view. This can occur whenever a version of the view is promoted to an environment. It is necessary for candlepin to become aware that the view is available for consumers.
547
548
549
550
551
552
553
554
555
556
557
558
|
# File 'app/models/katello/content_view.rb', line 547
def add_environment(env, version)
if self.content_view_environments.where(:environment_id => env.id).empty?
label = generate_cp_environment_label(env)
ContentViewEnvironment.create!(:name => label,
:label => label,
:cp_id => generate_cp_environment_id(env),
:environment_id => env.id,
:content_view => self,
:content_view_version => version
)
end
end
|
#all_version_library_instances ⇒ Object
get the library instances of all repos within this view
461
462
463
464
465
|
# File 'app/models/katello/content_view.rb', line 461
def all_version_library_instances
all_repos = all_version_repos.where(:library_instance_id => nil).pluck("#{Katello::Repository.table_name}.id")
all_repos += all_version_repos.pluck(:library_instance_id)
Repository.where(:id => all_repos)
end
|
#all_version_repos ⇒ Object
358
359
360
361
|
# File 'app/models/katello/content_view.rb', line 358
def all_version_repos
Repository.joins(:content_view_version).
where("#{Katello::ContentViewVersion.table_name}.content_view_id" => self.id)
end
|
#as_json(options = {}) ⇒ Object
NOTE: this function will most likely become obsolete once we drop api v1
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
# File 'app/models/katello/content_view.rb', line 264
def as_json(options = {})
result = self.attributes
result['organization'] = self.organization.try(:name)
result['environments'] = environments.map { |e| e.try(:name) }
result['versions'] = versions.map(&:version)
result['versions_details'] = versions.map do |v|
{
:version => v.version,
:published => v.created_at.to_s,
:environments => v.environments.map { |e| e.name }
}
end
if options && options[:environment].present?
result['repositories'] = repos(options[:environment]).map(&:name)
end
result
end
|
#auto_publish_components ⇒ Object
408
409
410
|
# File 'app/models/katello/content_view.rb', line 408
def auto_publish_components
component_composites.where(latest: true).joins(:composite_content_view).where(self.class.table_name => { auto_publish: true })
end
|
#check_composite_action_allowed!(env) ⇒ Object
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
|
# File 'app/models/katello/content_view.rb', line 630
def check_composite_action_allowed!(env)
if composite? && Setting['restrict_composite_view']
if components.size != content_view_components.size
fail _("Make sure all the component content views are published before publishing/promoting the composite content view. "\
"This restriction is optional and can be modified in the Administrator -> Settings -> Content "\
"page using the restrict_composite_view flag.")
end
env_ids = env.try(:pluck, 'id') || []
env_ids << env.id unless env_ids.size > 0
components.each do |component|
component_environment_ids = component.environments.pluck('id')
unless (env_ids - component_environment_ids).empty?
fail _("The action requested on this composite view cannot be performed until all of the "\
"component content view versions have been promoted to the target environment: %{env}. "\
"This restriction is optional and can be modified in the Administrator -> Settings -> Content "\
"page using the restrict_composite_view flag.") %
{ :env => env.try(:pluck, 'name') || env.name }
end
end
end
true
end
|
#check_default_label_name ⇒ Object
521
522
523
524
525
|
# File 'app/models/katello/content_view.rb', line 521
def check_default_label_name
if default? && !(name == 'Default Organization View' && label == 'Default_Organization_View')
errors.add(:base, _("Name and label of default content view should not be changed"))
end
end
|
#check_docker_conflicts ⇒ Object
527
528
529
530
531
532
|
# File 'app/models/katello/content_view.rb', line 527
def check_docker_conflicts
duplicate_docker_repos.each do |repo|
msg = _("Container Image repo '%{repo}' is present in multiple component content views.") % { repo: repo.name }
errors.add(:base, msg)
end
end
|
#check_docker_repository_names!(environments) ⇒ Object
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
|
# File 'app/models/katello/content_view.rb', line 613
def check_docker_repository_names!(environments)
environments.each do |environment|
repositories = []
publish_repositories do |all_repositories|
repositories += all_repositories.keep_if { |repository| repository.content_type == Katello::Repository::DOCKER_TYPE }
end
next if repositories.empty?
error_messages = ::Katello::Validators::EnvironmentDockerRepositoriesValidator.validate_repositories(environment.registry_name_pattern, repositories)
unless error_messages.empty?
error_messages << _("Consider changing the Lifecycle Environment's Registry Name Pattern to something more specific.")
fail error_messages.join(" ")
end
end
true
end
|
#check_non_composite_auto_publish ⇒ Object
515
516
517
518
519
|
# File 'app/models/katello/content_view.rb', line 515
def check_non_composite_auto_publish
if !composite? && auto_publish
errors.add(:base, _("Cannot set auto publish to a non-composite content view"))
end
end
|
#check_non_composite_components ⇒ Object
509
510
511
512
513
|
# File 'app/models/katello/content_view.rb', line 509
def check_non_composite_components
if !composite? && components.present?
errors.add(:base, _("Cannot add component versions to a non-composite content view"))
end
end
|
#check_orphaned_content_facets!(environments: []) ⇒ Object
654
655
656
657
658
659
660
661
662
663
664
665
666
667
|
# File 'app/models/katello/content_view.rb', line 654
def check_orphaned_content_facets!(environments: [])
Location.no_taxonomy_scope do
User.as_anonymous_admin do
::Katello::Host::ContentFacet.in_content_views_and_environments(
content_views: [self],
lifecycle_environments: environments
).each do |facet|
unless facet.host
fail _("Orphaned content facets for deleted hosts exist for the content view and environment. Please run rake task : katello:clean_orphaned_facets and try again!")
end
end
end
end
end
|
#check_ready_to_destroy! ⇒ Object
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
|
# File 'app/models/katello/content_view.rb', line 687
def check_ready_to_destroy!
errors = []
dependencies = { environments: _("environments"),
hosts: _("hosts"),
activation_keys: _("activation keys")
}
dependencies.each do |key, name|
if (models = self.association(key).scope).any?
errors << _("Cannot delete '%{view}' due to associated %{dependent}: %{names}.") %
{ view: self.name, dependent: name, names: models.map(&:name).join(", ") }
end
end
fail errors.join(" ") if errors.any?
return true
end
|
#check_ready_to_import! ⇒ Object
591
592
593
594
595
|
# File 'app/models/katello/content_view.rb', line 591
def check_ready_to_import!
fail _("Cannot import a composite content view") if composite?
fail _("This Content View must be set to Import-only before performing an import") unless import_only?
true
end
|
#check_ready_to_publish!(importing: false, syncable: false) ⇒ Object
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
|
# File 'app/models/katello/content_view.rb', line 597
def check_ready_to_publish!(importing: false, syncable: false)
fail _("User must be logged in.") if ::User.current.nil?
fail _("Cannot publish default content view") if default?
if importing
check_ready_to_import!
else
fail _("Import-only content views can not be published directly") if import_only? && !syncable
check_composite_action_allowed!(organization.library)
check_docker_repository_names!([organization.library])
check_orphaned_content_facets!(environments: self.environments)
end
true
end
|
#check_remove_from_environment!(env) ⇒ Object
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
|
# File 'app/models/katello/content_view.rb', line 669
def check_remove_from_environment!(env)
errors = []
dependencies = { hosts: _("hosts"),
activation_keys: _("activation keys")
}
dependencies.each do |key, name|
if (models = self.association(key).scope.in_environment(env)).any?
errors << _("Cannot remove '%{view}' from environment '%{env}' due to associated %{dependent}: %{names}.") %
{ view: self.name, env: env.name, dependent: name, names: models.map(&:name).join(", ") }
end
end
fail errors.join(" ") if errors.any?
return true
end
|
#component_ids ⇒ Object
171
172
173
|
# File 'app/models/katello/content_view.rb', line 171
def component_ids
components.map(&:id)
end
|
#component_ids=(component_version_ids_to_set) ⇒ Object
Warning this call wipes out existing associations And replaces them with the component version ids passed in.
195
196
197
198
199
200
201
202
203
|
# File 'app/models/katello/content_view.rb', line 195
def component_ids=(component_version_ids_to_set)
content_view_components.destroy_all
component_version_ids_to_set.each do |content_view_version_id|
cvv = ContentViewVersion.find(content_view_version_id)
content_view_components.build(:content_view_version => cvv,
:latest => false,
:composite_content_view => self)
end
end
|
#component_repositories ⇒ Object
438
439
440
|
# File 'app/models/katello/content_view.rb', line 438
def component_repositories
components.map(&:archived_repos).flatten
end
|
#component_repository_ids ⇒ Object
442
443
444
|
# File 'app/models/katello/content_view.rb', line 442
def component_repository_ids
component_repositories.map(&:id)
end
|
#components ⇒ Object
175
176
177
|
# File 'app/models/katello/content_view.rb', line 175
def components
content_view_components.map(&:latest_version).compact.freeze
end
|
#components_with_repo(library_instance) ⇒ Object
404
405
406
|
# File 'app/models/katello/content_view.rb', line 404
def components_with_repo(library_instance)
components.select { |component| component.repositories.where(:library_instance => library_instance).any? }
end
|
#content_host_count ⇒ Object
167
168
169
|
# File 'app/models/katello/content_view.rb', line 167
def content_host_count
hosts.count
end
|
#content_view_environment(environment) ⇒ Object
534
535
536
|
# File 'app/models/katello/content_view.rb', line 534
def content_view_environment(environment)
self.content_view_environments.where(:environment_id => environment.try(:id)).first
end
|
#copy(new_name) ⇒ Object
240
241
242
243
244
245
246
247
248
249
250
251
252
|
# File 'app/models/katello/content_view.rb', line 240
def copy(new_name)
new_view = ContentView.new
new_view.name = new_name
new_view.attributes = self.attributes.slice("description", "organization_id", "default", "composite", "solve_dependencies")
new_view.save!
new_view.repositories = self.repositories
copy_components(new_view)
copy_filters(new_view)
new_view.save!
new_view
end
|
#copy_components(new_view) ⇒ Object
205
206
207
208
209
210
211
|
# File 'app/models/katello/content_view.rb', line 205
def copy_components(new_view)
self.content_view_components.each do |cvc|
component = cvc.dup
component.composite_content_view = new_view
new_view.content_view_components << component
end
end
|
#copy_filters(new_view) ⇒ Object
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
# File 'app/models/katello/content_view.rb', line 213
def copy_filters(new_view)
self.filters.each do |filter|
new_filter = filter.dup
new_filter.repositories = filter.repositories
new_view.filters << new_filter
case filter.type
when ContentViewDebFilter.name
filter.deb_rules.each do |rule|
new_filter.deb_rules << rule.dup
end
when ContentViewPackageFilter.name
filter.package_rules.each do |rule|
new_filter.package_rules << rule.dup
end
when ContentViewPackageGroupFilter.name
filter.package_group_rules.each do |rule|
new_filter.package_group_rules << rule.dup
end
when ContentViewErratumFilter.name
filter.erratum_rules.each do |rule|
new_filter.erratum_rules << rule.dup
end
end
end
end
|
#cp_environment_id(env) ⇒ Object
576
577
578
|
# File 'app/models/katello/content_view.rb', line 576
def cp_environment_id(env)
ContentViewEnvironment.where(:content_view_id => self, :environment_id => env).first.try(:cp_id)
end
|
#cp_environment_label(env) ⇒ Object
572
573
574
|
# File 'app/models/katello/content_view.rb', line 572
def cp_environment_label(env)
ContentViewEnvironment.where(:content_view_id => self, :environment_id => env).first.try(:label)
end
|
#create_new_version(major = next_version, minor = 0, components = self.components) ⇒ Object
580
581
582
583
584
585
586
587
588
589
|
# File 'app/models/katello/content_view.rb', line 580
def create_new_version(major = next_version, minor = 0, components = self.components)
version = ContentViewVersion.create!(:major => major,
:minor => minor,
:content_view => self,
:components => components
)
update(:next_version => major.to_i + 1) unless major.to_i < next_version
version
end
|
#delete(from_env) ⇒ Object
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
|
# File 'app/models/katello/content_view.rb', line 474
def delete(from_env)
if from_env.library? && in_non_library_environment?
fail Errors::ChangesetContentException, _("Cannot delete view while it exists in environments")
end
version = self.version(from_env)
if version.nil?
fail Errors::ChangesetContentException, _("Cannot delete from %s, view does not exist there.") % from_env.name
end
version = ContentViewVersion.find(version.id)
if (foreman_env = Environment.find_by_katello_id(self.organization, from_env, self))
foreman_env.destroy
end
version.delete(from_env)
self.destroy if self.versions.empty?
end
|
#duplicate_docker_repos ⇒ Object
505
506
507
|
# File 'app/models/katello/content_view.rb', line 505
def duplicate_docker_repos
duplicate_repositories.docker_type
end
|
#duplicate_repositories ⇒ Object
497
498
499
500
501
502
503
|
# File 'app/models/katello/content_view.rb', line 497
def duplicate_repositories
counts = repositories_to_publish.each_with_object(Hash.new(0)) do |repo, h|
h[repo.library_instance_id] += 1
end
ids = counts.select { |_k, v| v > 1 }.keys
Repository.where(:id => ids)
end
|
#duplicate_repositories_to_publish ⇒ Object
399
400
401
402
|
# File 'app/models/katello/content_view.rb', line 399
def duplicate_repositories_to_publish
return [] unless composite?
repositories_to_publish_by_library_instance.select { |key, val| val.count > 1 && key.present? }.keys
end
|
#generated? ⇒ Boolean
259
260
261
|
# File 'app/models/katello/content_view.rb', line 259
def generated?
!generated_for_none?
end
|
#generated_for_library? ⇒ Boolean
163
164
165
|
# File 'app/models/katello/content_view.rb', line 163
def generated_for_library?
generated_for_library_export? || generated_for_library_import?
end
|
#generated_for_repository? ⇒ Boolean
159
160
161
|
# File 'app/models/katello/content_view.rb', line 159
def generated_for_repository?
generated_for_repository_export? || generated_for_repository_import?
end
|
#get_repo_clone(env, repo) ⇒ Object
467
468
469
470
471
472
|
# File 'app/models/katello/content_view.rb', line 467
def get_repo_clone(env, repo)
lib_id = repo.library_instance_id || repo.id
Repository.in_environment(env).where(:library_instance_id => lib_id).
joins(:content_view_version).
where("#{Katello::ContentViewVersion.table_name}.content_view_id" => self.id)
end
|
#history ⇒ Object
326
327
328
329
|
# File 'app/models/katello/content_view.rb', line 326
def history
Katello::ContentViewHistory.joins(:content_view_version).where(
"#{Katello::ContentViewVersion.table_name}.content_view_id" => self.id)
end
|
#in_environment?(env) ⇒ Boolean
292
293
294
|
# File 'app/models/katello/content_view.rb', line 292
def in_environment?(env)
environments.include?(env)
end
|
#in_non_library_environment? ⇒ Boolean
493
494
495
|
# File 'app/models/katello/content_view.rb', line 493
def in_non_library_environment?
environments.where(:library => false).length > 0
end
|
#last_task ⇒ Object
321
322
323
324
|
# File 'app/models/katello/content_view.rb', line 321
def last_task
last_task_id = history.order(:created_at)&.last&.task_id
last_task_id ? ForemanTasks::Task.find_by(id: last_task_id) : nil
end
|
#latest_version ⇒ Object
305
306
307
|
# File 'app/models/katello/content_view.rb', line 305
def latest_version
latest_version_object.try(:version)
end
|
#latest_version_env ⇒ Object
313
314
315
|
# File 'app/models/katello/content_view.rb', line 313
def latest_version_env
latest_version_object.try(:environments) || []
end
|
#latest_version_id ⇒ Object
309
310
311
|
# File 'app/models/katello/content_view.rb', line 309
def latest_version_id
latest_version_object.try(:id)
end
|
#latest_version_object ⇒ Object
317
318
319
|
# File 'app/models/katello/content_view.rb', line 317
def latest_version_object
self.versions.order('major DESC').order('minor DESC').first
end
|
#library_export? ⇒ Boolean
155
156
157
|
# File 'app/models/katello/content_view.rb', line 155
def library_export?
name.start_with? EXPORT_LIBRARY
end
|
#library_import? ⇒ Boolean
151
152
153
|
# File 'app/models/katello/content_view.rb', line 151
def library_import?
name == IMPORT_LIBRARY
end
|
#library_repo_ids ⇒ Object
354
355
356
|
# File 'app/models/katello/content_view.rb', line 354
def library_repo_ids
repos(self.organization.library).map { |r| r.library_instance_id }
end
|
#library_repos ⇒ Object
350
351
352
|
# File 'app/models/katello/content_view.rb', line 350
def library_repos
Repository.where(:id => library_repo_ids)
end
|
#on_demand_repositories ⇒ Object
714
715
716
|
# File 'app/models/katello/content_view.rb', line 714
def on_demand_repositories
repositories.on_demand
end
|
#products(env = nil) ⇒ Object
455
456
457
458
|
# File 'app/models/katello/content_view.rb', line 455
def products(env = nil)
repos = repos(env)
Product.joins(:repositories).where("#{Katello::Repository.table_name}.id" => repos.map(&:id)).distinct
end
|
254
255
256
257
|
# File 'app/models/katello/content_view.rb', line 254
def promoted?
self.environments.many?
end
|
#publish_repositories(override_components = nil) ⇒ Object
412
413
414
415
416
417
418
419
420
421
|
# File 'app/models/katello/content_view.rb', line 412
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
|
726
727
728
729
730
731
732
733
734
735
736
737
738
739
|
# File 'app/models/katello/content_view.rb', line 726
def related_composite_cvs
content_views = []
component_composites.each do |cv|
cv_id = cv.composite_content_view_id
cv_name = ContentView.find(cv_id).name
content_views.push(
{
id: cv_id,
name: cv_name
}
)
end
content_views
end
|
718
719
720
721
722
723
724
|
# File 'app/models/katello/content_view.rb', line 718
def related_cv_count
if composite
content_view_components.length
else
component_composites.length
end
end
|
#remove_components(components_to_remove) ⇒ Object
Removes selected content view components
- 1,2,34
-
> content view component ids/
189
190
191
|
# File 'app/models/katello/content_view.rb', line 189
def remove_components(components_to_remove)
content_view_components.where(:id => components_to_remove).destroy_all
end
|
#remove_environment(env) ⇒ Object
Unassociate an environment from this content view. This can occur whenever a view is deleted from an environment. It is necessary to make candlepin aware that the view is no longer available for consumers.
563
564
565
566
567
568
569
570
|
# File 'app/models/katello/content_view.rb', line 563
def remove_environment(env)
if self.versions.in_environment(env).blank?
view_env = self.content_view_environments.where(:environment_id => env.id)
view_env.first.destroy unless view_env.blank?
end
end
|
#repos(env = nil) ⇒ Object
341
342
343
344
345
346
347
348
|
# File 'app/models/katello/content_view.rb', line 341
def repos(env = nil)
if env
repo_ids = versions.flat_map { |version| version.repositories.in_environment(env) }.map(&:id)
else
repo_ids = versions.flat_map { |version| version.repositories }.map(&:id)
end
Repository.where(:id => repo_ids)
end
|
#repos_in_product(env, product) ⇒ Object
446
447
448
449
450
451
452
453
|
# File 'app/models/katello/content_view.rb', line 446
def repos_in_product(env, product)
version = version(env)
if version
version.repositories.in_environment(env).in_product(product)
else
[]
end
end
|
#repositories_to_publish(override_components = nil) ⇒ Object
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
|
# File 'app/models/katello/content_view.rb', line 363
def repositories_to_publish(override_components = nil)
if composite?
components_to_publish = []
components.each do |component|
override_component = override_components&.detect do |override_cvv|
override_cvv.content_view == component.content_view
end
if override_component
components_to_publish << override_component
else
components_to_publish << component
end
end
ids = components_to_publish.flat_map { |version| version.repositories.archived }.map(&:id)
Repository.where(:id => ids)
else
repositories
end
end
|
#repositories_to_publish_by_library_instance(override_components = nil) ⇒ Object
388
389
390
391
392
393
394
395
396
397
|
# File 'app/models/katello/content_view.rb', line 388
def repositories_to_publish_by_library_instance(override_components = nil)
repositories_to_publish(override_components).inject({}) do |result, repo|
result[repo.library_instance] ||= []
result[repo.library_instance] << repo
result
end
end
|
#repositories_to_publish_ids ⇒ Object
384
385
386
|
# File 'app/models/katello/content_view.rb', line 384
def repositories_to_publish_ids
composite? ? repositories_to_publish.pluck(&:id) : repository_ids
end
|
#resulting_products ⇒ Object
337
338
339
|
# File 'app/models/katello/content_view.rb', line 337
def resulting_products
(self.repositories.collect { |r| r.product }).uniq
end
|
#to_s ⇒ Object
147
148
149
|
# File 'app/models/katello/content_view.rb', line 147
def to_s
name
end
|
#total_deb_package_count(env) ⇒ Object
288
289
290
|
# File 'app/models/katello/content_view.rb', line 288
def total_deb_package_count(env)
Katello::Deb.in_repositories(self.repos(env)).count
end
|
#total_package_count(env) ⇒ Object
284
285
286
|
# File 'app/models/katello/content_view.rb', line 284
def total_package_count(env)
Katello::Rpm.in_repositories(self.repos(env)).count
end
|
#update_cp_content(env) ⇒ Object
538
539
540
541
542
|
# File 'app/models/katello/content_view.rb', line 538
def update_cp_content(env)
view_env = content_view_environment(env)
view_env&.update_cp_content
end
|
#update_host_statuses(environment) ⇒ Object
423
424
425
426
427
428
429
430
431
432
433
434
435
436
|
# File 'app/models/katello/content_view.rb', line 423
def update_host_statuses(environment)
Location.no_taxonomy_scope do
User.as_anonymous_admin do
::Katello::Host::ContentFacet.in_content_views_and_environments(
content_views: [self],
lifecycle_environments: [environment]
).each do |facet|
facet.update_applicability_counts
facet.update_errata_status
end
end
end
end
|
#version(env) ⇒ Object
301
302
303
|
# File 'app/models/katello/content_view.rb', line 301
def version(env)
self.versions.in_environment(env).order("#{Katello::ContentViewVersion.table_name}.id ASC").readonly(false).last
end
|
#version_count ⇒ Object
710
711
712
|
# File 'app/models/katello/content_view.rb', line 710
def version_count
content_view_versions.count
end
|
#version_environment(env) ⇒ Object
331
332
333
334
335
|
# File 'app/models/katello/content_view.rb', line 331
def version_environment(env)
version(env).content_view_version_environments.select { |cvve| cvve.environment_id == env.id }
end
|