katello 2.4.0.rc2 → 2.4.0.rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. data/app/controllers/katello/api/v2/activation_keys_controller.rb +14 -1
  2. data/app/controllers/katello/api/v2/api_controller.rb +0 -55
  3. data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +8 -6
  4. data/app/controllers/katello/api/v2/content_view_histories_controller.rb +23 -0
  5. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +0 -1
  6. data/app/controllers/katello/api/v2/content_views_controller.rb +0 -13
  7. data/app/controllers/katello/api/v2/environments_controller.rb +0 -1
  8. data/app/controllers/katello/api/v2/host_collections_controller.rb +0 -14
  9. data/app/controllers/katello/api/v2/subscriptions_controller.rb +20 -57
  10. data/app/controllers/katello/api/v2/sync_plans_controller.rb +0 -1
  11. data/app/controllers/katello/api/v2/systems_bulk_actions_controller.rb +0 -1
  12. data/app/controllers/katello/api/v2/systems_controller.rb +56 -38
  13. data/app/controllers/katello/application_controller.rb +2 -11
  14. data/app/controllers/katello/concerns/api/api_controller.rb +0 -8
  15. data/app/controllers/katello/concerns/api/v2/bulk_systems_extensions.rb +2 -14
  16. data/app/lib/actions/candlepin/import_pool_handler.rb +0 -1
  17. data/app/lib/actions/katello/content_view/remove.rb +0 -2
  18. data/app/lib/actions/katello/content_view_version/incremental_update.rb +2 -2
  19. data/app/lib/actions/katello/product/create.rb +1 -1
  20. data/app/lib/actions/{elastic_search → katello}/provider/reindex_subscriptions.rb +4 -2
  21. data/app/lib/actions/katello/repository/clone_docker_content.rb +1 -1
  22. data/app/lib/actions/katello/repository/clone_yum_content.rb +1 -1
  23. data/app/lib/actions/{elastic_search → katello}/repository/filtered_index_content.rb +4 -2
  24. data/app/lib/actions/katello/repository/finish_upload.rb +1 -1
  25. data/app/lib/actions/{elastic_search → katello}/repository/index_content.rb +4 -2
  26. data/app/lib/actions/katello/repository/sync.rb +1 -1
  27. data/app/lib/actions/katello/subscription/subscribe.rb +26 -0
  28. data/app/lib/actions/katello/system/auto_attach_subscriptions.rb +4 -2
  29. data/app/lib/actions/katello/system/create.rb +2 -4
  30. data/app/lib/actions/katello/system/destroy.rb +6 -1
  31. data/app/lib/actions/katello/system/update.rb +1 -2
  32. data/app/lib/actions/pulp/abstract_async_task.rb +6 -5
  33. data/app/lib/katello/resources/candlepin.rb +5 -2
  34. data/app/lib/katello/util/support.rb +1 -2
  35. data/app/models/katello/concerns/organization_extensions.rb +1 -18
  36. data/app/models/katello/content_view.rb +0 -2
  37. data/app/models/katello/content_view_erratum_filter_rule.rb +0 -2
  38. data/app/models/katello/content_view_history.rb +2 -2
  39. data/app/models/katello/content_view_package_filter_rule.rb +0 -2
  40. data/app/models/katello/content_view_package_group_filter_rule.rb +0 -2
  41. data/app/models/katello/glue/candlepin/activation_key.rb +2 -2
  42. data/app/models/katello/glue/candlepin/pool.rb +20 -8
  43. data/app/models/katello/glue/provider.rb +2 -7
  44. data/app/models/katello/glue/pulp/repo.rb +0 -1
  45. data/app/models/katello/host_collection.rb +1 -14
  46. data/app/models/katello/hypervisor.rb +0 -1
  47. data/app/models/katello/job.rb +0 -7
  48. data/app/models/katello/kt_environment.rb +4 -0
  49. data/app/models/katello/ping.rb +2 -10
  50. data/app/models/katello/pool.rb +0 -3
  51. data/app/models/katello/pulp_sync_status.rb +0 -2
  52. data/app/models/katello/pulp_task_status.rb +0 -1
  53. data/app/models/katello/rhsm_fact_importer.rb +42 -0
  54. data/app/models/katello/rhsm_fact_name.rb +9 -0
  55. data/app/models/katello/rhsm_fact_parser.rb +28 -0
  56. data/app/models/katello/system.rb +41 -43
  57. data/app/models/katello/task_status.rb +0 -2
  58. data/app/presenters/katello/activation_key_subscription_presenter.rb +10 -0
  59. data/app/presenters/katello/system_subscription_presenter.rb +10 -0
  60. data/app/views/katello/api/v2/activation_keys/subscriptions.json.rabl +2 -1
  61. data/app/views/katello/api/v2/ping/show.json.rabl +1 -1
  62. data/app/views/katello/api/v2/subscriptions/base.json.rabl +10 -1
  63. data/app/views/katello/api/v2/subscriptions/show.json.rabl +1 -2
  64. data/app/views/katello/api/v2/systems/subscriptions.json.rabl +8 -0
  65. data/config/katello.yaml.example +0 -10
  66. data/config/routes/api/v2.rb +14 -3
  67. data/db/migrate/20151015152947_add_virt_only_to_katello_pools.rb +11 -0
  68. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-add-subscriptions.controller.js +2 -1
  69. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-subscriptions.controller.js +2 -2
  70. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-add-subscriptions.html +4 -4
  71. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-subscriptions-list.html +15 -5
  72. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host.factory.js +2 -1
  73. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-add-subscriptions.controller.js +2 -1
  74. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-base-subscriptions.controller.js +0 -2
  75. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-subscriptions.controller.js +2 -3
  76. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-add-subscriptions.html +4 -4
  77. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-subscriptions-list.html +14 -5
  78. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-view.factory.js +0 -1
  79. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +1 -1
  80. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/{content-view-details-history.controller.js → histories/content-view-history.controller.js} +5 -5
  81. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/histories/content-view-history.factory.js +22 -0
  82. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/{views/content-view-details-history.html → histories/views/content-view-history.html} +0 -0
  83. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js +9 -2
  84. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/grouped.filter.js +21 -0
  85. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/subscriptionAttachAmountFilter.filter.js +1 -1
  86. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/subscriptions-table-full.html +1 -1
  87. data/lib/katello.rb +0 -3
  88. data/lib/katello/engine.rb +3 -8
  89. data/lib/katello/permissions/content_host_permissions.rb +1 -1
  90. data/lib/katello/permissions/content_view_permissions.rb +2 -1
  91. data/lib/katello/plugin.rb +0 -1
  92. data/lib/katello/tasks/clean_backend_objects.rake +0 -1
  93. data/lib/katello/tasks/reindex.rake +5 -2
  94. data/lib/katello/tasks/setup.rake +0 -9
  95. data/lib/katello/version.rb +1 -1
  96. metadata +1460 -1449
  97. checksums.yaml +0 -7
  98. data/app/lib/actions/elastic_search/abstract.rb +0 -8
  99. data/app/lib/actions/elastic_search/reindex.rb +0 -26
  100. data/app/lib/actions/elastic_search/reindex_on_association_change.rb +0 -25
  101. data/app/lib/actions/elastic_search/repository/remove_packages.rb +0 -16
  102. data/app/lib/actions/middleware/elasticsearch_services_check.rb +0 -9
  103. data/app/models/katello/ext/indexed_model.rb +0 -173
  104. data/app/models/katello/glue/elastic_search/backend_indexed_model.rb +0 -113
  105. data/app/models/katello/glue/elastic_search/content_view_erratum_filter_rule.rb +0 -31
  106. data/app/models/katello/glue/elastic_search/content_view_history.rb +0 -31
  107. data/app/models/katello/glue/elastic_search/content_view_package_filter_rule.rb +0 -32
  108. data/app/models/katello/glue/elastic_search/content_view_package_group_filter_rule.rb +0 -29
  109. data/app/models/katello/glue/elastic_search/facet_item.rb +0 -9
  110. data/app/models/katello/glue/elastic_search/host_collection.rb +0 -10
  111. data/app/models/katello/glue/elastic_search/items.rb +0 -196
  112. data/app/models/katello/glue/elastic_search/job.rb +0 -23
  113. data/app/models/katello/glue/elastic_search/system.rb +0 -153
  114. data/app/models/katello/glue/elastic_search/task_status.rb +0 -52
  115. data/lib/katello/tire_bridge.rb +0 -20
@@ -489,11 +489,7 @@ module Katello
489
489
 
490
490
  start ||= 0
491
491
 
492
- if search.nil? || search == ''
493
- all_rows = true
494
- elsif search_options[:simple_query] && !SETTINGS[:katello][:simple_search_tokens].any? { |s| search.downcase.match(s) }
495
- search = search_options[:simple_query]
496
- end
492
+ all_rows = true if (search.nil? || search == '')
497
493
  #search = Util::Search::filter_input search
498
494
 
499
495
  # set the query default field, if one was provided.
@@ -547,13 +543,8 @@ module Katello
547
543
  from 0
548
544
  end
549
545
  total_count = total.total
550
-
551
- rescue Tire::Search::SearchRequestFailed => e
552
- Rails.logger.error(e.class)
553
-
554
- total_count = 0
555
- panel_options[:total_results] = 0
556
546
  end
547
+
557
548
  render_panel_results(@items, total_count, panel_options) unless skip_render
558
549
  return @items
559
550
  end
@@ -16,14 +16,6 @@ module Katello
16
16
  User.current
17
17
  end
18
18
 
19
- def load_search_service(service = nil)
20
- if service.nil?
21
- @search_service ||= Glue::ElasticSearch::Items.new
22
- else
23
- @search_service ||= service
24
- end
25
- end
26
-
27
19
  protected
28
20
 
29
21
  def request_from_katello_cli?
@@ -18,10 +18,8 @@ module Katello
18
18
  end
19
19
 
20
20
  if bulk_params[:included][:search]
21
- ids = find_system_ids_by_search(bulk_params[:included][:search], organization)
22
- search_systems = System.send(perm_method).where(:id => ids)
23
- search_systems = search_systems.where('uuid not in (?)', bulk_params[:excluded][:ids]) unless bulk_params[:excluded][:ids].blank?
24
- search_systems = restrict_to.call(search_systems) if restrict_to
21
+ search_systems = System.where(:id => Organization.find(params[:organization_id]).systems.map(&:id)) if params[:organization_id]
22
+ search_systems = search_systems.search_for(bulk_params[:included][:search])
25
23
  @systems += search_systems
26
24
  end
27
25
 
@@ -33,16 +31,6 @@ module Katello
33
31
  @systems
34
32
  end
35
33
 
36
- def find_system_ids_by_search(search, organization)
37
- options = {
38
- :filters => System.readable_search_filters(organization),
39
- :load_records? => false,
40
- :full_result => true,
41
- :fields => [:id]
42
- }
43
- item_search(System, {:search => search}, options)[:results].collect { |i| i.id }
44
- end
45
-
46
34
  def find_organization
47
35
  Organization.find_by_id(params[:organization_id])
48
36
  end
@@ -73,7 +73,6 @@ module Actions
73
73
  @logger.debug "skip re-indexing of non-existent content host #{uuid}"
74
74
  else
75
75
  @logger.debug "re-indexing content host #{system.name}"
76
- system.update_index
77
76
  end
78
77
  end
79
78
  end
@@ -17,7 +17,6 @@ module Actions
17
17
  cv_envs = options.fetch(:content_view_environments, [])
18
18
  versions = options.fetch(:content_view_versions, [])
19
19
  organization_destroy = options.fetch(:organization_destroy, false)
20
- skip_elastic = options.fetch(:skip_elastic, false)
21
20
  skip_repo_destroy = options.fetch(:skip_repo_destroy, false)
22
21
  action_subject(content_view)
23
22
  validate_options(content_view, cv_envs, versions, options) unless organization_destroy
@@ -45,7 +44,6 @@ module Actions
45
44
  :task => self.task)
46
45
  plan_action(ContentViewEnvironment::Destroy,
47
46
  cve,
48
- :skip_elastic => skip_elastic,
49
47
  :skip_repo_destroy => skip_repo_destroy,
50
48
  :organization_destroy => organization_destroy)
51
49
  end
@@ -59,7 +59,7 @@ module Actions
59
59
  copy_output = copy_yum_content(new_repo, dep_solve, content[:package_ids], content[:errata_ids])
60
60
 
61
61
  plan_action(Katello::Repository::MetadataGenerate, new_repo, nil)
62
- plan_action(ElasticSearch::Repository::IndexContent, id: new_repo.id)
62
+ plan_action(Katello::Repository::IndexContent, id: new_repo.id)
63
63
  end
64
64
  copy_output
65
65
  end
@@ -180,7 +180,7 @@ module Actions
180
180
  unless puppet_module_uuids.blank?
181
181
  remove_puppet_names(new_repo, puppet_module_names(puppet_module_uuids))
182
182
  copy_outputs = puppet_module_uuids.map { |uuid| copy_puppet_module(new_repo, uuid).output }
183
- plan_action(ElasticSearch::ContentViewPuppetEnvironment::IndexContent, id: new_repo.id)
183
+ plan_action(Pulp::ContentViewPuppetEnvironment::IndexContent, id: new_repo.id)
184
184
  end
185
185
  copy_outputs
186
186
  end
@@ -20,7 +20,7 @@ module Actions
20
20
  action_subject product, :cp_id => cp_id
21
21
 
22
22
  plan_self
23
- plan_action ElasticSearch::Provider::ReindexSubscriptions, product.provider
23
+ plan_action Katello::Provider::ReindexSubscriptions, product.provider
24
24
  end
25
25
 
26
26
  def finalize
@@ -1,7 +1,9 @@
1
1
  module Actions
2
- module ElasticSearch
2
+ module Katello
3
3
  module Provider
4
- class ReindexSubscriptions < ElasticSearch::Abstract
4
+ class ReindexSubscriptions < Actions::EntryAction
5
+ middleware.use Actions::Middleware::KeepCurrentUser
6
+
5
7
  input_format do
6
8
  param :id
7
9
  end
@@ -11,7 +11,7 @@ module Actions
11
11
  source_pulp_id: source_repo.pulp_id,
12
12
  target_pulp_id: target_repo.pulp_id)
13
13
  plan_action(Katello::Repository::MetadataGenerate, target_repo)
14
- plan_action(ElasticSearch::Repository::IndexContent, id: target_repo.id)
14
+ plan_action(Katello::Repository::IndexContent, id: target_repo.id)
15
15
  end
16
16
  end
17
17
  end
@@ -46,7 +46,7 @@ module Actions
46
46
  end
47
47
 
48
48
  plan_action(Katello::Repository::MetadataGenerate, target_repo, filters.empty? ? source_repo : nil) if generate_metadata
49
- plan_action(ElasticSearch::Repository::IndexContent, id: target_repo.id) if index_content
49
+ plan_action(Katello::Repository::IndexContent, id: target_repo.id) if index_content
50
50
  end
51
51
  end
52
52
 
@@ -1,7 +1,9 @@
1
1
  module Actions
2
- module ElasticSearch
2
+ module Katello
3
3
  module Repository
4
- class FilteredIndexContent < ElasticSearch::Abstract
4
+ class FilteredIndexContent < Actions::EntryAction
5
+ middleware.use Actions::Middleware::KeepCurrentUser
6
+
5
7
  input_format do
6
8
  param :id, Integer
7
9
  param :filter
@@ -8,7 +8,7 @@ module Actions
8
8
  end
9
9
 
10
10
  recent_range = 5.minutes.ago.iso8601
11
- plan_action(ElasticSearch::Repository::FilteredIndexContent,
11
+ plan_action(Katello::Repository::FilteredIndexContent,
12
12
  id: repository.id,
13
13
  filter: {:association => {:created => {"$gt" => recent_range}}},
14
14
  dependency: dependency)
@@ -1,7 +1,9 @@
1
1
  module Actions
2
- module ElasticSearch
2
+ module Katello
3
3
  module Repository
4
- class IndexContent < ElasticSearch::Abstract
4
+ class IndexContent < Actions::EntryAction
5
+ middleware.use Actions::Middleware::KeepCurrentUser
6
+
5
7
  input_format do
6
8
  param :id, Integer
7
9
  param :dependency, Hash
@@ -23,7 +23,7 @@ module Actions
23
23
 
24
24
  sequence do
25
25
  sync_task = plan_action(Pulp::Repository::Sync, pulp_id: repo.pulp_id, task_id: pulp_sync_task_id)
26
- plan_action(ElasticSearch::Repository::IndexContent, dependency: sync_task.output[:pulp_tasks], id: repo.id)
26
+ plan_action(Katello::Repository::IndexContent, dependency: sync_task.output[:pulp_tasks], id: repo.id)
27
27
  plan_action(Katello::Foreman::ContentUpdate, repo.environment, repo.content_view, repo)
28
28
  plan_action(Katello::Repository::CorrectChecksum, repo)
29
29
  concurrence do
@@ -0,0 +1,26 @@
1
+ module Actions
2
+ module Katello
3
+ module Subscription
4
+ class Subscribe < Actions::Base
5
+ def plan(system_id, cp_id, quantity)
6
+ plan_self(:user_id => ::User.current.id,
7
+ :quantity => quantity,
8
+ :cp_id => cp_id,
9
+ :system_id => system_id)
10
+ end
11
+
12
+ def run
13
+ ::User.current = User.find(input[:user_id])
14
+ ::Katello::System.find(input[:system_id]).subscribe(input[:cp_id], input[:quantity])
15
+ end
16
+
17
+ def finalize
18
+ ::User.current = User.find(input[:user_id])
19
+ ::Katello::Pool.find_by_cp_id(input[:cp_id]).import_data
20
+ ensure
21
+ ::User.current = nil
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -5,10 +5,12 @@ module Actions
5
5
  middleware.use ::Actions::Middleware::RemoteAction
6
6
 
7
7
  def plan(system)
8
- system.disable_auto_reindex!
9
8
  action_subject system
10
9
  plan_action(::Actions::Candlepin::Consumer::AutoAttachSubscriptions, system) if ::SETTINGS[:katello][:use_cp]
11
- plan_action(ElasticSearch::Reindex, system) if ::SETTINGS[:katello][:use_elasticsearch]
10
+ end
11
+
12
+ def finalize
13
+ ::Katello::Pool.import_all
12
14
  end
13
15
  end
14
16
  end
@@ -5,8 +5,6 @@ module Actions
5
5
  middleware.use ::Actions::Middleware::RemoteAction
6
6
 
7
7
  def plan(system, activation_keys = [])
8
- system.disable_auto_reindex!
9
-
10
8
  unless activation_keys.empty?
11
9
  activation_key_plan = plan_action(Katello::System::ActivationKeys, system, activation_keys)
12
10
  return if activation_key_plan.error
@@ -31,6 +29,8 @@ module Actions
31
29
  system.save!
32
30
  action_subject system
33
31
 
32
+ system.update_foreman_facts
33
+
34
34
  connect_to_smart_proxy(system)
35
35
 
36
36
  cp_create = plan_action(Candlepin::Consumer::Create, consumer_create_input)
@@ -40,7 +40,6 @@ module Actions
40
40
  plan_action(Pulp::Consumer::Create,
41
41
  uuid: cp_create.output[:response][:uuid],
42
42
  name: system.name)
43
- plan_action ElasticSearch::Reindex, system
44
43
  end
45
44
 
46
45
  def humanized_name
@@ -49,7 +48,6 @@ module Actions
49
48
 
50
49
  def finalize
51
50
  system = ::Katello::System.find(input[:system][:id])
52
- system.disable_auto_reindex!
53
51
  system.uuid = input[:uuid]
54
52
  system.save!
55
53
  end
@@ -5,6 +5,7 @@ module Actions
5
5
  middleware.use ::Actions::Middleware::RemoteAction
6
6
 
7
7
  def plan(system, options = {})
8
+ pool_ids = system.pools.map { |x| x["id"] }
8
9
  skip_candlepin = options.fetch(:skip_candlepin, false)
9
10
  skip_pulp = system.hypervisor?
10
11
  action_subject(system)
@@ -14,12 +15,16 @@ module Actions
14
15
  plan_action(Pulp::Consumer::Destroy, uuid: system.uuid) unless skip_pulp
15
16
  end
16
17
 
17
- plan_self(:system_id => system.id)
18
+ plan_self(:system_id => system.id, :pool_ids => pool_ids)
18
19
  end
19
20
 
20
21
  def finalize
21
22
  system = ::Katello::System.find(input[:system_id])
22
23
  system.destroy!
24
+ input[:pool_ids].each do |pool_id|
25
+ pool = ::Katello::Pool.where(:cp_id => pool_id).first
26
+ pool.import_data if pool
27
+ end
23
28
  end
24
29
 
25
30
  def humanized_name
@@ -5,9 +5,9 @@ module Actions
5
5
  middleware.use ::Actions::Middleware::RemoteAction
6
6
 
7
7
  def plan(system, sys_params)
8
- system.disable_auto_reindex!
9
8
  action_subject system
10
9
  system.update_attributes!(sys_params)
10
+ system.update_foreman_facts
11
11
  sequence do
12
12
  concurrence do
13
13
  plan_action(::Actions::Pulp::Consumer::Update, system) if !system.hypervisor? && ::SETTINGS[:katello][:use_pulp]
@@ -17,7 +17,6 @@ module Actions
17
17
  if sys_params[:autoheal] && ::SETTINGS[:katello][:use_cp]
18
18
  plan_action(::Actions::Candlepin::Consumer::AutoAttachSubscriptions, system)
19
19
  end
20
- plan_action(ElasticSearch::Reindex, system) if ::SETTINGS[:katello][:use_elasticsearch]
21
20
  end
22
21
  end
23
22
  end
@@ -66,6 +66,12 @@ module Actions
66
66
  end
67
67
 
68
68
  def done?
69
+ output[:pulp_tasks].each do |pulp_task|
70
+ if pulp_exception = ::Katello::Errors::PulpError.from_task(pulp_task)
71
+ fail pulp_exception
72
+ end
73
+ end
74
+
69
75
  external_task.all? { |task| task[:finish_time] || FINISHED_STATES.include?(task[:state]) }
70
76
  end
71
77
 
@@ -102,11 +108,6 @@ module Actions
102
108
 
103
109
  #Combine new tasks and remove call reports
104
110
  output[:pulp_tasks] = external_task_data.reject { |task| task['task_id'].nil? } + new_tasks
105
- output[:pulp_tasks].each do |pulp_task|
106
- if pulp_exception = ::Katello::Errors::PulpError.from_task(pulp_task)
107
- fail pulp_exception
108
- end
109
- end
110
111
  end
111
112
 
112
113
  def get_new_tasks(current_list, spawned_task_ids)
@@ -527,8 +527,11 @@ module Katello
527
527
  JSON.parse(pool_json).with_indifferent_access
528
528
  end
529
529
 
530
- def get_for_owner(owner_key)
531
- pools_json = self.get("/candlepin/owners/#{owner_key}/pools?attribute=unmapped_guests_only:!true", self.default_headers).body
530
+ def get_for_owner(owner_key, include_temporary_guests = false)
531
+ url_path = "/candlepin/owners/#{owner_key}/pools"
532
+ url_params = "?attribute=unmapped_guests_only:!true"
533
+ url = include_temporary_guests ? url_path : url_path + url_params
534
+ pools_json = self.get(url, self.default_headers).body
532
535
  JSON.parse(pools_json)
533
536
  end
534
537
 
@@ -88,8 +88,7 @@ module Katello
88
88
  # We need this so that we can return
89
89
  # empty search results on an invalid query
90
90
  # Basically this is a empty array with a total
91
- # method. We could ve user Tire::Result:Collection
92
- # But that class is way more involved
91
+ # method.
93
92
  def self.array_with_total(a = [])
94
93
  def a.total
95
94
  size
@@ -37,25 +37,8 @@ module Katello
37
37
  scoped_search :on => :label, :complete_value => :true
38
38
 
39
39
  after_create :associate_default_capsule
40
-
41
- validates :name, :uniqueness => true, :presence => true
42
- validates_with Validators::KatelloNameFormatValidator, :attributes => :name
43
- validates :label, :presence => true
44
40
  validates_with Validators::KatelloLabelFormatValidator, :attributes => :label
45
- validate :unique_name_and_label
46
-
47
- # Ensure that the name and label namespaces do not overlap
48
- def unique_name_and_label
49
- if new_record? && Organization.where("name = ? OR label = ?", name, label).any?
50
- errors.add(:organization, _("Names and labels must be unique across all organizations"))
51
- elsif label_changed? && Organization.where("id != ? AND label = ?", id, label).any?
52
- errors.add(:label, _("Names and labels must be unique across all organizations"))
53
- elsif name_changed? && Organization.where("id != ? AND name = ?", id, name).any?
54
- errors.add(:name, _("Names and labels must be unique across all organizations"))
55
- else
56
- true
57
- end
58
- end
41
+ validates :label, :uniqueness => true
59
42
 
60
43
  def default_content_view
61
44
  ContentView.default.where(:organization_id => self.id).first
@@ -227,8 +227,6 @@ module Katello
227
227
  end
228
228
 
229
229
  # Returns actual puppet modules associated with all components
230
- #
231
- # @returns array of ElasticSearch::Item objects
232
230
  def component_modules_to_publish
233
231
  composite? ? components.flat_map { |version| version.puppet_modules } : nil
234
232
  end
@@ -2,8 +2,6 @@ module Katello
2
2
  class ContentViewErratumFilterRule < Katello::Model
3
3
  self.include_root_in_json = false
4
4
 
5
- include Glue::ElasticSearch::ContentViewErratumFilterRule if SETTINGS[:katello][:use_elasticsearch]
6
-
7
5
  belongs_to :filter,
8
6
  :class_name => "Katello::ContentViewErratumFilter",
9
7
  :inverse_of => :erratum_rules,
@@ -2,8 +2,6 @@ module Katello
2
2
  class ContentViewHistory < Katello::Model
3
3
  include Katello::Authorization::ContentViewHistory
4
4
 
5
- include Glue::ElasticSearch::ContentViewHistory if SETTINGS[:katello][:use_elasticsearch]
6
-
7
5
  belongs_to :environment, :class_name => "Katello::KTEnvironment", :inverse_of => :content_view_histories,
8
6
  :foreign_key => :katello_environment_id
9
7
  belongs_to :content_view_version, :class_name => "Katello::ContentViewVersion", :foreign_key => :katello_content_view_version_id, :inverse_of => :history
@@ -21,6 +19,8 @@ module Katello
21
19
  scope :active, -> { where(:status => IN_PROGRESS) }
22
20
  alias_method :version, :content_view_version
23
21
 
22
+ scoped_search :on => :name, :in => :environment, :rename => :environment, :complete_value => true
23
+
24
24
  def content_view
25
25
  self.content_view_version.try(:content_view)
26
26
  end
@@ -2,8 +2,6 @@ module Katello
2
2
  class ContentViewPackageFilterRule < Katello::Model
3
3
  self.include_root_in_json = false
4
4
 
5
- include Glue::ElasticSearch::ContentViewPackageFilterRule if SETTINGS[:katello][:use_elasticsearch]
6
-
7
5
  belongs_to :filter,
8
6
  :class_name => "Katello::ContentViewPackageFilter",
9
7
  :inverse_of => :package_rules,