katello 3.15.0.rc1.1 → 3.15.0.rc1.2

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 (89) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/hosts/activation_key_edit.js +32 -54
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
  4. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +11 -4
  5. data/app/controllers/katello/api/v2/repositories_controller.rb +7 -3
  6. data/app/controllers/katello/api/v2/subscriptions_controller.rb +2 -3
  7. data/app/lib/actions/katello/content_view/incremental_updates.rb +1 -1
  8. data/app/lib/actions/katello/host/erratum/applicable_errata_install.rb +6 -2
  9. data/app/lib/actions/pulp3/content_migration.rb +5 -5
  10. data/app/lib/actions/pulp3/import_migration.rb +3 -3
  11. data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +1 -1
  12. data/app/lib/katello/concerns/base_template_scope_extensions.rb +1 -1
  13. data/app/models/katello/authorization/pool.rb +5 -1
  14. data/app/models/katello/authorization/subscription.rb +3 -1
  15. data/app/models/katello/candlepin/repository_mapper.rb +5 -1
  16. data/app/models/katello/concerns/host_managed_extensions.rb +17 -8
  17. data/app/models/katello/concerns/pulp_database_unit.rb +1 -1
  18. data/app/models/katello/content_view.rb +4 -0
  19. data/app/models/katello/glue/candlepin/candlepin_object.rb +0 -6
  20. data/app/models/katello/glue/candlepin/owner.rb +1 -1
  21. data/app/models/katello/glue/candlepin/repository.rb +0 -8
  22. data/app/models/katello/glue/pulp/repos.rb +41 -1
  23. data/app/models/katello/installed_package.rb +5 -4
  24. data/app/models/katello/pool.rb +1 -1
  25. data/app/services/katello/pulp/repository/docker.rb +12 -2
  26. data/app/services/katello/pulp/simple_package.rb +6 -2
  27. data/app/services/katello/pulp3/erratum.rb +4 -0
  28. data/app/services/katello/pulp3/migration.rb +61 -8
  29. data/app/services/katello/pulp3/migration_plan.rb +79 -5
  30. data/app/views/dashboard/_subscription_widget.html.erb +1 -1
  31. data/app/views/katello/api/v2/organizations/show.json.rabl +3 -0
  32. data/app/views/katello/api/v2/packages/backend.json.rabl +4 -0
  33. data/app/views/katello/api/v2/products/show.json.rabl +2 -0
  34. data/app/views/overrides/activation_keys/_host_tab_pane.html.erb +10 -2
  35. data/app/views/smart_proxies/plugins/{_pulp3.html.erb → _pulpcore.html.erb} +0 -0
  36. data/config/katello.yaml.example +0 -6
  37. data/db/migrate/20200121213430_katello_repository_rpms_id_big_int.rb +5 -0
  38. data/db/migrate/20200129172534_add_epoch_version_release_arch_to_katello_installed_packages.rb +40 -0
  39. data/engines/bastion/app/views/bastion/layouts/assets.html.erb +1 -1
  40. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +9 -0
  41. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-subscriptions-modal.controller.js +4 -4
  42. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +2 -0
  43. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-subscriptions-modal.html +3 -3
  44. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js +1 -0
  45. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +4 -0
  46. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-subscriptions.controller.js +4 -2
  47. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -2
  48. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-subscriptions.html +15 -10
  49. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/views/package-info.html +1 -1
  50. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/content-access-mode-banner.directive.js +4 -4
  51. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
  52. data/lib/katello/tasks/pulp3_migration.rake +1 -1
  53. data/lib/katello/tasks/pulp3_post_migration_check.rake +32 -0
  54. data/lib/katello/tasks/repository.rake +10 -7
  55. data/lib/katello/version.rb +1 -1
  56. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
  57. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalSelectors.js +2 -0
  58. data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +4 -0
  59. data/webpack/scenes/Organizations/OrganizationSelectors.js +4 -0
  60. data/webpack/scenes/Subscriptions/Manifest/DeleteManifestModalText.js +14 -9
  61. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +183 -169
  62. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.scss +12 -0
  63. data/webpack/scenes/Subscriptions/Manifest/ManifestConstants.js +4 -0
  64. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +5 -3
  65. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +130 -181
  66. data/webpack/scenes/Subscriptions/Manifest/index.js +10 -1
  67. data/webpack/scenes/Subscriptions/SubscriptionActions.js +4 -9
  68. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +0 -3
  69. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +3 -11
  70. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +33 -13
  71. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +2 -5
  72. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsActions.test.js +0 -7
  73. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +5 -0
  74. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsReducer.test.js +0 -12
  75. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +0 -3
  76. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +0 -12
  77. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +2 -3
  78. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsReducer.test.js.snap +0 -73
  79. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +0 -3
  80. data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +0 -4
  81. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +13 -22
  82. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +10 -0
  83. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +2 -1
  84. data/webpack/scenes/Subscriptions/index.js +4 -3
  85. data/webpack/scenes/Tasks/TaskConstants.js +1 -0
  86. metadata +41 -18
  87. data/app/assets/javascripts/katello/widgets/auto_complete.js +0 -183
  88. data/db/seeds.d/115-http_proxy.rb +0 -25
  89. data/vendor/assets/stylesheets/katello/jquery.jnotify.css +0 -98
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3be0c8c8ae873a3c811d7488ca8084b3fe6dd549b03459bb70f7065d48d194c4
4
- data.tar.gz: 86161c33ee551a26af3bfea7c18b9e6e84fe69ecb094867c7d0def2636cfd40c
3
+ metadata.gz: f4e6d74795c4700eaab2d82f34ed4b4b32e5f8d20d230751271cbf404f71b566
4
+ data.tar.gz: 1e12676685c7f06488ba46b24750793bb95cae690a9e112f52fc7c375971b3a6
5
5
  SHA512:
6
- metadata.gz: 15fc64e48e634518a8934f1da8fac2f2b8b89a4096022b2eab9df164d2bfee68c0897b540fce2c87ead33ffeb4a1ec42acf13a1baa9f6e8544d02a4827b31531
7
- data.tar.gz: d52d8fc881a6512c2f6c292c67be41c15843c5c6916003e857b6448402626aab4481d12e06248241f81b4745882ac0cb600cf6abcd7a7894f89ac51c58f9422e
6
+ metadata.gz: 601efee72a0e6519e02cd65b6277bf0d229c16bc384c2fbb1e11094d9d4db5319ec661012ca6d2a724eac3952f5c950ef8dd00eb7aabfbb28c5f73e2d3eaec99
7
+ data.tar.gz: 02522ad2348bf3c740ce7e9b0dc14b911390521a738781e5ccd54d9f93d7f6b047412e9f2656d3db15724ed9f9a2234c710c82dcb08a6f598ebb843f832c1eb7
@@ -12,6 +12,7 @@ function ktLoadActivationKeys() {
12
12
  return; //no Katello-specific env selected
13
13
  }
14
14
 
15
+ $("#ak-load-error").hide();
15
16
  $("#ak-subscriptions-info").hide();
16
17
  $("#ak-subscriptions-spinner").show();
17
18
 
@@ -26,17 +27,14 @@ function ktLoadActivationKeys() {
26
27
  $.each(response['results'], function (i, key) {
27
28
  KT.hosts.availableActivationKeys[key.name] = [];
28
29
  });
29
- ktAkUpdateSubscriptionsInfo();
30
+ tfm.typeAheadSelect.updateOptions(Object.keys(KT.hosts.availableActivationKeys), KT.KT_AK_LABEL);
31
+ },
32
+ error: function() {
33
+ $("#ak-load-error").show();
30
34
  },
31
- error: ktErrorLoadingActivationKeys
32
35
  });
33
36
  }
34
37
 
35
- function ktErrorLoadingActivationKeys(error) {
36
- $.jnotify("Error while loading activation keys from Katello", { type: "error", sticky: true });
37
- ktAkUpdateSubscriptionsInfo();
38
- }
39
-
40
38
  function ktFindParamContainer(name){
41
39
  var ret;
42
40
  $("div#parameters .fields input[ type = 'text']").each(function () {
@@ -82,28 +80,27 @@ function ktSetParam(name, value) {
82
80
  paramContainer.find("input[name*='name']").val(name);
83
81
  }
84
82
  paramContainer.find("textarea").val(value);
83
+ paramContainer.find("input[ type = 'hidden' ]").val(0);
85
84
  } else if(paramContainer) {
86
85
  // we remove the param by setting destroy to 1
87
86
  paramContainer.find("input[ type = 'hidden' ]").val(1);
88
87
  }
89
88
  }
90
89
 
91
- function ktParamToAkInput() {
90
+ function ktAkGetKeysFromParam() {
92
91
  var paramContainer = ktFindParamContainer(KT.KT_AK_LABEL);
92
+ var keys = [];
93
93
  if(paramContainer) {
94
- $("#kt_activation_keys").val(paramContainer.find("textarea").val());
94
+ keys = paramContainer.find("textarea").val().split(',').map(function(key) {
95
+ return key.trim();
96
+ });
95
97
  }
98
+ return keys;
96
99
  }
97
100
 
98
- function ktAkInputToParam() {
99
- var ktActivationKeysValue = $("#kt_activation_keys").val().replace(/,\s*/g,",").replace(/,$/g,"");
100
- ktSetParam(KT.KT_AK_LABEL, ktActivationKeysValue);
101
- }
102
-
103
- function ktAkUpdateSubscriptionsInfo() {
101
+ function ktAkUpdateSubscriptionsInfo(selectedKeys) {
104
102
  var subsInfo = $("ul#ak-subscriptions-info");
105
103
  subsInfo.empty();
106
- var selectedKeys = $("#kt_activation_keys").val().split(/,\s*/);
107
104
  $.each(selectedKeys, function(i, key) {
108
105
  if(KT.hosts.availableActivationKeys[key]) {
109
106
  // hack to make it working with deface
@@ -127,50 +124,31 @@ function ktAkTab() {
127
124
  }
128
125
 
129
126
  function ktOnLoad() {
130
- ktHideParams();
131
- ktParamToAkInput();
132
- ktLoadActivationKeys();
133
- }
134
-
135
- $(document).on('ContentLoad', function(){
127
+ tfm.store.observeStore('typeAheadSelect', function(items, unsubscribe) {
128
+ if (items.kt_activation_keys) { // Wait until after initialization to subscribe to store changes
129
+ unsubscribe();
136
130
 
137
- $("#kt_activation_keys").parents("form").submit(ktAkInputToParam);
131
+ tfm.typeAheadSelect.updateSelected(ktAkGetKeysFromParam(), KT.KT_AK_LABEL);
138
132
 
139
- ktOnLoad();
133
+ tfm.store.observeStore('typeAheadSelect', function(items) {
134
+ if (items.kt_activation_keys) {
135
+ var selected = items.kt_activation_keys.selected || [];
140
136
 
141
- $("#kt_activation_keys").autocomplete({
142
- minLength: 0,
143
- source: function(request, response) {
144
- var terms = request.term.split(/,\s*/);
145
- var part = terms.pop();
146
- var items = [];
147
- for(key in KT.hosts.availableActivationKeys) {
148
- if(terms.indexOf(key) == -1) {
149
- items.push(key);
137
+ ktAkUpdateSubscriptionsInfo(selected);
138
+ ktSetParam(KT.KT_AK_LABEL, selected.map(function(key) {
139
+ return key.trim();
140
+ }).join(','));
150
141
  }
151
- }
152
- response($.ui.autocomplete.filter(
153
- items, part));
154
- },
155
-
156
- focus: function() {
157
- // prevent value inserted on focus
158
- return false;
159
- },
160
- select: function(event, ui) {
161
- var oldTerms = this.value.replace(/[^, ][^,]*$/,"");
162
- this.value = oldTerms + ui.item.value;
163
- ktAkUpdateSubscriptionsInfo();
164
- return false;
165
- },
166
- close: function() {
167
- ktAkUpdateSubscriptionsInfo();
142
+ });
168
143
  }
144
+ });
169
145
 
170
- }).bind("focus", function(event) {
171
- if($(this)[0].value == "") {
172
- $(this).autocomplete( "search" );
173
- }});
146
+ ktHideParams();
147
+ ktLoadActivationKeys();
148
+ }
149
+
150
+ $(document).on('ContentLoad', function(){
151
+ ktOnLoad();
174
152
 
175
153
  $("#hostgroup_lifecycle_environment_id").change(ktLoadActivationKeys);
176
154
  $("#hostgroup_content_view_id").change(ktLoadActivationKeys);
@@ -266,7 +266,7 @@ module Katello
266
266
  def get_parent_host(headers)
267
267
  hostnames = headers["HTTP_X_FORWARDED_SERVER"]
268
268
  host = hostnames.split(",")[0] if hostnames
269
- host || SETTINGS[:fqdn]
269
+ host || URI.parse(Setting[:foreman_url]).host
270
270
  end
271
271
 
272
272
  private
@@ -95,17 +95,19 @@ module Katello
95
95
  end
96
96
 
97
97
  api :POST, "/hosts/bulk/applicable_errata",
98
- N_("Fetch applicable errata for a host.")
98
+ N_("Fetch applicable errata for one or more hosts.")
99
99
  param_group :bulk_params
100
100
  def applicable_errata
101
+ ::Foreman::Deprecation.api_deprecation_warning("The 'applicable_hosts' field will be removed from this API in Katello 2.0")
101
102
  respond_for_index(:collection => scoped_search(Katello::Erratum.applicable_to_hosts(@hosts), 'updated', 'desc',
102
103
  :resource_class => Erratum))
103
104
  end
104
105
 
105
106
  api :POST, "/hosts/bulk/installable_errata",
106
- N_("Fetch installable errata for a host.")
107
+ N_("Fetch installable errata for one or more hosts.")
107
108
  param_group :bulk_params
108
109
  def installable_errata
110
+ ::Foreman::Deprecation.api_deprecation_warning("The 'applicable_hosts' field will be removed from this API in Katello 2.0")
109
111
  respond_for_index(:collection => scoped_search(Katello::Erratum.installable_for_hosts(@hosts), 'updated', 'desc',
110
112
  :resource_class => Erratum))
111
113
  end
@@ -115,7 +117,8 @@ module Katello
115
117
  param :content_type, String,
116
118
  :desc => N_("The type of content. The following types are supported: 'package', 'package_group' and 'errata'."),
117
119
  :required => true
118
- param :content, Array, :desc => N_("List of content (e.g. package names, package group names or errata ids)"), :required => true
120
+ param :content, Array, :desc => N_("List of content (e.g. package names, package group names or errata ids)")
121
+ param :install_all, :bool, :desc => N_("Only used for errata, but will install all installable errata.")
119
122
  def install_content
120
123
  content_action
121
124
  end
@@ -305,7 +308,11 @@ module Katello
305
308
 
306
309
  def content_action
307
310
  if params[:content_type] == 'errata'
308
- task = async_task(::Actions::BulkAction, ::Actions::Katello::Host::Erratum::ApplicableErrataInstall, @hosts, params[:content].uniq)
311
+ options = {}
312
+ options[:update_all] = true if ::Foreman::Cast.to_bool(params[:install_all])
313
+ options[:errata_ids] = params[:content]
314
+
315
+ task = async_task(::Actions::BulkAction, ::Actions::Katello::Host::Erratum::ApplicableErrataInstall, @hosts, options)
309
316
  respond_for_async :resource => task
310
317
  else
311
318
  content = params[:content]
@@ -35,9 +35,9 @@ module Katello
35
35
  def_param_group :repo do
36
36
  param :url, String, :desc => N_("repository source url")
37
37
  param :gpg_key_id, :number, :desc => N_("id of the gpg key that will be assigned to the new repository")
38
- param :ssl_ca_cert_id, :number, :desc => N_("Idenifier of the SSL CA Cert")
39
- param :ssl_client_cert_id, :number, :desc => N_("Identifier of the SSL Client Cert")
40
- param :ssl_client_key_id, :number, :desc => N_("Identifier of the SSL Client Key")
38
+ param :ssl_ca_cert_id, :number, :desc => N_("Identifier of the content credential containing the SSL CA Cert")
39
+ param :ssl_client_cert_id, :number, :desc => N_("Identifier of the content credential containing the SSL Client Cert")
40
+ param :ssl_client_key_id, :number, :desc => N_("Identifier of the content credential containing the SSL Client Key")
41
41
  param :unprotected, :bool, :desc => N_("true if this repository can be published via HTTP")
42
42
  param :checksum_type, String, :desc => N_("Checksum of the repository, currently 'sha1' & 'sha256' are supported")
43
43
  param :docker_upstream_name, String, :desc => N_("Name of the upstream docker repository")
@@ -219,6 +219,10 @@ module Katello
219
219
  fail HttpErrors::UnprocessableEntity, msg
220
220
  end
221
221
 
222
+ if repo_params['content_type'] == "puppet" || repo_params['content_type'] == "ostree"
223
+ ::Foreman::Deprecation.api_deprecation_warning("Puppet and OSTree will no longer be supported in Katello 3.16")
224
+ end
225
+
222
226
  gpg_key = get_content_credential(repo_params, CONTENT_CREDENTIAL_GPG_KEY_TYPE)
223
227
  ssl_ca_cert = get_content_credential(repo_params, CONTENT_CREDENTIAL_SSL_CA_CERT_TYPE)
224
228
  ssl_client_cert = get_content_credential(repo_params, CONTENT_CREDENTIAL_SSL_CLIENT_CERT_TYPE)
@@ -65,7 +65,7 @@ module Katello
65
65
  return available_for_activation_key if params[:available_for] == "activation_key"
66
66
  collection = Pool.readable
67
67
  collection = collection.where(:unmapped_guest => false)
68
- collection = collection.get_for_organization(Organization.find(params[:organization_id])) if params[:organization_id]
68
+ collection = collection.where(organization: Organization.find(params[:organization_id])) if params[:organization_id]
69
69
  collection = collection.for_activation_key(@activation_key) if params[:activation_key_id]
70
70
  collection
71
71
  end
@@ -75,10 +75,9 @@ module Katello
75
75
  param :organization_id, :number, :desc => N_("Organization identifier")
76
76
  param :id, :number, :desc => N_("Subscription identifier"), :required => true
77
77
  def show
78
- org_id = Organization.current&.id
79
78
  @resource = Katello::Pool.with_identifier(params[:id])
80
79
  fail ActiveRecord::RecordNotFound, N_('Subscription not found') unless @resource
81
- if @resource.organization_id != org_id && !User.current.organizations&.pluck(:id)&.include?(@resource.organization_id)
80
+ unless @resource.readable?
82
81
  fail ActiveRecord::RecordNotFound, N_('This subscription is not relevant to the current user and organization.')
83
82
  end
84
83
  respond(:resource => @resource)
@@ -31,7 +31,7 @@ module Actions
31
31
  if hosts.any? && !content[:errata_ids].blank?
32
32
  errata = ::Katello::Erratum.with_identifiers(content[:errata_ids])
33
33
  hosts = hosts.where(:id => ::Katello::Host::ContentFacet.with_applicable_errata(errata).pluck(:host_id))
34
- plan_action(::Actions::BulkAction, ::Actions::Katello::Host::Erratum::ApplicableErrataInstall, hosts, content[:errata_ids])
34
+ plan_action(::Actions::BulkAction, ::Actions::Katello::Host::Erratum::ApplicableErrataInstall, hosts, :errata_ids => content[:errata_ids])
35
35
  end
36
36
  plan_self(:version_outputs => output_for_version_ids)
37
37
  end
@@ -6,8 +6,12 @@ module Actions
6
6
  include Helpers::Presenter
7
7
 
8
8
  #takes a list of errata and schedules the installation of those that are applicable
9
- def plan(host, errata_ids)
10
- applicable_errata = host.content_facet.applicable_errata.with_identifiers(errata_ids)
9
+ def plan(host, options = {})
10
+ fail _("errata_ids or update_all must be provided") if !options[:errata_ids] && !options[:update_all]
11
+ errata_ids = options.fetch(:errata_ids, nil)
12
+
13
+ applicable_errata = host.content_facet.applicable_errata
14
+ applicable_errata = applicable_errata.with_identifiers(errata_ids) if errata_ids
11
15
  plan_action(Actions::Katello::Host::Erratum::Install, host, applicable_errata.pluck(:errata_id))
12
16
  plan_self(:hostname => host.name)
13
17
  end
@@ -1,16 +1,16 @@
1
1
  module Actions
2
2
  module Pulp3
3
3
  class ContentMigration < Pulp3::AbstractAsyncTask
4
- def plan(repository_type_labels, smart_proxy = SmartProxy.pulp_master)
4
+ def plan(smart_proxy = SmartProxy.pulp_master)
5
5
  sequence do
6
- plan_self(repository_type_labels: repository_type_labels, smart_proxy_id: smart_proxy.id)
7
- plan_action(Actions::Pulp3::ImportMigration, repository_type_labels)
6
+ plan_self(smart_proxy_id: smart_proxy.id)
7
+ plan_action(Actions::Pulp3::ImportMigration)
8
8
  end
9
9
  end
10
10
 
11
11
  def invoke_external_task
12
- migration_service = ::Katello::Pulp3::Migration.new(smart_proxy, input[:repository_type_labels])
13
- migration_service.create_and_run_migration
12
+ migration_service = ::Katello::Pulp3::Migration.new(smart_proxy)
13
+ migration_service.create_and_run_migrations
14
14
  end
15
15
  end
16
16
  end
@@ -1,12 +1,12 @@
1
1
  module Actions
2
2
  module Pulp3
3
3
  class ImportMigration < Pulp3::Abstract
4
- def plan(repository_type_labels)
5
- plan_self(repository_type_labels: repository_type_labels)
4
+ def plan
5
+ plan_self
6
6
  end
7
7
 
8
8
  def run
9
- migration_service = ::Katello::Pulp3::Migration.new(SmartProxy.pulp_master, input[:repository_type_labels])
9
+ migration_service = ::Katello::Pulp3::Migration.new(SmartProxy.pulp_master)
10
10
  migration_service.import_pulp3_content
11
11
  end
12
12
  end
@@ -25,7 +25,7 @@ module Actions
25
25
  else
26
26
  repo = ::Katello::Repository.find(input[:repository_id])
27
27
  repo_backend_service = repo.backend_service(smart_proxy)
28
- uploads_api = repo_backend_service.uploads_api
28
+ uploads_api = repo_backend_service.core_api.uploads_api
29
29
  output[:pulp_tasks] = [uploads_api.commit(input[:upload_href], sha256: input[:sha256])]
30
30
  end
31
31
  end
@@ -87,7 +87,7 @@ module Katello
87
87
 
88
88
  tasks = load_resource(klass: ForemanTasks::Task,
89
89
  where: condition,
90
- permission: 'view_tasks',
90
+ permission: 'view_foreman_tasks',
91
91
  joins: 'LEFT OUTER JOIN template_invocations ON foreman_tasks_tasks.id = template_invocations.run_host_job_task_id LEFT OUTER JOIN templates ON template_invocations.template_id = templates.id',
92
92
  select: 'foreman_tasks_tasks.*,template_invocations.id AS template_invocation_id',
93
93
  search: search
@@ -2,9 +2,13 @@ module Katello
2
2
  module Authorization::Pool
3
3
  extend ActiveSupport::Concern
4
4
 
5
+ def readable?
6
+ self.class.readable.where(id: self.id).any?
7
+ end
8
+
5
9
  module ClassMethods
6
10
  def readable
7
- where(:subscription_id => Katello::Subscription.authorized(:view_subscriptions))
11
+ where(:subscription_id => Katello::Subscription.readable)
8
12
  end
9
13
  end
10
14
  end
@@ -10,7 +10,9 @@ module Katello
10
10
 
11
11
  module ClassMethods
12
12
  def readable
13
- authorized(:view_subscriptions)
13
+ return all if User.current.admin?
14
+
15
+ authorized(:view_subscriptions).where(organization_id: User.current.organization_ids)
14
16
  end
15
17
  end
16
18
  end
@@ -6,7 +6,7 @@ module Katello
6
6
  def initialize(product, content, substitutions)
7
7
  @product = product
8
8
  @content = content
9
- @substitutions = substitutions.try(:with_indifferent_access)
9
+ @substitutions = prune_substitutions(substitutions.try(:with_indifferent_access), content.content_url)
10
10
  end
11
11
 
12
12
  def find_repository
@@ -69,6 +69,10 @@ module Katello
69
69
  ::Katello::Glue::Pulp::Repos.repo_path_from_content_path(product.organization.library, path)
70
70
  end
71
71
 
72
+ def prune_substitutions(subs, url)
73
+ subs.select { |key, _| url.include?("$#{key}") }
74
+ end
75
+
72
76
  def feed_url
73
77
  product.repo_url(path)
74
78
  end
@@ -110,17 +110,26 @@ module Katello
110
110
  end
111
111
 
112
112
  def import_package_profile_in_bulk(simple_packages)
113
- nvras = simple_packages.map { |sp| sp.nvra }
114
- found = InstalledPackage.where(:nvra => nvras).select(:id, :nvra).to_a
115
- found_nvras = found.map(&:nvra)
116
- new_packages = simple_packages.select { |sp| !found_nvras.include?(sp.nvra) }
113
+ nvreas = simple_packages.map { |sp| sp.nvrea }
114
+ found = InstalledPackage.where(:nvrea => nvreas).select(:id, :nvrea).to_a
115
+ found_nvreas = found.map(&:nvrea)
117
116
 
117
+ new_packages = simple_packages.select { |sp| !found_nvreas.include?(sp.nvrea) }
118
+
119
+ installed_packages = []
118
120
  new_packages.each do |simple_package|
119
- ::Katello::Util::Support.active_record_retry do
120
- found << InstalledPackage.where(:nvra => simple_package.nvra, :name => simple_package.name).first_or_create!
121
- end
121
+ installed_packages << InstalledPackage.new(:nvrea => simple_package.nvrea,
122
+ :nvra => simple_package.nvra,
123
+ :name => simple_package.name,
124
+ :epoch => simple_package.epoch,
125
+ :version => simple_package.version,
126
+ :release => simple_package.release,
127
+ :arch => simple_package.arch)
122
128
  end
123
- found
129
+ InstalledPackage.import(installed_packages, validate: false, on_duplicate_key_ignore: true)
130
+
131
+ found << installed_packages
132
+ found.flatten
124
133
  end
125
134
 
126
135
  def import_enabled_repositories(repos)
@@ -127,7 +127,7 @@ module Katello
127
127
 
128
128
  def sync_repository_associations(repository, options = {})
129
129
  additive = options.fetch(:additive, false)
130
- pulp_ids = options.fetch(:pulp_ids)
130
+ pulp_ids = options.fetch(:pulp_ids, nil)
131
131
  associated_ids = with_pulp_id(pulp_ids).pluck(:id) if pulp_ids
132
132
 
133
133
  table_name = self.repository_association_class.table_name
@@ -84,6 +84,10 @@ module Katello
84
84
  where("#{Katello::ContentViewEnvironment.table_name}.environment_id = ?", env.id)
85
85
  end
86
86
 
87
+ def self.published_with_repositories(root_repository)
88
+ joins(:content_view_versions => :repositories).where("katello_repositories.root_id" => root_repository.id).uniq
89
+ end
90
+
87
91
  def to_s
88
92
  name
89
93
  end
@@ -3,12 +3,6 @@ module Katello
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  module ClassMethods
6
- def get_for_organization(organization)
7
- # returns objects from AR database rather than candlepin data
8
- pool_ids = self.get_for_owner(organization.label).collect { |x| x['id'] }
9
- self.where(:cp_id => pool_ids)
10
- end
11
-
12
6
  def get_candlepin_ids(organization)
13
7
  self.get_for_owner(organization.label).map { |subscription| subscription["id"] }
14
8
  end