katello 3.7.0.rc1 → 3.7.0.rc2
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.
- checksums.yaml +4 -4
- data/app/controllers/katello/api/v2/content_views_controller.rb +5 -2
- data/app/controllers/katello/api/v2/environments_controller.rb +8 -3
- data/app/controllers/katello/api/v2/host_tracer_controller.rb +1 -1
- data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +4 -4
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +5 -22
- data/app/lib/actions/katello/host/update_content_overrides.rb +1 -0
- data/app/lib/actions/katello/product/content_create.rb +1 -0
- data/app/lib/actions/katello/product/repositories_certs_reset.rb +25 -0
- data/app/lib/actions/katello/product/update.rb +6 -0
- data/app/lib/katello/resources/candlepin/activation_key.rb +8 -4
- data/app/lib/katello/resources/candlepin/product.rb +2 -1
- data/app/lib/katello/util/cdn_var_substitutor.rb +5 -3
- data/app/lib/katello/util/package.rb +21 -13
- data/app/lib/katello/util/package_filter.rb +33 -31
- data/app/lib/katello/validators/prior_validator.rb +6 -10
- data/app/models/katello/concerns/host_managed_extensions.rb +2 -0
- data/app/models/katello/concerns/organization_extensions.rb +1 -0
- data/app/models/katello/concerns/subscription_facet_host_extensions.rb +10 -6
- data/app/models/katello/content.rb +23 -2
- data/app/models/katello/content_view_docker_filter.rb +1 -1
- data/app/models/katello/content_view_puppet_module.rb +3 -3
- data/app/models/katello/content_view_version.rb +4 -0
- data/app/models/katello/environment_prior.rb +7 -0
- data/app/models/katello/glue/candlepin/candlepin_object.rb +2 -2
- data/app/models/katello/glue/candlepin/pool.rb +10 -13
- data/app/models/katello/glue/candlepin/product.rb +19 -9
- data/app/models/katello/glue/candlepin/repository.rb +16 -0
- data/app/models/katello/glue/candlepin/subscription.rb +1 -1
- data/app/models/katello/glue/provider.rb +15 -81
- data/app/models/katello/host/subscription_facet.rb +1 -1
- data/app/models/katello/kt_environment.rb +39 -8
- data/app/models/katello/pool.rb +2 -1
- data/app/models/katello/rpm.rb +144 -2
- data/app/models/katello/upstream_pool.rb +7 -10
- data/app/services/katello/candlepin/pool_service.rb +18 -3
- data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +13 -16
- data/app/views/dashboard/_content_views_widget.html.erb +3 -3
- data/app/views/dashboard/_errata_widget.html.erb +2 -2
- data/app/views/dashboard/_host_collection_widget.html.erb +3 -3
- data/app/views/dashboard/_subscription_status_widget.html.erb +2 -2
- data/app/views/dashboard/_subscription_widget.html.erb +1 -1
- data/app/views/dashboard/_sync_widget.html.erb +3 -3
- data/app/views/katello/api/v2/subscriptions/base.json.rabl +1 -1
- data/app/views/katello/api/v2/upstream_subscriptions/base.json.rabl +2 -6
- data/app/views/katello/layouts/react.html.erb +3 -3
- data/config/katello.yaml +89 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20160302091113_change_environment_prior.rb +9 -0
- data/db/migrate/20180410140909_add_organization_id_to_pool.rb +2 -1
- data/db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb +10 -0
- data/db/migrate/20180612164926_add_content_org_id.rb +39 -0
- data/db/migrate/20180612165011_remove_content_fields_from_host.rb +7 -0
- data/db/migrate/20180626160422_add_upstream_pool_id_to_katello_pool.rb +9 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-packages-modal.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/environment-content.controller.js +2 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment.html +4 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.controller.js +19 -14
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js +18 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js +51 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/views/new-environment.html +16 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-advanced-sync-modal.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/subscriptions.routes.js +3 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/tasks.module.js +1 -6
- data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +4 -0
- data/engines/bastion_katello/lib/bastion_katello/engine.rb +1 -1
- data/lib/katello/plugin.rb +2 -11
- data/lib/katello/scheduled_jobs.rb +2 -14
- data/lib/katello/tasks/clean_backend_objects.rake +2 -0
- data/lib/katello/tasks/repository.rake +11 -2
- data/lib/katello/tasks/upgrades/3.7/import_pools.rake +12 -0
- data/lib/katello/version.rb +1 -1
- data/package.json +4 -3
- data/webpack/components/PaginationRow/index.js +6 -2
- data/webpack/containers/Application/config.js +7 -2
- data/webpack/index.js +3 -5
- data/webpack/move_to_foreman/common/helpers.js +5 -24
- data/webpack/move_to_foreman/components/common/emptyState/index.js +12 -7
- data/webpack/move_to_foreman/components/common/table/components/CollapseSubscriptionGroupButton.js +31 -0
- data/webpack/move_to_foreman/components/common/table/components/CollapseSubscriptionGroupButton.test.js +16 -0
- data/webpack/move_to_foreman/components/common/table/components/Table.js +76 -0
- data/webpack/move_to_foreman/components/common/table/components/Table.test.js +31 -0
- data/webpack/move_to_foreman/components/common/table/components/TableBody.js +27 -0
- data/webpack/move_to_foreman/components/common/table/components/TableBody.test.js +18 -0
- data/webpack/move_to_foreman/components/common/table/components/TableBodyMessage.js +18 -0
- data/webpack/move_to_foreman/components/common/table/components/TableBodyMessage.test.js +12 -0
- data/webpack/move_to_foreman/components/common/table/components/TableFixtures.js +14 -0
- data/webpack/move_to_foreman/components/common/table/components/TableSelectionCell.js +39 -0
- data/webpack/move_to_foreman/components/common/table/components/TableSelectionCell.test.js +16 -0
- data/webpack/move_to_foreman/components/common/table/components/TableSelectionHeaderCell.js +34 -0
- data/webpack/move_to_foreman/components/common/table/components/TableSelectionHeaderCell.test.js +14 -0
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/CollapseSubscriptionGroupButton.test.js.snap +19 -0
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/Table.test.js.snap +167 -0
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableBody.test.js.snap +28 -0
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableBodyMessage.test.js.snap +13 -0
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionCell.test.js.snap +16 -0
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionHeaderCell.test.js.snap +15 -0
- data/webpack/move_to_foreman/components/common/table/components/index.js +6 -0
- data/webpack/move_to_foreman/components/common/table/formatters/cellFormatter.js +4 -0
- data/webpack/move_to_foreman/components/common/table/formatters/collapseableAndSelectionCellFormatter.js +18 -0
- data/webpack/move_to_foreman/components/common/table/formatters/ellipsisCellFormatter.js +5 -0
- data/webpack/move_to_foreman/components/common/table/formatters/headerFormatter.js +4 -0
- data/webpack/move_to_foreman/components/common/table/formatters/index.js +6 -0
- data/webpack/move_to_foreman/components/common/table/formatters/selectionCellFormatter.js +17 -0
- data/webpack/move_to_foreman/components/common/table/formatters/selectionHeaderCellFormatter.js +10 -0
- data/webpack/move_to_foreman/components/common/table/index.js +2 -88
- data/webpack/move_to_pf/LoadingState/LoadingState.js +35 -0
- data/webpack/move_to_pf/LoadingState/LoadingState.scss +12 -0
- data/webpack/move_to_pf/LoadingState/LoadingState.test.js +28 -0
- data/webpack/move_to_pf/LoadingState/__snapshots__/LoadingState.test.js.snap +20 -0
- data/webpack/move_to_pf/LoadingState/index.js +3 -0
- data/webpack/move_to_pf/test-utils/testHelpers.js +71 -0
- data/webpack/redux/actions/RedHatRepositories/enabled.js +1 -1
- data/webpack/redux/actions/RedHatRepositories/helpers.js +34 -9
- data/webpack/redux/actions/RedHatRepositories/sets.js +28 -6
- data/webpack/redux/consts.js +1 -0
- data/webpack/redux/reducers/RedHatRepositories/sets.fixtures.js +12 -2
- data/webpack/redux/reducers/RedHatRepositories/sets.js +34 -27
- data/webpack/redux/reducers/RedHatRepositories/sets.test.js +10 -2
- data/webpack/redux/reducers/index.js +2 -0
- data/webpack/scenes/Organizations/OrganizationActions.js +3 -3
- data/webpack/scenes/RedHatRepositories/components/RecommendedRepositorySetsToggler.js +44 -0
- data/webpack/scenes/RedHatRepositories/components/RecommendedRepositorySetsToggler.scss +16 -0
- data/webpack/scenes/RedHatRepositories/components/RepositorySet.js +8 -2
- data/webpack/scenes/RedHatRepositories/components/RepositorySetRepositories.js +5 -3
- data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository.js +4 -2
- data/webpack/scenes/RedHatRepositories/components/Search.js +1 -1
- data/webpack/scenes/RedHatRepositories/components/SearchBar.js +1 -1
- data/webpack/scenes/RedHatRepositories/components/__tests__/RecommendedRepositorySetsToggler.test.js +17 -0
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/RecommendedRepositorySetsToggler.test.js.snap +37 -0
- data/webpack/scenes/RedHatRepositories/helpers.js +1 -1
- data/webpack/scenes/RedHatRepositories/index.js +17 -7
- data/webpack/scenes/RedHatRepositories/index.scss +16 -4
- data/webpack/scenes/Subscriptions/Details/SubscriptionAttributes.js +17 -0
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailActions.js +28 -0
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js +47 -0
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailConstants.js +3 -0
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailInfo.js +65 -0
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProducts.js +20 -0
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js +37 -0
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +58 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js +47 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailAssociations.test.js +16 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailInfo.test.js +15 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailProducts.test.js +16 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailReducer.test.js +39 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetails.test.js +28 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailAssociations.test.js.snap +53 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailInfo.test.js.snap +185 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailProducts.test.js.snap +77 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap +432 -0
- data/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js +167 -0
- data/webpack/scenes/Subscriptions/Details/index.js +19 -0
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +58 -12
- data/webpack/scenes/Subscriptions/Manifest/Manifest.scss +6 -1
- data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +4 -4
- data/webpack/scenes/Subscriptions/Manifest/ManifestHistoryTableSchema.js +7 -7
- data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +6 -9
- data/webpack/scenes/Subscriptions/Manifest/index.js +2 -2
- data/webpack/scenes/Subscriptions/SubscriptionActions.js +5 -6
- data/webpack/scenes/Subscriptions/SubscriptionReducer.js +2 -3
- data/webpack/scenes/Subscriptions/SubscriptionValidations.js +1 -1
- data/webpack/scenes/Subscriptions/SubscriptionsPage.js +46 -30
- data/webpack/scenes/Subscriptions/SubscriptionsPage.scss +38 -0
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js +3 -3
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +7 -6
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +17 -14
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +12 -15
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/upstreamSubscriptions.fixtures.js +4 -4
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionValidations.test.js +5 -0
- data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +2 -2
- data/webpack/scenes/Subscriptions/{EntitlementsInlineEditFormatter.js → components/SubscriptionsTable/EntitlementsInlineEditFormatter.js} +7 -7
- data/webpack/scenes/Subscriptions/{SubscriptionsTable.js → components/SubscriptionsTable/SubscriptionsTable.js} +75 -47
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +60 -0
- data/webpack/scenes/Subscriptions/{SubscriptionsTableSchema.js → components/SubscriptionsTable/SubscriptionsTableSchema.js} +37 -26
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +56 -0
- data/webpack/scenes/Subscriptions/{__tests__ → components/SubscriptionsTable/__tests__}/__snapshots__/SubscriptionsTable.test.js.snap +16 -5
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/index.js +2 -0
- data/webpack/scenes/Subscriptions/index.js +2 -2
- data/webpack/scenes/Tasks/TaskActions.js +18 -11
- data/webpack/scenes/Tasks/__tests__/TaskActions.test.js +92 -9
- data/webpack/scenes/Tasks/__tests__/task.fixtures.js +19 -9
- data/webpack/services/api/index.js +2 -2
- data/webpack/test_setup.js +1 -0
- metadata +79 -10
- data/webpack/scenes/Subscriptions/Subscriptions.scss +0 -14
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsTable.test.js +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a4f6bd736dcb2608d0f0eb09fc42a3365633e81
|
4
|
+
data.tar.gz: d4d554bed1a2b7d416f8c57cf6e786fc2188aaa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4e75ade9c719b6f7ba594591fdef8e7665440bf5781802ad5c80dc42d413bb8c2ce71ab17c7805665dfef6dc56e270d30227cbc6127e3f0db3956a0b5ea45d5
|
7
|
+
data.tar.gz: 3318e9625546af01d1f72dc7dc30f998d0213f124189cdb2cc4572652a644648d84935fc114e5d98c1c8368f979319929bb29b033a2c8f05519e717cbaeea9ce
|
@@ -208,9 +208,12 @@ module Katello
|
|
208
208
|
end
|
209
209
|
|
210
210
|
def view_params
|
211
|
-
attrs = [:name, :description, :force_puppet_environment, {:
|
211
|
+
attrs = [:name, :description, :force_puppet_environment, {:component_ids => []}]
|
212
212
|
attrs.push(:label, :composite) if action_name == "create"
|
213
|
-
attrs.push(:component_ids, :
|
213
|
+
attrs.push(:component_ids, :auto_publish) # For deep_munge; Remove for Rails 5
|
214
|
+
if (!@view || !@view.composite?)
|
215
|
+
attrs.push({:repository_ids => []}, :repository_ids)
|
216
|
+
end
|
214
217
|
params.require(:content_view).permit(*attrs).to_h
|
215
218
|
end
|
216
219
|
|
@@ -13,7 +13,7 @@ module Katello
|
|
13
13
|
|
14
14
|
## Chains
|
15
15
|
|
16
|
-
Environments are ordered into chains and their content (
|
16
|
+
Environments are ordered into chains and their content (products,
|
17
17
|
repositories, tempaltes, packages) can be moved to an environment only from its
|
18
18
|
prior environment. You can have for example chain like:
|
19
19
|
|
@@ -39,6 +39,7 @@ module Katello
|
|
39
39
|
before_action :find_prior, :only => [:create]
|
40
40
|
before_action :find_environment, :only => [:show, :update, :destroy, :repositories]
|
41
41
|
before_action :find_content_view, :only => [:repositories]
|
42
|
+
before_action :find_path, :only => [:create]
|
42
43
|
|
43
44
|
wrap_parameters :include => (KTEnvironment.attribute_names + %w(prior prior_id new_name))
|
44
45
|
|
@@ -83,8 +84,7 @@ module Katello
|
|
83
84
|
create_params = environment_params
|
84
85
|
create_params[:label] = labelize_params(create_params)
|
85
86
|
create_params[:organization] = @organization
|
86
|
-
|
87
|
-
@environment = KTEnvironment.create!(create_params)
|
87
|
+
@environment = @prior.insert_successor(create_params, @path)
|
88
88
|
respond
|
89
89
|
end
|
90
90
|
|
@@ -168,6 +168,11 @@ module Katello
|
|
168
168
|
@prior
|
169
169
|
end
|
170
170
|
|
171
|
+
def find_path
|
172
|
+
path = params[:environment][:path_id] || params[:path_id]
|
173
|
+
path ? @path = KTEnvironment.readable.find(path).path : @path = nil
|
174
|
+
end
|
175
|
+
|
171
176
|
def environment_params
|
172
177
|
if @environment && @environment.library?
|
173
178
|
attrs = [:registry_name_pattern]
|
@@ -9,7 +9,7 @@ module Katello
|
|
9
9
|
api_base_url "/api"
|
10
10
|
end
|
11
11
|
|
12
|
-
api :GET, "/hosts/:host_id/
|
12
|
+
api :GET, "/hosts/:host_id/traces", N_("List services that need restarting on the host")
|
13
13
|
param :host_id, :number, :required => true, :desc => N_("ID of the host")
|
14
14
|
def index
|
15
15
|
collection = scoped_search(index_relation, :application, :asc, :resource_class => ::Katello::HostTracer)
|
@@ -18,7 +18,7 @@ module Katello
|
|
18
18
|
N_("List available subscriptions from Red Hat Subscription Management")
|
19
19
|
param :organization_id, :number, :desc => N_("Organization ID"), :required => true
|
20
20
|
param_group :cp_search
|
21
|
-
param :pool_ids, Array, desc: N_("Return only the upstream pools which map to the given
|
21
|
+
param :pool_ids, Array, desc: N_("Return only the upstream pools which map to the given Katello pool IDs")
|
22
22
|
param :quantities_only, :bool, desc: N_("Only returns id and quantity fields")
|
23
23
|
param :attachable, :bool, desc: N_("Return only subscriptions which can be attached to the upstream allocation")
|
24
24
|
def index
|
@@ -35,7 +35,7 @@ module Katello
|
|
35
35
|
N_("Update the quantity of one or more subscriptions on an upstream allocation")
|
36
36
|
param :organization_id, :number, :desc => N_("Organization ID"), :required => true
|
37
37
|
param :pools, Array, desc: N_("Array of Pools to be updated. Only pools originating upstream are accepted."), required: true do
|
38
|
-
param :id, String, desc: N_("ID of local pool to update"), required: true
|
38
|
+
param :id, String, desc: N_("Katello ID of local pool to update"), required: true
|
39
39
|
param :quantity, Integer, desc: N_("Desired quantity of the pool"), required: true
|
40
40
|
end
|
41
41
|
def update
|
@@ -55,7 +55,7 @@ module Katello
|
|
55
55
|
api :POST, "/organizations/:organization_id/upstream_subscriptions",
|
56
56
|
N_("Add subscriptions consumed by a manifest from Red Hat Subscription Management")
|
57
57
|
param :pools, Array, desc: N_("Array of pools to add"), required: true do
|
58
|
-
param :id, String, desc: N_("
|
58
|
+
param :id, String, desc: N_("Candlepin ID of pool to add"), required: true
|
59
59
|
param :quantity, :number, desc: N_("Quantity of entitlements to bind"), required: true
|
60
60
|
end
|
61
61
|
param :organization_id, :number, :desc => N_("Organization ID"), :required => true
|
@@ -74,7 +74,7 @@ module Katello
|
|
74
74
|
def upstream_pool_params
|
75
75
|
upstream_params = params.permit(:page, :per_page, :order, :sort_by, :quantities_only, :attachable, pool_ids: []).to_h
|
76
76
|
|
77
|
-
if params[:full_result]
|
77
|
+
if params[:full_result] || !upstream_params[:pool_ids].empty?
|
78
78
|
upstream_params.delete(:per_page)
|
79
79
|
upstream_params.delete(:page)
|
80
80
|
elsif !params[:per_page]
|
@@ -14,14 +14,6 @@ module Katello
|
|
14
14
|
%(<option data-id="#{inherited_value}" value="">#{blank_or_inherit_f(f, attr)}</option>)
|
15
15
|
end
|
16
16
|
|
17
|
-
def content_view(host)
|
18
|
-
if host.is_a?(Hostgroup)
|
19
|
-
host.content_view
|
20
|
-
else
|
21
|
-
host.content_facet.try(:content_view)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
17
|
def organizations(host)
|
26
18
|
if host.is_a?(Hostgroup)
|
27
19
|
host.organizations
|
@@ -30,14 +22,6 @@ module Katello
|
|
30
22
|
end
|
31
23
|
end
|
32
24
|
|
33
|
-
def lifecycle_environment(host)
|
34
|
-
if host.is_a?(Hostgroup)
|
35
|
-
host.lifecycle_environment
|
36
|
-
else
|
37
|
-
host.content_facet.try(:lifecycle_environment)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
25
|
def use_install_media(host, options = {})
|
42
26
|
return true if host && host.errors && host.errors.include?(:medium_id)
|
43
27
|
kickstart_repository_id(host, options).blank?
|
@@ -77,20 +61,19 @@ module Katello
|
|
77
61
|
end
|
78
62
|
|
79
63
|
def fetch_lifecycle_environment(host, options = {})
|
64
|
+
return host.lifecycle_environment if host.lifecycle_environment.present?
|
80
65
|
selected_host_group = options.fetch(:selected_host_group, nil)
|
81
|
-
return lifecycle_environment
|
82
|
-
selected_env = lifecycle_environment(host)
|
83
|
-
return selected_env if selected_env.present?
|
66
|
+
return selected_host_group.lifecycle_environment if selected_host_group.present?
|
84
67
|
end
|
85
68
|
|
86
69
|
def fetch_content_view(host, options = {})
|
70
|
+
return host.content_view if host.content_view.present?
|
87
71
|
selected_host_group = options.fetch(:selected_host_group, nil)
|
88
|
-
return content_view
|
89
|
-
content_view(host)
|
72
|
+
return selected_host_group.content_view if selected_host_group.present?
|
90
73
|
end
|
91
74
|
|
92
75
|
def accessible_lifecycle_environments(org, host)
|
93
|
-
selected = lifecycle_environment
|
76
|
+
selected = host.lifecycle_environment
|
94
77
|
envs = org.kt_environments.readable
|
95
78
|
envs |= [selected] if selected.present? && org == selected.organization
|
96
79
|
envs
|
@@ -6,6 +6,7 @@ module Actions
|
|
6
6
|
|
7
7
|
def plan(host, content_override_params, prune_invalid_content_overrides = true)
|
8
8
|
action_subject(host)
|
9
|
+
fail _("This Host is not currently registered with subscription-manager.") unless host.subscription_facet
|
9
10
|
plan_self(:host_id => host.id, :host_name => host.name, :content_overrides => content_override_params,
|
10
11
|
:prune_invalid_content_overrides => prune_invalid_content_overrides)
|
11
12
|
end
|
@@ -45,6 +45,7 @@ module Actions
|
|
45
45
|
repository.save!
|
46
46
|
|
47
47
|
content = ::Katello::Content.create!(name: repository.name,
|
48
|
+
organization_id: repository.product.organization_id,
|
48
49
|
cp_content_id: repository.content_id,
|
49
50
|
content_type: repository.content_type,
|
50
51
|
label: repository.custom_content_label,
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Actions
|
2
|
+
module Katello
|
3
|
+
module Product
|
4
|
+
class RepositoriesCertsReset < Actions::AbstractAsyncTask
|
5
|
+
def plan(product)
|
6
|
+
ssl_ca_cert_id = product.ssl_ca_cert_id
|
7
|
+
ssl_client_cert_id = product.ssl_client_cert_id
|
8
|
+
ssl_client_key_id = product.ssl_client_key_id
|
9
|
+
# Plan Repository::Update only for repositories which have different certs key
|
10
|
+
product.repositories.each do |repo|
|
11
|
+
if (repo.ssl_ca_cert_id != ssl_ca_cert_id ||
|
12
|
+
repo.ssl_client_cert_id != ssl_client_cert_id ||
|
13
|
+
repo.ssl_client_key_id != ssl_client_key_id)
|
14
|
+
plan_action(::Actions::Katello::Repository::Update,
|
15
|
+
repo,
|
16
|
+
:ssl_ca_cert_id => ssl_ca_cert_id,
|
17
|
+
:ssl_client_cert_id => ssl_client_cert_id,
|
18
|
+
:ssl_client_key_id => ssl_client_key_id)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -8,7 +8,13 @@ module Actions
|
|
8
8
|
if product.previous_changes.key?('gpg_key_id')
|
9
9
|
plan_action(::Actions::Katello::Product::RepositoriesGpgReset, product)
|
10
10
|
end
|
11
|
+
if (product.previous_changes.key?('ssl_ca_cert_id') ||
|
12
|
+
product.previous_changes.key?('ssl_client_cert_id') ||
|
13
|
+
product.previous_changes.key?('ssl_client_key_id'))
|
14
|
+
plan_action(::Actions::Katello::Product::RepositoriesCertsReset, product)
|
15
|
+
end
|
11
16
|
|
17
|
+
product.reload
|
12
18
|
plan_action(::Actions::Pulp::Repos::Update, product) if ::SETTINGS[:katello][:use_pulp]
|
13
19
|
end
|
14
20
|
end
|
@@ -3,8 +3,8 @@ module Katello
|
|
3
3
|
module Candlepin
|
4
4
|
class ActivationKey < CandlepinResource
|
5
5
|
class << self
|
6
|
-
def get(id = nil, params = '')
|
7
|
-
akeys_json = super(path(id) + params, self.default_headers).body
|
6
|
+
def get(id = nil, params = '', owner = nil)
|
7
|
+
akeys_json = super(path(id, owner) + params, self.default_headers).body
|
8
8
|
akeys = JSON.parse(akeys_json)
|
9
9
|
akeys = [akeys] unless id.nil?
|
10
10
|
::Katello::Util::Data.array_with_indifferent_access akeys
|
@@ -91,8 +91,12 @@ module Katello
|
|
91
91
|
::Katello::Util::Data.array_with_indifferent_access(JSON.parse(result || '{}'))
|
92
92
|
end
|
93
93
|
|
94
|
-
def path(id = nil)
|
95
|
-
|
94
|
+
def path(id = nil, owner_id = nil)
|
95
|
+
if owner_id
|
96
|
+
"/candlepin/owners/#{owner_id}/activation_keys/#{id}"
|
97
|
+
else
|
98
|
+
"/candlepin/activation_keys/#{id}"
|
99
|
+
end
|
96
100
|
end
|
97
101
|
end
|
98
102
|
end
|
@@ -4,7 +4,8 @@ module Katello
|
|
4
4
|
class Product < CandlepinResource
|
5
5
|
class << self
|
6
6
|
def all(owner_label, included = [])
|
7
|
-
JSON.parse(Candlepin::CandlepinResource.get(path(owner_label) + "?#{included_list(included)}", self.default_headers).body)
|
7
|
+
products = JSON.parse(Candlepin::CandlepinResource.get(path(owner_label) + "?#{included_list(included)}", self.default_headers).body)
|
8
|
+
::Katello::Util::Data.array_with_indifferent_access products
|
8
9
|
end
|
9
10
|
|
10
11
|
def find_for_stacking_id(owner_key, stacking_id)
|
@@ -28,9 +28,11 @@ module Katello
|
|
28
28
|
needed_substitutions = PathWithSubstitutions.new(real_path, {}).substitutions_needed
|
29
29
|
|
30
30
|
if unused_substitutions.any?
|
31
|
-
fail Errors::CdnSubstitutionError, _("%{
|
32
|
-
|
33
|
-
|
31
|
+
fail Errors::CdnSubstitutionError, _("%{unused_substitutions} cannot be specified for %{content_name}"\
|
32
|
+
" as that information is not substitutable in %{content_url} ") %
|
33
|
+
{ unused_substitutions: unused_substitutions.join(','),
|
34
|
+
content_name: content.name,
|
35
|
+
content_url: content.content_url }
|
34
36
|
end
|
35
37
|
|
36
38
|
if needed_substitutions.any?
|
@@ -3,12 +3,22 @@ module Katello
|
|
3
3
|
module Package
|
4
4
|
SUFFIX_RE = /\.(rpm)$/
|
5
5
|
ARCH_RE = /\.([^.\-]*)$/
|
6
|
-
|
7
|
-
|
6
|
+
NVRE_RE = /^(.*)-(?:([0-9]+):)?([^-]*)-([^-]*)$/
|
7
|
+
EVR_RE = /^(?:([0-9]+):)?(.*?)(?:-([^-]*))?$/
|
8
8
|
SUPPORTED_ARCHS = %w(noarch i386 i686 ppc64 s390x x86_64 ia64).freeze
|
9
9
|
|
10
|
+
# is able to take both nvre and nvrea and parse it correctly
|
11
|
+
def self.parse_nvrea_nvre(name)
|
12
|
+
package = self.parse_nvrea(name)
|
13
|
+
if package && SUPPORTED_ARCHS.include?(package[:arch])
|
14
|
+
return package
|
15
|
+
else
|
16
|
+
return self.parse_nvre(name)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
10
20
|
#parses package nvrea and stores it in a hash
|
11
|
-
#epoch:
|
21
|
+
#name-epoch:ve.rs.ion-rel.e.ase.arch.rpm
|
12
22
|
def self.parse_nvrea(name)
|
13
23
|
name, suffix = extract_suffix(name)
|
14
24
|
name, arch = extract_arch(name)
|
@@ -20,26 +30,24 @@ module Katello
|
|
20
30
|
end
|
21
31
|
|
22
32
|
#parses package nvre and stores it in a hash
|
23
|
-
#epoch:
|
33
|
+
#name-epoch:ve.rs.ion-rel.e.ase.rpm
|
24
34
|
def self.parse_nvre(name)
|
25
35
|
name, suffix = extract_suffix(name)
|
26
36
|
|
27
37
|
if (match = NVRE_RE.match(name))
|
28
38
|
{:suffix => suffix,
|
29
|
-
:
|
30
|
-
:
|
39
|
+
:name => match[1],
|
40
|
+
:epoch => match[2],
|
31
41
|
:version => match[3],
|
32
42
|
:release => match[4]}.delete_if { |_k, v| v.nil? }
|
33
43
|
end
|
34
44
|
end
|
35
45
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
else
|
42
|
-
return self.parse_nvre(name)
|
46
|
+
def self.parse_evr(evr)
|
47
|
+
if (match = EVR_RE.match(evr))
|
48
|
+
{:epoch => match[1],
|
49
|
+
:version => match[2],
|
50
|
+
:release => match[3]}.delete_if { |_k, v| v.nil? }
|
43
51
|
end
|
44
52
|
end
|
45
53
|
|
@@ -15,53 +15,55 @@ module Katello
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def extract_epoch_version_release(evr)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
evr.match(/\A(?<version>.*)-(?<release>.*)\z/)
|
25
|
-
else
|
26
|
-
evr.match(/\A(?<version>.*)\z/)
|
27
|
-
end
|
28
|
-
self.version = Package.sortable_version(match[:version])
|
29
|
-
self.epoch = match[:epoch] rescue nil
|
30
|
-
self.release = (match[:release] rescue nil) ? Package.sortable_version(match[:release]) : nil
|
18
|
+
parsed = Package.parse_evr(evr)
|
19
|
+
self.epoch = parsed[:epoch].to_i # nil or blank becomes 0
|
20
|
+
v = parsed[:version]
|
21
|
+
self.version = (v.nil? || v.blank?) ? '' : Package.sortable_version(v)
|
22
|
+
r = parsed[:release]
|
23
|
+
self.release = (r.nil? || r.blank?) ? '' : Package.sortable_version(r)
|
31
24
|
end
|
32
25
|
|
33
26
|
def results
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
if operator == EQUAL
|
28
|
+
conditions = epoch_clause(operator)
|
29
|
+
conditions += ' AND ' + version_clause(operator) unless version.blank?
|
30
|
+
conditions += ' AND ' + release_clause(operator) unless release.blank?
|
31
|
+
else
|
32
|
+
conditions = ''
|
33
|
+
unless version.blank?
|
34
|
+
unless release.blank?
|
35
|
+
conditions = " OR (#{version_clause('=')} AND #{release_clause(operator)})"
|
36
|
+
end
|
37
|
+
conditions = " OR (#{epoch_clause('=')} AND (#{version_clause(operator)}#{conditions}))"
|
38
|
+
end
|
39
|
+
conditions = "#{epoch_clause(operator)}#{conditions}"
|
40
|
+
end
|
37
41
|
|
38
|
-
self.relation.where(
|
42
|
+
self.relation.where(conditions, :version => version, :release => release, :epoch => epoch)
|
39
43
|
end
|
40
44
|
|
41
|
-
def
|
42
|
-
|
45
|
+
def epoch_clause(op)
|
46
|
+
"CAST(epoch AS INT) #{op} :epoch"
|
47
|
+
end
|
43
48
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
if operator == EQUAL
|
48
|
-
clause
|
49
|
+
def version_clause(op)
|
50
|
+
if op == '='
|
51
|
+
"version_sortable = :version"
|
49
52
|
else
|
50
|
-
"#{
|
53
|
+
"#{convert(:version_sortable)} #{op} #{convert(':version')}"
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
54
|
-
def
|
55
|
-
if
|
56
|
-
|
57
|
+
def release_clause(op)
|
58
|
+
if op == '='
|
59
|
+
"release_sortable = :release"
|
57
60
|
else
|
58
|
-
|
61
|
+
"#{convert(:release_sortable)} #{op} #{convert(':release')}"
|
59
62
|
end
|
60
|
-
clause % version_clause
|
61
63
|
end
|
62
64
|
|
63
65
|
def convert(name = '?')
|
64
|
-
"
|
66
|
+
"#{name} COLLATE \"C\""
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|
@@ -2,18 +2,14 @@ module Katello
|
|
2
2
|
module Validators
|
3
3
|
class PriorValidator < ActiveModel::Validator
|
4
4
|
def validate(record)
|
5
|
-
#need to ensure that prior
|
6
|
-
#environment already does not have a successor
|
7
|
-
#this is because in v1.0 we want
|
5
|
+
# need to ensure that prior
|
6
|
+
# environment already does not have a successor
|
7
|
+
# this is because in v1.0 we want
|
8
8
|
# prior to have only one child (unless its the Library)
|
9
|
-
|
10
|
-
if
|
11
|
-
|
9
|
+
ancestor = record.prior
|
10
|
+
if ancestor && !ancestor.library?
|
11
|
+
record.errors[:prior] << _("prior environment can only have one child") if ancestor.successors.count == 1 && !ancestor.successors.include?(record)
|
12
12
|
end
|
13
|
-
record.errors[:prior] << _("environment can only have one child") unless has_no_prior
|
14
|
-
|
15
|
-
# only Library can have prior=nil
|
16
|
-
record.errors[:prior] << _("environment required") unless !record.prior.nil? || record.library?
|
17
13
|
end
|
18
14
|
end
|
19
15
|
end
|