katello 3.7.1.1 → 3.8.0.rc1
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/README.md +8 -7
- data/app/assets/javascripts/katello/common/index.js +0 -1
- data/app/assets/javascripts/katello/sync_management/index.js +0 -1
- data/app/controllers/katello/api/registry/registry_proxies_controller.rb +477 -0
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
- data/app/controllers/katello/api/v2/activation_keys_controller.rb +2 -2
- data/app/controllers/katello/api/v2/api_controller.rb +3 -1
- data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +15 -1
- data/app/controllers/katello/api/v2/environments_controller.rb +5 -2
- data/app/controllers/katello/api/v2/errata_controller.rb +48 -34
- data/app/controllers/katello/api/v2/gpg_keys_controller.rb +1 -1
- data/app/controllers/katello/api/v2/host_collections_controller.rb +1 -1
- data/app/controllers/katello/api/v2/host_packages_controller.rb +5 -1
- data/app/controllers/katello/api/v2/organizations_controller.rb +1 -1
- data/app/controllers/katello/api/v2/packages_controller.rb +33 -22
- data/app/controllers/katello/api/v2/products_controller.rb +1 -1
- data/app/controllers/katello/api/v2/repositories_controller.rb +6 -5
- data/app/controllers/katello/api/v2/repository_sets_controller.rb +1 -10
- data/app/controllers/katello/api/v2/sync_plans_controller.rb +1 -1
- data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +20 -12
- data/app/controllers/katello/remote_execution_controller.rb +6 -6
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +9 -37
- data/app/lib/actions/katello/content_view/promote.rb +6 -2
- data/app/lib/actions/katello/content_view_version/after_promote_hook.rb +11 -0
- data/app/lib/actions/katello/content_view_version/before_promote_hook.rb +11 -0
- data/app/lib/actions/katello/host/remove_subscriptions.rb +1 -1
- data/app/lib/actions/pulp/consumer/abstract_content_action.rb +0 -12
- data/app/lib/actions/pulp/consumer/content_install.rb +1 -1
- data/app/lib/actions/pulp/consumer/content_uninstall.rb +1 -1
- data/app/lib/actions/pulp/consumer/content_update.rb +1 -1
- data/app/lib/katello/resources/registry.rb +40 -0
- data/app/lib/katello/util/package.rb +9 -4
- data/app/models/katello/concerns/subscription_facet_host_extensions.rb +1 -1
- data/app/models/katello/content_view.rb +4 -12
- data/app/models/katello/content_view_version.rb +26 -0
- data/app/models/katello/glue/candlepin/owner.rb +8 -0
- data/app/models/katello/glue/candlepin/pool.rb +11 -11
- data/app/models/katello/glue/candlepin/repository.rb +1 -1
- data/app/models/katello/glue/pulp/repos.rb +1 -0
- data/app/models/katello/host/content_facet.rb +1 -2
- data/app/models/katello/kt_environment.rb +6 -0
- data/app/models/katello/product_content.rb +1 -4
- data/app/models/katello/repository.rb +2 -0
- data/app/models/katello/rpm.rb +118 -14
- data/app/services/katello/puppet_class_importer_extensions.rb +17 -20
- data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +1 -3
- data/app/views/katello/api/v2/common/copy.json.rabl +3 -0
- data/app/views/katello/api/v2/environments/show.json.rabl +1 -1
- data/app/views/katello/api/v2/repositories/base.json.rabl +1 -0
- data/app/views/katello/api/v2/repositories/show.json.rabl +4 -2
- data/app/views/overrides/activation_keys/_host_environment_select.html.erb +3 -2
- data/config/katello.yaml +89 -0
- data/config/routes.rb +0 -1
- data/config/routes/api/registry.rb +29 -0
- data/config/routes/api/v2.rb +1 -1
- data/db/migrate/20180612163403_add_foreign_key_to_hypervisor_id.rb +0 -3
- data/db/migrate/20180614184822_add_unauthenticated_pull.rb +9 -0
- data/db/migrate/20180618195941_add_description_to_repository.rb +5 -0
- data/db/seeds.d/75-job_templates.rb +2 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-repository-sets-modal.controller.js +3 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-subscriptions-modal.controller.js +1 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-subscriptions-modal.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-register.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages-installed.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-add-subscriptions.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version.controller.js +32 -18
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-docker.html +2 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-details.html +32 -23
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +6 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +8 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/discovery.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/views/discovery-create.html +1 -1
- data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +0 -5
- data/lib/katello/engine.rb +1 -0
- data/lib/katello/permission_creator.rb +2 -0
- data/lib/katello/permissions/registry_permissions.rb +20 -0
- data/lib/katello/plugin.rb +1 -0
- data/lib/katello/tasks/clean_backend_objects.rake +3 -12
- data/lib/katello/version.rb +1 -1
- data/package.json +7 -10
- data/webpack/components/Search/Search.test.js +1 -3
- data/webpack/containers/Application/config.js +2 -9
- data/webpack/containers/Application/index.js +2 -4
- data/webpack/mockRequest.js +3 -3
- data/webpack/move_to_foreman/common/helpers.js +8 -45
- data/webpack/move_to_foreman/components/common/{EmptyState → emptyState}/index.js +3 -16
- data/webpack/move_to_foreman/components/common/table/components/Table.js +1 -1
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/CollapseSubscriptionGroupButton.test.js.snap +2 -2
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionCell.test.js.snap +1 -1
- data/webpack/move_to_foreman/components/common/table/components/__snapshots__/TableSelectionHeaderCell.test.js.snap +1 -1
- data/webpack/move_to_pf/LoadingState/LoadingState.js +14 -27
- data/webpack/move_to_pf/LoadingState/LoadingState.test.js +4 -8
- data/webpack/move_to_pf/react-bootstrap-select/index.js +1 -12
- data/webpack/redux/actions/RedHatRepositories/enabled.js +1 -0
- data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
- data/webpack/redux/actions/RedHatRepositories/sets.js +1 -1
- data/webpack/redux/consts.js +0 -6
- data/webpack/redux/reducers/index.js +0 -2
- data/webpack/scenes/RedHatRepositories/components/EnabledRepository.js +23 -14
- data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository.js +1 -1
- data/webpack/scenes/RedHatRepositories/components/SearchBar.js +0 -1
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/RecommendedRepositorySetsToggler.test.js.snap +1 -3
- data/webpack/scenes/RedHatRepositories/index.js +3 -7
- data/webpack/scenes/RedHatRepositories/index.scss +0 -1
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailActions.js +8 -3
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailReducer.js +1 -30
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +28 -111
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailReducer.test.js +1 -3
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetails.test.js +1 -6
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetails.test.js.snap +424 -519
- data/webpack/scenes/Subscriptions/Details/__tests__/subscriptionDetails.fixtures.js +4 -7
- data/webpack/scenes/Subscriptions/Details/index.js +3 -5
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +34 -78
- data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +24 -5
- data/webpack/scenes/Subscriptions/Manifest/ManifestHistoryReducer.js +1 -9
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +0 -3
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestActions.test.js +8 -20
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestHistoryReducer.test.js +1 -3
- data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +7 -34
- data/webpack/scenes/Subscriptions/Manifest/__tests__/manifest.fixtures.js +16 -9
- data/webpack/scenes/Subscriptions/Manifest/index.js +0 -1
- data/webpack/scenes/Subscriptions/SubscriptionActions.js +26 -5
- data/webpack/scenes/Subscriptions/SubscriptionConstants.js +0 -1
- data/webpack/scenes/Subscriptions/SubscriptionHelpers.js +0 -3
- data/webpack/scenes/Subscriptions/SubscriptionReducer.js +4 -11
- data/webpack/scenes/Subscriptions/SubscriptionsPage.js +36 -31
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js +12 -3
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +27 -57
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsReducer.js +3 -2
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +5 -10
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsActions.test.js +5 -10
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsPage.test.js +4 -49
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsReducer.test.js +3 -8
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +11 -21
- data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/upstreamSubscriptions.fixtures.js +8 -5
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +0 -2
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsReducer.test.js +3 -9
- data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +2 -14
- data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +17 -11
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/EntitlementsInlineEditFormatter.js +5 -8
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +58 -45
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +4 -11
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +2 -2
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +3 -16
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +365 -392
- data/webpack/scenes/Subscriptions/index.js +0 -1
- data/webpack/services/api/fixtures.js +353 -0
- data/webpack/services/api/index.js +1 -17
- data/webpack/test_setup.js +0 -2
- metadata +16 -37
- data/config/katello.yml +0 -59
- data/webpack/__mocks__/foremanReact/components/BreadcrumbBar.js +0 -3
- data/webpack/__mocks__/foremanReact/redux.js +0 -3
- data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +0 -8
- data/webpack/components/SelectOrg/SelectOrg.scss +0 -3
- data/webpack/components/SelectOrg/SelectOrgAction.js +0 -41
- data/webpack/components/SelectOrg/SelectOrgReducer.js +0 -33
- data/webpack/components/SelectOrg/SetOrganization.js +0 -116
- data/webpack/components/WithOrganization/withOrganization.js +0 -28
- data/webpack/global_test_setup.js +0 -6
- data/webpack/helpers/caret.js +0 -6
- data/webpack/move_to_pf/Select/Select.js +0 -40
- data/webpack/scenes/Products/ProductActions.js +0 -24
- data/webpack/scenes/Products/ProductConstants.js +0 -3
- data/webpack/scenes/Products/__tests__/ProductActions.test.js +0 -40
- data/webpack/scenes/Products/__tests__/products.fixtures.js +0 -90
- data/webpack/scenes/RedHatRepositories/components/EnabledRepositoryContent.js +0 -34
- data/webpack/scenes/RedHatRepositories/components/__tests__/EnabledRepository.test.js +0 -36
- data/webpack/scenes/RedHatRepositories/components/__tests__/EnabledRepositoryContent.test.js +0 -27
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/EnabledRepository.test.js.snap +0 -25
- data/webpack/scenes/RedHatRepositories/components/__tests__/__snapshots__/EnabledRepositoryContent.test.js.snap +0 -47
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailEnabledProducts.js +0 -54
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProduct.js +0 -29
- data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.scss +0 -9
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailEnabledProducts.test.js +0 -18
- data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailProduct.test.js +0 -13
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailEnabledProducts.test.js.snap +0 -45
- data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailProduct.test.js.snap +0 -67
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/EntitlementsInlineEditFormatter.test.js +0 -110
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/EntitlementsInlineEditFormatter.test.js.snap +0 -228
- data/webpack/scenes/Tasks/helpers.js +0 -52
- data/webpack/services/api/testHelpers.js +0 -28
@@ -57,7 +57,7 @@ module Katello
|
|
57
57
|
@sync_plan.organization = @organization
|
58
58
|
@sync_plan.save!
|
59
59
|
|
60
|
-
|
60
|
+
respond_for_create(:resource => @sync_plan)
|
61
61
|
end
|
62
62
|
|
63
63
|
api :PUT, "/organizations/:organization_id/sync_plans/:id", N_("Update a sync plan")
|
@@ -62,23 +62,17 @@ module Katello
|
|
62
62
|
respond_for_index(:collection => collection)
|
63
63
|
end
|
64
64
|
|
65
|
-
param :available_for, :string, :desc => N_("
|
65
|
+
param :available_for, :string, :desc => N_("Return content that can be added to the specified object. The values 'content_view_version' and 'content_view_filter are supported.")
|
66
66
|
param :filterId, :integer, :desc => N_("Content View Filter id")
|
67
67
|
def index_relation
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
# if the environment is not library and this is for puppet modules,
|
74
|
-
# we can skip environment filter, as those would be associated to
|
75
|
-
# content view puppet environments and handled by the puppet modules
|
76
|
-
# controller.
|
77
|
-
repos = repos.where(:id => @environment.repositories)
|
68
|
+
if @version && params[:available_for] == "content_view_version" && self.respond_to?(:available_for_content_view_version)
|
69
|
+
collection = self.available_for_content_view_version(@version)
|
70
|
+
else
|
71
|
+
collection = resource_class.all
|
72
|
+
collection = filter_by_content_view_version(@version, collection) if @version
|
78
73
|
end
|
79
74
|
|
80
75
|
collection = filter_by_repos(repos, collection)
|
81
|
-
collection = filter_by_content_view_version(@version, collection) if @version
|
82
76
|
collection = filter_by_ids(params[:ids], collection) if params[:ids]
|
83
77
|
@filter = ContentViewFilter.find(params[:filterId]) if params[:filterId]
|
84
78
|
if params[:available_for] == "content_view_filter" && self.respond_to?(:available_for_content_view_filter)
|
@@ -111,6 +105,20 @@ module Katello
|
|
111
105
|
filter_by_ids(ids, collection)
|
112
106
|
end
|
113
107
|
|
108
|
+
def repos
|
109
|
+
repos = Repository.readable
|
110
|
+
repos = repos.where(:id => @repo) if @repo
|
111
|
+
repos = repos.where(:id => Repository.readable.in_organization(@organization)) if @organization
|
112
|
+
if @environment && (@environment.library? || resource_class != Katello::PuppetModule)
|
113
|
+
# if the environment is not library and this is for puppet modules,
|
114
|
+
# we can skip environment filter, as those would be associated to
|
115
|
+
# content view puppet environments and handled by the puppet modules
|
116
|
+
# controller.
|
117
|
+
repos = repos.where(:id => @environment.repositories)
|
118
|
+
end
|
119
|
+
repos
|
120
|
+
end
|
121
|
+
|
114
122
|
def filter_by_repos(repos, collection)
|
115
123
|
collection.in_repositories(repos)
|
116
124
|
end
|
@@ -15,12 +15,6 @@ module Katello
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
# to overcome the isolated namespace engine difficulties with paths
|
19
|
-
helper Rails.application.routes.url_helpers
|
20
|
-
def _routes
|
21
|
-
Rails.application.routes
|
22
|
-
end
|
23
|
-
|
24
18
|
private
|
25
19
|
|
26
20
|
def prepare_composer
|
@@ -49,6 +43,12 @@ module Katello
|
|
49
43
|
# getting packageInstall from UI, translating to 'katello_package_install' feature
|
50
44
|
"katello_#{params[:remote_action].underscore}"
|
51
45
|
end
|
46
|
+
|
47
|
+
# to overcome the isolated namespace engine difficulties with paths
|
48
|
+
helper Rails.application.routes.url_helpers
|
49
|
+
def _routes
|
50
|
+
Rails.application.routes
|
51
|
+
end
|
52
52
|
end
|
53
53
|
else
|
54
54
|
class RemoteExecutionController < ApplicationController
|
@@ -72,12 +72,6 @@ module Katello
|
|
72
72
|
return selected_host_group.content_view if selected_host_group.present?
|
73
73
|
end
|
74
74
|
|
75
|
-
def fetch_content_source(host, options = {})
|
76
|
-
return host.content_source if host.content_source.present?
|
77
|
-
selected_host_group = options.fetch(:selected_host_group, nil)
|
78
|
-
return selected_host_group.content_source if selected_host_group.present?
|
79
|
-
end
|
80
|
-
|
81
75
|
def accessible_lifecycle_environments(org, host)
|
82
76
|
selected = host.lifecycle_environment
|
83
77
|
envs = org.kt_environments.readable
|
@@ -103,28 +97,24 @@ module Katello
|
|
103
97
|
end
|
104
98
|
end
|
105
99
|
|
106
|
-
|
107
|
-
def content_options(host, selected_id, object_type, options = {})
|
100
|
+
def lifecycle_environment_options(host, options = {})
|
108
101
|
include_blank = options.fetch(:include_blank, nil)
|
109
102
|
include_blank = '<option></option>' if include_blank == true #check for true specifically
|
103
|
+
|
104
|
+
selected_id = fetch_lifecycle_environment(host, options).try(:id)
|
110
105
|
orgs = relevant_organizations(host)
|
111
106
|
all_options = []
|
112
107
|
orgs.each do |org|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
accessible_content_proxies(host)
|
118
|
-
end
|
119
|
-
accessible_content_objects.each do |content_object|
|
120
|
-
selected = selected_id == content_object.id ? 'selected' : ''
|
121
|
-
content_object_options << %(<option value="#{content_object.id}" class="kt-env" #{selected}>#{h(content_object.name)}</option>)
|
108
|
+
env_options = ""
|
109
|
+
accessible_lifecycle_environments(org, host).each do |env|
|
110
|
+
selected = selected_id == env.id ? 'selected' : ''
|
111
|
+
env_options << %(<option value="#{env.id}" class="kt-env" #{selected}>#{h(env.name)}</option>)
|
122
112
|
end
|
123
113
|
|
124
114
|
if orgs.count > 1
|
125
|
-
all_options << %(<optgroup label="#{org.name}">#{
|
115
|
+
all_options << %(<optgroup label="#{org.name}">#{env_options}</optgroup>)
|
126
116
|
else
|
127
|
-
all_options <<
|
117
|
+
all_options << env_options
|
128
118
|
end
|
129
119
|
end
|
130
120
|
|
@@ -133,24 +123,6 @@ module Katello
|
|
133
123
|
all_options.html_safe
|
134
124
|
end
|
135
125
|
|
136
|
-
def lifecycle_environment_options(host, options = {})
|
137
|
-
content_options(
|
138
|
-
host,
|
139
|
-
fetch_lifecycle_environment(host, options).try(:id),
|
140
|
-
:lifecycle_environment,
|
141
|
-
options
|
142
|
-
)
|
143
|
-
end
|
144
|
-
|
145
|
-
def content_source_options(host, options = {})
|
146
|
-
content_options(
|
147
|
-
host,
|
148
|
-
fetch_content_source(host, options).try(:id),
|
149
|
-
:content_source,
|
150
|
-
options
|
151
|
-
)
|
152
|
-
end
|
153
|
-
|
154
126
|
def content_views_for_host(host, options)
|
155
127
|
include_blank = options.fetch(:include_blank, nil)
|
156
128
|
if include_blank == true #check for true specifically
|
@@ -13,8 +13,12 @@ module Actions
|
|
13
13
|
# Pass the environments as input in order to make them accessible to UI alerts
|
14
14
|
plan_self(environments: environments.map(&:name))
|
15
15
|
environments.each do |environment|
|
16
|
-
|
17
|
-
|
16
|
+
sequence do
|
17
|
+
plan_action(Katello::ContentViewVersion::BeforePromoteHook, :id => version.id)
|
18
|
+
plan_action(ContentView::PromoteToEnvironment, version, environment, description,
|
19
|
+
:force_yum_metadata_regeneration => options[:force_yum_metadata_regeneration])
|
20
|
+
plan_action(Katello::ContentViewVersion::AfterPromoteHook, :id => version.id)
|
21
|
+
end
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
@@ -13,7 +13,7 @@ module Actions
|
|
13
13
|
end
|
14
14
|
cp_consumer = host.subscription_facet.candlepin_consumer
|
15
15
|
entitlements = pools_with_quantities.map do |pool_with_quantities|
|
16
|
-
cp_consumer.filter_entitlements(pool_with_quantities.pool.cp_id
|
16
|
+
cp_consumer.filter_entitlements(pool_with_quantities.pool.cp_id)
|
17
17
|
end
|
18
18
|
|
19
19
|
entitlements.flatten.each do |entitlement|
|
@@ -44,18 +44,6 @@ module Actions
|
|
44
44
|
messages
|
45
45
|
end
|
46
46
|
|
47
|
-
# by default runcible puts whatever we pass into a hash under the 'name' key
|
48
|
-
# here we can make the unit hash more precise
|
49
|
-
def parse_units_for_type
|
50
|
-
if input[:type] == 'rpm'
|
51
|
-
input[:args].collect do |unit|
|
52
|
-
::Katello::Util::Package.parse_nvrea_nvre(unit) || unit
|
53
|
-
end
|
54
|
-
else
|
55
|
-
input[:args]
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
47
|
def presenter
|
60
48
|
Consumer::ContentPresenter.new(self)
|
61
49
|
end
|
@@ -14,7 +14,7 @@ module Actions
|
|
14
14
|
def invoke_external_task
|
15
15
|
task = pulp_extensions.consumer.install_content(input[:consumer_uuid],
|
16
16
|
input[:type],
|
17
|
-
|
17
|
+
input[:args],
|
18
18
|
"importkeys" => true)
|
19
19
|
schedule_timeout(Setting['content_action_accept_timeout'])
|
20
20
|
task
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'katello/util/data'
|
2
|
+
|
3
|
+
module Katello
|
4
|
+
module Resources
|
5
|
+
require 'rest_client'
|
6
|
+
|
7
|
+
module Registry
|
8
|
+
class Proxy
|
9
|
+
def self.logger
|
10
|
+
::Foreman::Logging.logger('katello/registry_proxy')
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.get(path, headers = {:accept => :json})
|
14
|
+
logger.debug "Sending GET request to Registry: #{path}"
|
15
|
+
client = RegistryResource.rest_client(Net::HTTP::Get, :get, path)
|
16
|
+
client.get(headers)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class RegistryResource < HttpResource
|
21
|
+
if SETTINGS[:katello][:registry]
|
22
|
+
cfg = SETTINGS[:katello][:registry]
|
23
|
+
url = cfg[:url]
|
24
|
+
uri = URI.parse(url)
|
25
|
+
self.prefix = uri.path
|
26
|
+
self.site = "#{uri.scheme}://#{uri.host}:#{uri.port}"
|
27
|
+
self.ca_cert_file = cfg[:ca_cert_file]
|
28
|
+
end
|
29
|
+
|
30
|
+
class << self
|
31
|
+
def process_response(response)
|
32
|
+
debug_level = response.code >= 400 ? :error : :debug
|
33
|
+
logger.send(debug_level, "Registry request returned with code #{response.code}")
|
34
|
+
super
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -99,13 +99,18 @@ module Katello
|
|
99
99
|
|
100
100
|
pack = pack.with_indifferent_access
|
101
101
|
if latest_pack.nil? ||
|
102
|
-
(pack[:epoch] > latest_pack[:epoch]) ||
|
103
|
-
(pack[:epoch] == latest_pack[:epoch] &&
|
104
|
-
|
102
|
+
(pack[:epoch].to_i > latest_pack[:epoch].to_i) ||
|
103
|
+
(pack[:epoch].to_i == latest_pack[:epoch].to_i &&
|
104
|
+
pack[:version_sortable] > latest_pack[:version_sortable]) ||
|
105
|
+
(pack[:epoch].to_i == latest_pack[:epoch].to_i &&
|
106
|
+
pack[:version_sortable] == latest_pack[:version_sortable] &&
|
107
|
+
pack[:release_sortable] > latest_pack[:release_sortable])
|
105
108
|
latest_pack = pack
|
106
109
|
selected_packs = [pack]
|
107
110
|
|
108
|
-
elsif (pack[:epoch] == latest_pack[:epoch] &&
|
111
|
+
elsif (pack[:epoch].to_i == latest_pack[:epoch].to_i &&
|
112
|
+
pack[:version_sortable] == latest_pack[:version_sortable] &&
|
113
|
+
pack[:release_sortable] == latest_pack[:release_sortable])
|
109
114
|
selected_packs << pack
|
110
115
|
end
|
111
116
|
end
|
@@ -50,7 +50,7 @@ module Katello
|
|
50
50
|
scoped_search :on => :hypervisor, :relation => :subscription_facet, :complete_value => true
|
51
51
|
scoped_search :on => :name, :relation => :hypervisor_host, :complete_value => true, :rename => :hypervisor_host, :ext_method => :find_by_hypervisor_host
|
52
52
|
scoped_search :on => :name, :relation => :subscriptions, :rename => :subscription_name, :complete_value => true, :ext_method => :find_by_subscription_name
|
53
|
-
scoped_search :on => :id, :relation => :pools, :rename => :subscription_id, :complete_value => true, :ext_method => :find_by_subscription_id
|
53
|
+
scoped_search :on => :id, :relation => :pools, :rename => :subscription_id, :complete_value => true, :ext_method => :find_by_subscription_id
|
54
54
|
end
|
55
55
|
|
56
56
|
module ClassMethods
|
@@ -579,22 +579,14 @@ module Katello
|
|
579
579
|
|
580
580
|
def check_composite_action_allowed!(env)
|
581
581
|
if composite? && Setting['restrict_composite_view']
|
582
|
-
|
583
|
-
fail _("Make sure all the component content views are published before publishing/promoting the composite content view. "\
|
584
|
-
"This restriction is optional and can be modified in the Administrator -> Settings -> Content "\
|
585
|
-
"page using the restrict_composite_view flag.")
|
586
|
-
end
|
587
|
-
|
588
|
-
env_ids = env.try(:pluck, 'id') || []
|
589
|
-
env_ids << env.id unless env_ids.size > 0
|
582
|
+
# verify that the composite's component view versions exist in the target environment.
|
590
583
|
components.each do |component|
|
591
|
-
|
592
|
-
unless (env_ids - component_environment_ids).empty?
|
584
|
+
unless component.environments.include?(env)
|
593
585
|
fail _("The action requested on this composite view cannot be performed until all of the "\
|
594
586
|
"component content view versions have been promoted to the target environment: %{env}. "\
|
595
|
-
"This restriction is optional and can be modified in the Administrator -> Settings
|
587
|
+
"This restriction is optional and can be modified in the Administrator -> Settings "\
|
596
588
|
"page using the restrict_composite_view flag.") %
|
597
|
-
{ :env => env.
|
589
|
+
{ :env => env.name }
|
598
590
|
end
|
599
591
|
end
|
600
592
|
end
|
@@ -241,6 +241,14 @@ module Katello
|
|
241
241
|
Rpm.in_repositories(archived_repos)
|
242
242
|
end
|
243
243
|
|
244
|
+
def library_packages
|
245
|
+
Rpm.in_repositories(library_repos)
|
246
|
+
end
|
247
|
+
|
248
|
+
def available_packages
|
249
|
+
library_packages.where.not(:id => packages)
|
250
|
+
end
|
251
|
+
|
244
252
|
def srpm_count
|
245
253
|
Katello::Srpm.in_repositories(self.repositories.archived).count
|
246
254
|
end
|
@@ -356,6 +364,24 @@ module Katello
|
|
356
364
|
true
|
357
365
|
end
|
358
366
|
|
367
|
+
def before_promote_hooks
|
368
|
+
run_callbacks :sync do
|
369
|
+
logger.debug "custom hook before_promote on #{name} will be executed if defined."
|
370
|
+
true
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
def after_promote_hooks
|
375
|
+
run_callbacks :sync do
|
376
|
+
logger.debug "custom hook after_promote on #{name} will be executed if defined."
|
377
|
+
true
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
def rabl_path
|
382
|
+
"katello/api/v2/#{self.class.to_s.demodulize.tableize}/show"
|
383
|
+
end
|
384
|
+
|
359
385
|
private
|
360
386
|
|
361
387
|
def remove_environment(env)
|
@@ -39,6 +39,14 @@ module Katello
|
|
39
39
|
self.owner_details['contentAccessMode']
|
40
40
|
end
|
41
41
|
|
42
|
+
def pools(consumer_uuid = nil)
|
43
|
+
if consumer_uuid
|
44
|
+
Resources::Candlepin::Owner.pools self.label, :consumer => consumer_uuid
|
45
|
+
else
|
46
|
+
Resources::Candlepin::Owner.pools self.label
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
42
50
|
def generate_debug_cert
|
43
51
|
Resources::Candlepin::Owner.generate_ueber_cert(label)
|
44
52
|
end
|
@@ -40,16 +40,6 @@ module Katello
|
|
40
40
|
end
|
41
41
|
pool.import_data(index_hosts)
|
42
42
|
end
|
43
|
-
|
44
|
-
def stacking_subscription(org_label, stacking_id)
|
45
|
-
org = Organization.find_by(:label => org_label)
|
46
|
-
subscription = ::Katello::Subscription.find_by(:organization_id => org.id, :cp_id => stacking_id)
|
47
|
-
if subscription.nil?
|
48
|
-
found_product = ::Katello::Resources::Candlepin::Product.find_for_stacking_id(org_label, stacking_id)
|
49
|
-
subscription = ::Katello::Subscription.find_by(:organization_id => org.id, :cp_id => found_product['id']) if found_product
|
50
|
-
end
|
51
|
-
subscription
|
52
|
-
end
|
53
43
|
end
|
54
44
|
|
55
45
|
module InstanceMethods
|
@@ -90,6 +80,16 @@ module Katello
|
|
90
80
|
providers.any?
|
91
81
|
end
|
92
82
|
|
83
|
+
def stacking_subscription(org_label, stacking_id)
|
84
|
+
org = Organization.find_by(:label => org_label)
|
85
|
+
subscription = ::Katello::Subscription.find_by(:organization_id => org.id, :product_id => stacking_id)
|
86
|
+
if subscription.nil?
|
87
|
+
found_product = ::Katello::Resources::Candlepin::Product.find_for_stacking_id(org_label, stacking_id)
|
88
|
+
subscription = ::Katello::Subscription.find_by(:organization_id => org.id, :cp_id => found_product['id']) if found_product
|
89
|
+
end
|
90
|
+
subscription
|
91
|
+
end
|
92
|
+
|
93
93
|
# rubocop:disable MethodLength,Metrics/AbcSize
|
94
94
|
def import_data(index_hosts_and_activation_keys = false)
|
95
95
|
pool_attributes = {}.with_indifferent_access
|
@@ -101,7 +101,7 @@ module Katello
|
|
101
101
|
product_attributes.map { |attr| pool_attributes[attr["name"].underscore.to_sym] = attr["value"] }
|
102
102
|
|
103
103
|
if pool_json["sourceStackId"]
|
104
|
-
subscription =
|
104
|
+
subscription = stacking_subscription(pool_json['owner']['key'], pool_json["sourceStackId"])
|
105
105
|
else
|
106
106
|
subscription = ::Katello::Subscription.find_by(:cp_id => pool_json["productId"])
|
107
107
|
end
|