katello 3.0.0.rc4 → 3.0.0.rc5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of katello might be problematic. Click here for more details.

Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js +129 -47
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +2 -2
  4. data/app/controllers/katello/api/v2/activation_keys_controller.rb +9 -0
  5. data/app/controllers/katello/api/v2/api_controller.rb +13 -6
  6. data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +1 -1
  7. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +1 -1
  8. data/app/controllers/katello/api/v2/environments_controller.rb +0 -2
  9. data/app/controllers/katello/api/v2/host_collections_controller.rb +4 -2
  10. data/app/controllers/katello/api/v2/repositories_controller.rb +10 -4
  11. data/app/controllers/katello/api/v2/repository_sets_controller.rb +3 -3
  12. data/app/controllers/katello/api/v2/systems_controller.rb +4 -1
  13. data/app/controllers/katello/application_controller.rb +1 -1
  14. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +1 -1
  15. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +125 -3
  16. data/app/lib/actions/candlepin/owner/refresh_subscriptions.rb +15 -0
  17. data/app/lib/actions/katello/host/register.rb +2 -2
  18. data/app/lib/actions/katello/product/create.rb +20 -15
  19. data/app/lib/actions/katello/repository/clone_yum_content.rb +4 -3
  20. data/app/lib/actions/katello/repository/index_errata.rb +0 -3
  21. data/app/lib/actions/pulp/repository/purge_empty_errata.rb +2 -8
  22. data/app/lib/actions/pulp/repository/purge_empty_package_groups.rb +3 -5
  23. data/app/lib/katello/concerns/renderer_extensions.rb +1 -2
  24. data/app/lib/katello/resources/candlepin.rb +0 -1
  25. data/app/models/katello/concerns/host_managed_extensions.rb +7 -2
  26. data/app/models/katello/concerns/hostgroup_extensions.rb +6 -2
  27. data/app/models/katello/concerns/redhat_extensions.rb +11 -5
  28. data/app/models/katello/content_view.rb +0 -35
  29. data/app/models/katello/erratum.rb +2 -1
  30. data/app/models/katello/host/content_facet.rb +2 -1
  31. data/app/models/katello/repository.rb +26 -0
  32. data/app/models/katello/rhsm_fact_parser.rb +6 -2
  33. data/app/models/setting/katello.rb +2 -2
  34. data/app/overrides/add_activation_keys_input.rb +10 -0
  35. data/app/views/katello/api/v2/environments/show.json.rabl +1 -0
  36. data/app/views/katello/api/v2/host_collections/{_host_collection.json.rabl → base.json.rabl} +0 -0
  37. data/app/views/katello/api/v2/host_collections/copy.json.rabl +1 -1
  38. data/app/views/katello/api/v2/host_collections/create.json.rabl +1 -1
  39. data/app/views/katello/api/v2/host_collections/index.json.rabl +5 -1
  40. data/app/views/katello/api/v2/host_collections/show.json.rabl +2 -1
  41. data/app/views/katello/api/v2/host_collections/update.json.rabl +1 -1
  42. data/app/views/katello/api/v2/subscriptions/show.json.rabl +5 -0
  43. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +12 -14
  44. data/app/views/overrides/activation_keys/_host_media_type_select.html.erb +26 -0
  45. data/app/views/overrides/activation_keys/_host_synced_content_select.html.erb +24 -0
  46. data/config/routes/overrides.rb +2 -6
  47. data/db/migrate/20150930183738_migrate_content_hosts.rb +5 -0
  48. data/db/migrate/20160413230128_add_kickstart_repository_to_hosts_and_hostgroups.rb +9 -0
  49. data/db/migrate/20160426145517_move_host_description_to_host_comment.rb +27 -0
  50. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +2 -1
  51. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion_katello.js +3 -0
  52. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-base-subscriptions.controller.js +2 -2
  53. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/views/environments.html +4 -5
  54. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/package-details-repositories.controller.js +1 -1
  55. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js +3 -3
  56. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-details.html +4 -4
  57. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/new/new-repository.controller.js +14 -2
  58. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/settings/setting.factory.js +15 -0
  59. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/settings/settings.module.js +12 -0
  60. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-associations-content-hosts.html +1 -1
  61. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js +1 -0
  62. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plans.controller.js +1 -0
  63. data/lib/katello/engine.rb +5 -1
  64. data/lib/katello/tasks/clean_backend_objects.rake +6 -0
  65. data/lib/katello/version.rb +1 -1
  66. metadata +10 -5
  67. data/app/controllers/katello/concerns/operatingsystems_controller_extensions.rb +0 -34
  68. data/lib/katello/permissions/operatingsystems_permissions.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 653220497b16edc164524fa46a3ca1701a3ec997
4
- data.tar.gz: 1d2bb6d2639fb75c3753d79374bb247b234d59f1
3
+ metadata.gz: 187b57f332a5874b4a314c94c1b3e12f2b2fd66d
4
+ data.tar.gz: 64c23ed8c7a6f578f491c6eb5386f81159f72c04
5
5
  SHA512:
6
- metadata.gz: 5ed4b7a5aef272f8d8f8c1033e0fd6a9ee67608cb09a1065fd782b142cbae65ee486e324180b7ed8a4c0ae473ba50c81e97788db18ea6f15c9c251ebe30e35cd
7
- data.tar.gz: 03a81beeeac30c24ccb7fc8150b0c2541fc49d70fe2fa40527e0ad625158e8e90ed91b8eee6e281f5d83dedfadb220caad92c1202a475767ec628d815668764a
6
+ metadata.gz: e8bacef15a3899b32653906402c585a048b00bd76e3a294f91d906dc0d9b63db5f730ecdb6eca690f0f218e67a99e2069bc7699f764dddff08faefdd5ec994c2
7
+ data.tar.gz: a7c7121087bc8207fb8ccf73c01fcf77ea17b1442b88717919e891381beb0e88dd608f37404b6aa69bf607e313a2f62579d6b035d8da0be8ebdcb7c19929c293
@@ -13,7 +13,8 @@ $(document).on('ContentLoad', function(){
13
13
  KT.hosts.getPuppetEnvironmentSelect().data('content_puppet_match', 'true');
14
14
  KT.hosts.setDefaultPuppetEnvironment(KT.hosts.getSelectedContentView(), KT.hosts.getSelectedEnvironment());
15
15
  });
16
-
16
+ KT.hosts.update_media_enablement();
17
+ KT.hosts.set_media_selection_bindings();
17
18
  });
18
19
 
19
20
  KT.hosts.fetchContentViews = function () {
@@ -37,7 +38,7 @@ KT.hosts.signalContentViewFetch = function(fetching) {
37
38
  var select = KT.hosts.getContentViewSelect();
38
39
  var select2 = KT.hosts.getContentViewSelect2();
39
40
  //parent = select.parent(),
40
- spinner = $('<img>').attr('src', '/assets/spinner.gif'),
41
+ spinner = $('<img>').attr('src', select.data("spinner-path")),
41
42
  spinner_id = "content_view_spinner";
42
43
 
43
44
  if(fetching) {
@@ -61,13 +62,14 @@ KT.hosts.setDefaultPuppetEnvironment = function(view_id, env_id) {
61
62
  if (view_id && env_id) {
62
63
  $.get('/hosts/puppet_environment_for_content_view', {content_view_id: view_id, lifecycle_environment_id: env_id}, function (data) {
63
64
  var select = KT.hosts.getPuppetEnvironmentSelect();
64
- select.val(data.id);
65
- select.trigger('change');
65
+ if (data !== null) {
66
+ select.val(data.id);
67
+ select.trigger('change');
68
+ }
66
69
  })
67
70
  }
68
71
  };
69
72
 
70
-
71
73
  KT.hosts.getPuppetEnvironmentSelect = function() {
72
74
  var select = $("#host_environment_id").first();
73
75
  if(select.length === 0) {
@@ -114,7 +116,7 @@ KT.hosts.getSelectedEnvironment = function () {
114
116
 
115
117
  KT.hosts.onKatelloHostEditLoad = function(){
116
118
  var prefxies = ['host', 'hostgroup'],
117
- attributes = ['lifecycle_environment_id', 'content_view_id', 'environment_id', 'content_source_id', 'architecture_id', 'operatingsystem_id'];
119
+ attributes = ['lifecycle_environment_id', 'content_view_id', 'environment_id', 'content_source_id', 'architecture_id'];
118
120
 
119
121
  $.each(prefxies, function(index, prefix) {
120
122
  $.each(attributes, function(attrIndex, attribute) {
@@ -123,14 +125,11 @@ KT.hosts.onKatelloHostEditLoad = function(){
123
125
  });
124
126
  });
125
127
  });
126
- KT.hosts.toggle_installation_medium();
127
128
  };
128
129
 
129
-
130
130
  KT.hosts.toggle_installation_medium = function() {
131
131
  var lifecycle_environment_id, content_source_id, architecture_id, operatingsystem_id, content_view_id;
132
132
 
133
-
134
133
  if ($('#hostgroup_parent_id').length > 0) {
135
134
  lifecycle_environment_id = KT.hosts.getSelectedEnvironment();
136
135
  content_view_id = KT.hosts.getSelectedContentView();
@@ -146,47 +145,130 @@ KT.hosts.toggle_installation_medium = function() {
146
145
  }
147
146
 
148
147
  if (content_view_id && lifecycle_environment_id && content_source_id && architecture_id && operatingsystem_id) {
149
- $.ajax({
150
- type:'get',
151
- url: '/operatingsystems/' + operatingsystem_id + '/available_kickstart_repo',
152
- data: {
153
- lifecycle_environment_id: lifecycle_environment_id,
154
- content_source_id: content_source_id,
155
- architecture_id: architecture_id,
156
- operatingsystem_id: operatingsystem_id,
157
- content_view_id: content_view_id
158
- },
159
- error: function(jqXHR, status, error){
160
- KT.hosts.show_medium_selectbox();
161
- },
162
- success: function(result){
163
- if (result == null) {
164
- KT.hosts.show_medium_selectbox();
165
- } else {
166
- // add kickstart_url div after checking that it doesn't exist
167
- // since this code is called 3 times
168
- if ($("#kt_kickstart_url").length == 0) {
169
- $('label[for="medium_id"]').after("<div id='kt_kickstart_url' class='col-md-8'></div>");
170
- }
171
-
172
- $("#host_medium_id").hide();
173
- $("#s2id_host_medium_id").hide();
174
-
175
- $("#hostgroup_medium_id").hide();
176
- $("#s2id_hostgroup_medium_id").hide();
177
- // populate kickstart_url inside div created above
178
- $("#kt_kickstart_url").html(result.name+"<br />"+result.path);
179
- }
180
- }
181
- })
148
+ os_selected(KT.hosts.get_os_element());
149
+ }
150
+ };
151
+
152
+ KT.hosts.get_os_element = function () {
153
+ var select = $("#host_operatingsystem_id").first();
154
+ if(select.length === 0) {
155
+ select = $("#hostgroup_operatingsystem_id").first();
156
+ }
157
+ return select;
158
+ };
159
+
160
+
161
+ KT.hosts.get_media_selection_div = function () {
162
+ return $("#media_selection_section");
163
+ };
164
+
165
+ KT.hosts.get_install_media_div = function() {
166
+ return KT.hosts.get_media_selection_div().next();
167
+ };
168
+
169
+ KT.hosts.get_synced_content_div = function() {
170
+ return KT.hosts.get_media_selection_div().next().next();
171
+ };
172
+
173
+ KT.hosts.show_install_media = function(show) {
174
+ if (show) {
175
+ KT.hosts.get_install_media_div().show();
176
+ } else {
177
+ KT.hosts.get_install_media_div().hide();
178
+ }
179
+ };
180
+
181
+ KT.hosts.show_synced_content = function(show) {
182
+ if (show) {
183
+ KT.hosts.get_synced_content_div().show();
182
184
  } else {
183
- KT.hosts.show_medium_selectbox();
185
+ KT.hosts.get_synced_content_div().hide();
184
186
  }
187
+ };
188
+
189
+ KT.hosts.update_media_type_selection = function (use_install_media) {
190
+ var elements = KT.hosts.get_media_selector_elements();
191
+ elements.filter('[value="install_media"]').prop('checked', use_install_media);
192
+ elements.filter('[value="synced_content"]').prop('checked', !use_install_media);
193
+ KT.hosts.update_media_enablement();
194
+ };
195
+
196
+ KT.hosts.media_selection_changed = function() {
197
+ KT.hosts.show_install_media(this.value === "install_media");
198
+ KT.hosts.show_synced_content(this.value !== "install_media");
199
+ };
200
+
201
+ KT.hosts.update_media_enablement = function () {
202
+ var value = KT.hosts.is_install_media_selected();
203
+ KT.hosts.show_install_media(value);
204
+ KT.hosts.show_synced_content(!value);
205
+ };
206
+
207
+ KT.hosts.is_install_media_selected = function() {
208
+ return KT.hosts.get_media_selector_elements().filter('[value="install_media"]').is(':checked');
209
+ };
210
+
211
+ KT.hosts.get_media_selector_elements = function() {
212
+ return $('input:radio[data-media-selector]');
213
+ };
214
+
215
+ KT.hosts.get_synced_content_dropdown = function() {
216
+ return $('select[data-kickstart-repository-id]');
217
+ };
218
+
219
+ KT.hosts.on_install_media_dropdown_change = function() {
220
+ // reset the kickstart-repository-id .. They are either or.
221
+ KT.hosts.get_synced_content_dropdown().val("");
222
+ activate_select2("#media_select");
223
+ };
224
+
225
+ KT.hosts.on_synced_content_dropdown_change = function() {
226
+ // reset the kickstart-repository-id .. They are either or.
227
+ $("#host_medium_id").val("");
228
+ $("#s2id_host_medium_id").val("");
229
+ $("#hostgroup_medium_id").val("");
230
+ $("#s2id_hostgroup_medium_id").val("");
231
+ activate_select2("#media_select");
232
+ };
233
+
234
+ KT.hosts.set_install_media_bindings = function() {
235
+ // reset the host medium id
236
+ $("#host_medium_id").change(KT.hosts.on_install_media_dropdown_change);
237
+ $("#s2id_host_medium_id").change(KT.hosts.on_install_media_dropdown_change);
238
+ $("#hostgroup_medium_id").change(KT.hosts.on_install_media_dropdown_change);
239
+ $("#s2id_hostgroup_medium_id").change(KT.hosts.on_install_media_dropdown_change);
240
+ };
185
241
 
242
+ KT.hosts.set_synced_content_bindings = function() {
243
+ KT.hosts.get_synced_content_dropdown().change(KT.hosts.on_synced_content_dropdown_change);
186
244
  };
187
245
 
188
- KT.hosts.show_medium_selectbox = function() {
189
- $("#s2id_host_medium_id").show();
190
- $("#s2id_hostgroup_medium_id").show();
191
- $("#kt_kickstart_url").html('');
246
+ KT.hosts.set_media_selection_bindings = function() {
247
+ KT.hosts.set_install_media_bindings();
248
+ KT.hosts.set_synced_content_bindings();
249
+ KT.hosts.get_media_selector_elements().change(KT.hosts.media_selection_changed);
250
+ };
251
+
252
+ // Note we are overriding the os_selected method in foreman
253
+ // Hopefully when this gets resolved http://projects.theforeman.org/issues/14699
254
+ // This method will get backed out.
255
+ function os_selected(element){
256
+ var attrs = attribute_hash(['operatingsystem_id', 'organization_id', 'location_id', 'content_view_id',
257
+ 'lifecycle_environment_id', 'content_source_id', 'architecture_id', 'hostgroup_id',
258
+ 'medium_id', 'kickstart_repository_id']);
259
+ var url = $(element).attr('data-url');
260
+ foreman.tools.showSpinner();
261
+ $.ajax({
262
+ data: attrs,
263
+ type:'post',
264
+ url: url,
265
+ complete: function(){
266
+ reloadOnAjaxComplete(element);
267
+ },
268
+ success: function(request) {
269
+ $('#media_select').html(request);
270
+ reload_host_params();
271
+ }
272
+ });
273
+ update_provisioning_image();
192
274
  };
@@ -435,8 +435,8 @@ module Katello
435
435
  def authorize_proxy_routes
436
436
  deny_access unless (authenticate || authenticate_client)
437
437
 
438
- route, _, params = Engine.routes.router.recognize(request) do |rte, match, parameters|
439
- break rte, match, parameters if rte.name
438
+ route, params = Engine.routes.router.recognize(request) do |rte, parameters|
439
+ break rte, parameters if rte.name
440
440
  end
441
441
 
442
442
  # route names are defined in routes.rb (:as => :name)
@@ -5,6 +5,7 @@ module Katello
5
5
  before_filter :verify_presence_of_organization_or_environment, :only => [:index]
6
6
  before_filter :find_environment, :only => [:index, :create, :update]
7
7
  before_filter :find_optional_organization, :only => [:index, :create, :show]
8
+ before_filter :find_content_view, :only => [:index]
8
9
  before_filter :find_activation_key, :only => [:show, :update, :destroy, :available_releases, :copy, :product_content,
9
10
  :available_host_collections, :add_host_collections, :remove_host_collections,
10
11
  :content_override, :add_subscriptions, :remove_subscriptions,
@@ -293,6 +294,14 @@ module Katello
293
294
  fail HttpErrors::BadRequest, _("Either organization ID or environment ID needs to be specified")
294
295
  end
295
296
 
297
+ def find_content_view
298
+ if params.include?(:content_view_id)
299
+ cv_id = params[:content_view_id]
300
+ @content_view = ContentView.find_by(:id => cv_id)
301
+ fail HttpErrors::NotFound, _("Couldn't find content view '%s'") % cv_id if @content_view.nil?
302
+ end
303
+ end
304
+
296
305
  def activation_key_params
297
306
  key_params = params.require(:activation_key).permit(:name,
298
307
  :description,
@@ -52,12 +52,7 @@ module Katello
52
52
  total = query.count
53
53
  query = resource.search_for(*search_options).where("#{resource.table_name}.id" => query)
54
54
 
55
- if group.present?
56
- query = query.select(group).group(group)
57
- sub_total = query.count.length
58
- else
59
- sub_total = query.count
60
- end
55
+ sub_total = scoped_search_sub_total(query, total, group)
61
56
 
62
57
  sort_attr = params[:sort_by] || default_sort_by
63
58
 
@@ -78,6 +73,8 @@ module Katello
78
73
  page = params[:page] || 1
79
74
  per_page = params[:per_page] || ::Setting::General.entries_per_page
80
75
 
76
+ query = (total.zero? || sub_total.zero?) ? [] : query
77
+
81
78
  scoped_search_results(query, sub_total, total, page, per_page)
82
79
  rescue ScopedSearch::QueryNotSupported => error
83
80
  return scoped_search_results(query, sub_total, total, page, per_page, error.message)
@@ -85,6 +82,16 @@ module Katello
85
82
 
86
83
  protected
87
84
 
85
+ def scoped_search_sub_total(query, total, group)
86
+ if group.present?
87
+ query = query.select(group).group(group)
88
+ sub_total = total.zero? ? 0 : query.count.length
89
+ else
90
+ sub_total = total.zero? ? 0 : query.count
91
+ end
92
+ sub_total
93
+ end
94
+
88
95
  def scoped_search_results(query, sub_total, total, page, per_page, error = nil)
89
96
  {
90
97
  :results => query,
@@ -70,7 +70,7 @@ module Katello
70
70
  def update
71
71
  update_params = rule_params
72
72
 
73
- if @rule.filter.content_type == 'package'
73
+ if @rule.filter.content_type == ContentViewPackageFilter::CONTENT_TYPE
74
74
  update_params[:version] = "" unless rule_params[:version]
75
75
  update_params[:min_version] = "" unless rule_params[:min_version]
76
76
  update_params[:max_version] = "" unless rule_params[:max_version]
@@ -18,7 +18,7 @@ module Katello
18
18
 
19
19
  def index_relation
20
20
  query = ContentViewFilter.where(:content_view_id => (@view || ContentView.readable))
21
- query = query.where(:name => params[:name]) unless params[:name].blank?
21
+ query = query.where(:name => params[:name]) if params[:name]
22
22
  query
23
23
  end
24
24
 
@@ -82,8 +82,6 @@ module Katello
82
82
  create_params[:organization] = @organization
83
83
  create_params[:prior] = @prior
84
84
  @environment = KTEnvironment.create!(create_params)
85
- @organization.kt_environments << @environment
86
- @organization.save!
87
85
  respond
88
86
  end
89
87
 
@@ -51,8 +51,10 @@ module Katello
51
51
  end
52
52
  elsif @activation_key
53
53
  query = @activation_key.host_collections
54
- else
54
+ elsif @organization
55
55
  query = HostCollection.readable.where(:organization_id => @organization.id)
56
+ else
57
+ query = HostCollection.readable
56
58
  end
57
59
  query = query.where(:name => params[:name]) if params[:name]
58
60
  query
@@ -67,7 +69,7 @@ module Katello
67
69
  @host_collection = HostCollection.new(host_collection_params_with_host_ids)
68
70
  @host_collection.organization = @organization
69
71
  @host_collection.save!
70
- respond
72
+ respond_for_show(:resource => @host_collection)
71
73
  end
72
74
 
73
75
  api :PUT, "/host_collections/:id", N_("Update a host collection")
@@ -2,7 +2,7 @@ module Katello
2
2
  class Api::V2::RepositoriesController < Api::V2::ApiController
3
3
  include Katello::Concerns::FilteredAutoCompleteSearch
4
4
 
5
- before_filter :find_organization, :only => [:index, :auto_complete_search]
5
+ before_filter :find_optional_organization, :only => [:index, :auto_complete_search]
6
6
  before_filter :find_product, :only => [:index, :auto_complete_search]
7
7
  before_filter :find_product_for_create, :only => [:create]
8
8
  before_filter :find_organization_from_product, :only => [:create]
@@ -36,7 +36,7 @@ module Katello
36
36
 
37
37
  api :GET, "/repositories", N_("List of enabled repositories")
38
38
  api :GET, "/content_views/:id/repositories", N_("List of repositories for a content view")
39
- param :organization_id, :number, :required => true, :desc => N_("ID of an organization to show repositories in")
39
+ param :organization_id, :number, :desc => N_("ID of an organization to show repositories in")
40
40
  param :product_id, :number, :desc => N_("ID of a product to show repositories of")
41
41
  param :environment_id, :number, :desc => N_("ID of an environment to show repositories in")
42
42
  param :content_view_id, :number, :desc => N_("ID of a content view to show repositories in")
@@ -105,7 +105,12 @@ module Katello
105
105
  instance_ids += instances.where(:library_instance_id => nil)
106
106
  query = Repository.where(:id => instance_ids)
107
107
  elsif (params[:library] && !params[:environment_id]) || (params[:environment_id].blank? && params[:content_view_version_id].blank? && params[:content_view_id].blank?)
108
- query = query.where(:content_view_version_id => @organization.default_content_view.versions.first.id)
108
+
109
+ if @organization
110
+ query = query.where(:content_view_version_id => @organization.default_content_view.versions.first.id)
111
+ else
112
+ query = query.in_default_view
113
+ end
109
114
  end
110
115
  query
111
116
  end
@@ -263,7 +268,7 @@ module Katello
263
268
  def upload_content
264
269
  fail Katello::Errors::InvalidRepositoryContent, _("Cannot upload Docker content.") if @repository.docker?
265
270
 
266
- filepaths = params[:content].collect do |content|
271
+ filepaths = Array.wrap(params[:content]).compact.collect do |content|
267
272
  {path: content.path, filename: content.original_filename}
268
273
  end
269
274
 
@@ -316,6 +321,7 @@ module Katello
316
321
 
317
322
  def find_product
318
323
  @product = Product.find(params[:product_id]) if params[:product_id]
324
+ find_organization_from_product if @organization.nil? && @product
319
325
  end
320
326
 
321
327
  def find_product_for_create
@@ -30,7 +30,7 @@ module Katello
30
30
  respond :resource => @product_content
31
31
  end
32
32
 
33
- api :GET, "/products/:product_id/repository_sets/:id/available_repositories", N_("Get list or available repositories for the repository set")
33
+ api :GET, "/products/:product_id/repository_sets/:id/available_repositories", N_("Get list of available repositories for the repository set")
34
34
  param :id, :number, :required => true, :desc => N_("ID of the repository set")
35
35
  param :product_id, :number, :required => true, :desc => N_("ID of a product to list repository sets from")
36
36
  def available_repositories
@@ -65,8 +65,8 @@ module Katello
65
65
  respond_for_async :resource => task
66
66
  end
67
67
 
68
- api :PUT, "/products/:product_id/repository_sets/:id/disable", N_("Disable a repository form the set")
69
- param :id, :number, :required => true, :desc => N_("ID of the repository set to enable")
68
+ api :PUT, "/products/:product_id/repository_sets/:id/disable", N_("Disable a repository from the set")
69
+ param :id, :number, :required => true, :desc => N_("ID of the repository set to disable")
70
70
  param :product_id, :number, :required => true, :desc => N_("ID of the product containing the repository set")
71
71
  param :basearch, String, :required => false, :desc => N_("Basearch to disable")
72
72
  param :releasever, String, :required => false, :desc => N_("Releasever to disable")
@@ -112,9 +112,12 @@ module Katello
112
112
 
113
113
  def find_system
114
114
  @system = System.where(:uuid => params[:id]).first
115
- if @system.nil?
115
+ @host = ::Host.where(:id => params[:id]).first
116
+ if @system.nil? && @host.nil?
116
117
  Resources::Candlepin::Consumer.get params[:id] # check with candlepin if system is Gone, raises RestClient::Gone
117
118
  fail HttpErrors::NotFound, _("Couldn't find content host '%s'") % params[:id]
119
+ elsif @system.nil?
120
+ @system = @host.content_host
118
121
  end
119
122
  end
120
123