katello 3.18.5 → 4.0.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/app/assets/stylesheets/katello/katello.scss +72 -0
- data/app/controllers/katello/api/registry/registry_proxies_controller.rb +6 -4
- data/app/controllers/katello/api/rhsm/candlepin_dynflow_proxy_controller.rb +0 -19
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -3
- data/app/controllers/katello/api/v2/content_credentials_controller.rb +24 -24
- data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_exports_controller.rb +4 -0
- data/app/controllers/katello/api/v2/content_views_controller.rb +2 -2
- data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +2 -3
- data/app/controllers/katello/api/v2/repositories_controller.rb +3 -19
- data/app/controllers/katello/api/v2/simple_content_access_controller.rb +34 -0
- data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
- data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +8 -4
- data/app/controllers/katello/concerns/api/v2/authorization.rb +1 -14
- data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +1 -1
- data/app/helpers/katello/sync_management_helper.rb +0 -2
- data/app/lib/actions/candlepin/environment/create.rb +1 -1
- data/app/lib/actions/candlepin/environment/set_content.rb +1 -1
- data/app/lib/actions/katello/activation_key/create.rb +9 -11
- data/app/lib/actions/katello/capsule_content/sync.rb +8 -8
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +9 -0
- data/app/lib/actions/katello/check_matching_content.rb +17 -0
- data/app/lib/actions/katello/content_view/environment_create.rb +6 -8
- data/app/lib/actions/katello/content_view/publish.rb +1 -1
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +11 -7
- data/app/lib/actions/katello/host/hypervisors_update.rb +4 -4
- data/app/lib/actions/katello/organization/create.rb +3 -5
- data/app/lib/actions/katello/organization/destroy.rb +1 -1
- data/app/lib/actions/katello/organization/manifest_delete.rb +3 -5
- data/app/lib/actions/katello/organization/manifest_import.rb +1 -1
- data/app/lib/actions/katello/organization/manifest_refresh.rb +1 -1
- data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +1 -1
- data/app/lib/actions/katello/repository/check_matching_content.rb +3 -1
- data/app/lib/actions/katello/repository/clone_contents.rb +8 -11
- data/app/lib/actions/katello/repository/create.rb +0 -8
- data/app/lib/actions/katello/repository/filtered_index_content.rb +3 -0
- data/app/lib/actions/katello/repository/index_content.rb +1 -0
- data/app/lib/actions/katello/repository/multi_clone_contents.rb +9 -12
- data/app/lib/actions/katello/repository/sync.rb +1 -5
- data/app/lib/actions/katello/repository/update.rb +0 -8
- data/app/lib/actions/middleware/execute_if_contents_changed.rb +4 -1
- data/app/lib/actions/pulp/orchestration/repository/refresh_repos.rb +0 -6
- data/app/lib/actions/pulp3/capsule_content/refresh_distribution.rb +3 -3
- data/app/lib/actions/pulp3/content_guard/refresh_all_distributions.rb +1 -2
- data/app/lib/actions/pulp3/content_migration_presenter.rb +2 -5
- data/app/lib/actions/pulp3/orchestration/repository/refresh_repos.rb +1 -6
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +8 -0
- data/app/lib/katello/errors.rb +1 -1
- data/app/lib/katello/event_daemon/monitor.rb +53 -0
- data/app/lib/katello/event_daemon/runner.rb +99 -0
- data/app/lib/katello/logging.rb +32 -0
- data/app/lib/katello/messaging/connection.rb +1 -7
- data/app/lib/katello/util/pulpcore_content_filters.rb +1 -1
- data/app/lib/katello/validators/content_view_puppet_module_validator.rb +1 -1
- data/app/models/katello/activation_key.rb +2 -2
- data/app/models/katello/candlepin/repository_mapper.rb +1 -1
- data/app/models/katello/concerns/hostgroup_extensions.rb +2 -4
- data/app/models/katello/concerns/organization_extensions.rb +2 -2
- data/app/models/katello/concerns/pulp_database_unit.rb +0 -12
- data/app/models/katello/concerns/redhat_extensions.rb +8 -9
- data/app/models/katello/concerns/smart_proxy_extensions.rb +24 -0
- data/app/models/katello/content_view.rb +5 -1
- data/app/models/katello/content_view_environment.rb +2 -2
- data/app/models/katello/content_view_puppet_environment.rb +2 -2
- data/app/models/katello/content_view_version.rb +2 -1
- data/app/models/katello/content_view_version_export_history.rb +20 -0
- data/app/models/katello/erratum.rb +3 -1
- data/app/models/katello/file_unit.rb +0 -4
- data/app/models/katello/glue/candlepin/pool.rb +2 -0
- data/app/models/katello/glue/pulp/repo.rb +0 -6
- data/app/models/katello/glue/pulp/repos.rb +1 -22
- data/app/models/katello/host/content_facet.rb +31 -9
- data/app/models/katello/ping.rb +19 -39
- data/app/models/katello/pool.rb +5 -0
- data/app/models/katello/product.rb +3 -3
- data/app/models/katello/repository.rb +3 -3
- data/app/presenters/katello/host_subscription_presenter.rb +3 -4
- data/app/presenters/katello/host_subscriptions_presenter.rb +24 -0
- data/app/services/katello/applicability/applicable_content_helper.rb +6 -8
- data/app/services/katello/candlepin_event_listener.rb +11 -19
- data/app/services/katello/event_monitor/poller_thread.rb +2 -11
- data/app/services/katello/pulp/repository.rb +2 -4
- data/app/services/katello/pulp/smart_proxy_repository.rb +0 -15
- data/app/services/katello/pulp3/api/core.rb +0 -14
- data/app/services/katello/pulp3/erratum.rb +1 -2
- data/app/services/katello/pulp3/migration.rb +9 -83
- data/app/services/katello/pulp3/migration_plan.rb +5 -54
- data/app/services/katello/pulp3/migration_switchover.rb +5 -36
- data/app/services/katello/pulp3/repository/apt.rb +2 -1
- data/app/services/katello/pulp3/repository/yum.rb +2 -11
- data/app/services/katello/pulp3/repository.rb +13 -34
- data/app/services/katello/pulp3/rpm.rb +1 -5
- data/app/services/katello/pulp3/task.rb +5 -8
- data/app/services/katello/pulp3/task_group.rb +5 -13
- data/app/services/katello/repository_type.rb +1 -1
- data/app/views/foreman/smart_proxies/_content_tab.html.erb +4 -47
- data/app/views/foreman/smart_proxies/show.html.erb +1 -1
- data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +22 -25
- data/app/views/katello/api/v2/content_view_version_export_histories/show.json.rabl +1 -0
- data/app/views/katello/api/v2/organizations/show.json.rabl +7 -9
- data/app/views/katello/sync_management/_products.html.erb +1 -1
- data/app/views/overrides/organizations/_edit_override.html.erb +1 -4
- data/app/views/overrides/smart_proxies/_environment_tab.html.erb +1 -1
- data/app/views/overrides/smart_proxies/_environment_tab_pane.html.erb +1 -1
- data/config/katello.yaml.example +0 -3
- data/config/routes/api/v2.rb +8 -10
- data/db/migrate/20191204214919_add_content_view_version_counts.rb +0 -1
- data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +1 -1
- data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +56 -0
- data/db/migrate/20210128231228_add_type_and_from_cvv_to_cvv_export_history.rb +14 -0
- data/db/migrate/20210201163238_migrate_background_download_policy_to_migrate.rb +7 -0
- data/db/seeds.d/104-proxy.rb +1 -1
- data/db/seeds.d/111-upgrade_tasks.rb +2 -1
- data/engines/bastion/app/assets/javascripts/bastion/auth/authorization.service.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-register-os-client.directive.js +17 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html +11 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-deb-client.html +38 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-oracle-client.html +5 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-sles-client.html +28 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register.html +14 -11
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-filter-details.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/download-policy.service.js +0 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +2 -2
- data/lib/katello/engine.rb +4 -5
- data/lib/katello/middleware/event_daemon.rb +1 -1
- data/lib/katello/permission_creator.rb +3 -2
- data/lib/katello/plugin.rb +2 -2
- data/lib/katello/tasks/jenkins.rake +1 -1
- data/lib/katello/tasks/pulp3_content_switchover.rake +20 -31
- data/lib/katello/tasks/pulp3_migration.rake +25 -45
- data/lib/katello/tasks/pulp3_migration_abort.rake +0 -8
- data/lib/katello/tasks/pulp3_migration_stats.rake +3 -46
- data/lib/katello/tasks/upgrades/4.0/remove_ostree_puppet_content.rake +16 -0
- data/lib/katello/version.rb +1 -1
- data/lib/proxy_api/container_gateway.rb +21 -0
- data/locale/bn/katello.edit.po +0 -0
- data/locale/cs/katello.edit.po +0 -0
- data/locale/de/katello.edit.po +0 -0
- data/locale/en/katello.edit.po +0 -0
- data/locale/es/katello.edit.po +0 -0
- data/locale/fr/katello.edit.po +0 -0
- data/locale/gu/katello.edit.po +0 -0
- data/locale/hi/katello.edit.po +0 -0
- data/locale/it/katello.edit.po +0 -0
- data/locale/ja/katello.edit.po +0 -0
- data/locale/kn/katello.edit.po +0 -0
- data/locale/ko/katello.edit.po +0 -0
- data/locale/mr/katello.edit.po +0 -0
- data/locale/or/katello.edit.po +0 -0
- data/locale/pa/katello.edit.po +0 -0
- data/locale/pt/katello.edit.po +0 -0
- data/locale/pt_BR/katello.edit.po +0 -0
- data/locale/ru/katello.edit.po +0 -0
- data/locale/ta/katello.edit.po +0 -0
- data/locale/te/katello.edit.po +0 -0
- data/locale/zh_CN/katello.edit.po +0 -0
- data/locale/zh_TW/katello.edit.po +0 -0
- data/package.json +1 -1
- data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +0 -1
- data/webpack/__mocks__/foremanReact/components/Pagination/PaginationHooks.js +2 -0
- data/webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js +5 -0
- data/webpack/{scenes/ContentViews/Details/Repositories → components/SelectableDropdown}/SelectableDropdown.js +20 -3
- data/webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js +45 -0
- data/webpack/components/SelectableDropdown/index.js +3 -0
- data/webpack/components/Table/TableWrapper.js +2 -1
- data/webpack/components/Table/helpers.js +14 -0
- data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.js +0 -1
- data/webpack/containers/Application/overrides.scss +6 -0
- data/webpack/index.js +6 -0
- data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
- data/webpack/scenes/ContentViews/ContentViewsActions.js +31 -2
- data/webpack/scenes/ContentViews/ContentViewsConstants.js +5 -1
- data/webpack/scenes/ContentViews/Copy/ContentViewCopySelectors.js +16 -0
- data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +77 -0
- data/webpack/scenes/ContentViews/Copy/CopyContentViewModal.js +44 -0
- data/webpack/scenes/ContentViews/Copy/__tests__/contentViewCopyResult.fixtures.json +42 -0
- data/webpack/scenes/ContentViews/Copy/__tests__/copyContentView.test.js +39 -0
- data/webpack/scenes/ContentViews/Copy/index.js +4 -0
- data/webpack/scenes/ContentViews/Create/ContentViewCreateSelectors.js +16 -0
- data/webpack/scenes/ContentViews/Create/ContentViewFormComponents.js +58 -0
- data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +175 -0
- data/webpack/scenes/ContentViews/Create/CreateContentViewModal.js +27 -0
- data/webpack/scenes/ContentViews/Create/__tests__/contentViewCreateResult.fixtures.json +42 -0
- data/webpack/scenes/ContentViews/Create/__tests__/createContentView.test.js +92 -0
- data/webpack/scenes/ContentViews/Create/index.js +4 -0
- data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +16 -0
- data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +20 -1
- data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +17 -7
- data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +19 -13
- data/webpack/scenes/ContentViews/Details/Filters/ContentType.js +40 -0
- data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +124 -0
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.fixtures.json +134 -0
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +92 -0
- data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +44 -25
- data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +17 -7
- data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +24 -0
- data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +53 -3
- data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +4 -3
- data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +41 -0
- data/webpack/scenes/ContentViews/helpers.js +13 -0
- data/webpack/scenes/SmartProxy/Content.js +17 -0
- data/webpack/scenes/SmartProxy/SmartProxyContentActions.js +11 -0
- data/webpack/scenes/SmartProxy/SmartProxyContentConstants.js +3 -0
- data/webpack/scenes/SmartProxy/SmartProxyContentSelectors.js +16 -0
- data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +152 -0
- data/webpack/scenes/SmartProxy/__tests__/SmartProxyContentResult.fixtures.json +140 -0
- data/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js +38 -0
- data/webpack/scenes/SmartProxy/index.js +4 -0
- data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +2 -7
- data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +3 -3
- data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestActions.test.js +2 -2
- data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +2 -2
- data/webpack/scenes/Subscriptions/Manifest/index.js +0 -1
- data/webpack/test-utils/react-testing-lib-wrapper.js +5 -2
- data/webpack/utils/helpers.js +3 -0
- metadata +103 -63
- data/app/controllers/katello/api/v2/gpg_keys_controller.rb +0 -114
- data/app/lib/actions/pulp3/content_migration_reset.rb +0 -22
- data/app/lib/katello/util/hostgroup_facets_helper.rb +0 -126
- data/app/overrides/disable_turbolinks_on_proxies_index.rb +0 -5
- data/app/services/katello/event_daemon.rb +0 -135
- data/app/services/katello/pulp/content_counts_calculator.rb +0 -60
- data/db/migrate/20210201165835_add_migration_missing_content.rb +0 -12
- data/db/migrate/20210420140050_add_pulp3_hrefs_to_content_types_deb.rb +0 -5
- data/lib/katello/tasks/check_config.rake +0 -11
- data/lib/katello/tasks/fix_hostgroup_facets.rake +0 -8
- data/lib/katello/tasks/pulp3_migration_approve_corrupted.rake +0 -21
- data/lib/katello/tasks/pulp3_migration_reset.rake +0 -26
- data/lib/katello/tasks/reports.rake +0 -7
- data/lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake +0 -32
- data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.scss +0 -5
- data/webpack/scenes/ContentViews/Table/actionResolver.js +0 -28
data/app/models/katello/pool.rb
CHANGED
@@ -22,6 +22,7 @@ module Katello
|
|
22
22
|
where(["end_date < ?", days.to_i.days.from_now.end_of_day])
|
23
23
|
end
|
24
24
|
scope :upstream, -> { where.not(upstream_pool_id: nil) }
|
25
|
+
scope :redhat, -> { joins(:products).merge(Katello::Product.redhat).distinct }
|
25
26
|
|
26
27
|
include Glue::Candlepin::Pool
|
27
28
|
include Glue::Candlepin::CandlepinObject
|
@@ -51,6 +52,10 @@ module Katello
|
|
51
52
|
|
52
53
|
DAYS_RECENTLY_EXPIRED = 30
|
53
54
|
|
55
|
+
def redhat?
|
56
|
+
self.class.redhat.where(:id => self.id).exists?
|
57
|
+
end
|
58
|
+
|
54
59
|
def active?
|
55
60
|
active
|
56
61
|
end
|
@@ -3,9 +3,9 @@ module Katello
|
|
3
3
|
audited
|
4
4
|
|
5
5
|
include ForemanTasks::Concerns::ActionSubject
|
6
|
-
include Glue::Candlepin::Product
|
7
|
-
include Glue::Pulp::Repos
|
8
|
-
include Glue
|
6
|
+
include Glue::Candlepin::Product
|
7
|
+
include Glue::Pulp::Repos
|
8
|
+
include Glue
|
9
9
|
|
10
10
|
include Katello::Authorization::Product
|
11
11
|
|
@@ -12,9 +12,9 @@ module Katello
|
|
12
12
|
|
13
13
|
include ForemanTasks::Concerns::ActionSubject
|
14
14
|
include Glue::Candlepin::Repository
|
15
|
-
include Glue::Pulp::Repo
|
15
|
+
include Glue::Pulp::Repo
|
16
16
|
|
17
|
-
include Glue
|
17
|
+
include Glue
|
18
18
|
include Authorization::Repository
|
19
19
|
include Katello::Engine.routes.url_helpers
|
20
20
|
|
@@ -145,7 +145,7 @@ module Katello
|
|
145
145
|
scoped_search :rename => :product, :on => :name, :relation => :product, :complete_value => true
|
146
146
|
scoped_search :rename => :product_id, :on => :id, :relation => :product
|
147
147
|
scoped_search :on => :content_type, :relation => :root, :complete_value => -> do
|
148
|
-
Katello::RepositoryTypeManager.repository_types.keys.
|
148
|
+
Katello::RepositoryTypeManager.repository_types.keys.index_by { |value| value.to_sym }
|
149
149
|
end
|
150
150
|
scoped_search :on => :content_view_id, :relation => :content_view_repositories, :validator => ScopedSearch::Validators::INTEGER, :only_explicit => true
|
151
151
|
scoped_search :on => :distribution_version, :complete_value => true
|
@@ -1,11 +1,10 @@
|
|
1
1
|
module Katello
|
2
2
|
class HostSubscriptionPresenter < SimpleDelegator
|
3
|
-
|
3
|
+
attr_reader :quantity_consumed
|
4
4
|
|
5
|
-
def initialize(entitlement)
|
6
|
-
@subscription = Katello::Pool.find_by(:cp_id => entitlement['pool']['id'])
|
5
|
+
def initialize(pool:, entitlement:)
|
7
6
|
@quantity_consumed = entitlement.try(:[], :quantity)
|
8
|
-
super(
|
7
|
+
super(pool)
|
9
8
|
end
|
10
9
|
end
|
11
10
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Katello
|
2
|
+
class HostSubscriptionsPresenter
|
3
|
+
attr_reader :subscriptions
|
4
|
+
|
5
|
+
def initialize(host)
|
6
|
+
pools = host.subscription_facet&.pools || []
|
7
|
+
@pools = pools.group_by(&:cp_id)
|
8
|
+
|
9
|
+
entitlements = host.subscription_facet.candlepin_consumer.entitlements if @pools.any?
|
10
|
+
entitlements ||= []
|
11
|
+
|
12
|
+
@subscriptions = entitlements.map do |e|
|
13
|
+
HostSubscriptionPresenter.new(pool: pool_for_entitlement(e), entitlement: e)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def pool_for_entitlement(entitlement)
|
20
|
+
pool_cp_id = entitlement['pool']['id']
|
21
|
+
@pools[pool_cp_id]&.first
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -122,22 +122,20 @@ module Katello
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def applicable_differences
|
125
|
-
|
126
|
-
|
127
|
-
content_ids = fetch_content_ids
|
125
|
+
consumer_ids = content_facet.send(applicable_units).pluck("#{content_unit_class.table_name}.id")
|
126
|
+
content_ids = fetch_content_ids
|
128
127
|
|
129
|
-
|
130
|
-
|
128
|
+
to_remove = consumer_ids - content_ids
|
129
|
+
to_add = content_ids - consumer_ids
|
131
130
|
|
132
|
-
|
133
|
-
end
|
131
|
+
[to_add, to_remove]
|
134
132
|
end
|
135
133
|
|
136
134
|
def insert(applicable_ids)
|
137
135
|
unless applicable_ids.empty?
|
138
136
|
inserts = applicable_ids.map { |applicable_id| "(#{applicable_id.to_i}, #{content_facet.id.to_i})" }
|
139
137
|
sql = "INSERT INTO #{content_facet_association_class.table_name} (#{content_unit_association_id}, content_facet_id) VALUES #{inserts.join(', ')}"
|
140
|
-
ActiveRecord::Base.connection.
|
138
|
+
ActiveRecord::Base.connection.execute(sql)
|
141
139
|
end
|
142
140
|
end
|
143
141
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module Katello
|
2
2
|
class CandlepinEventListener
|
3
|
-
STATUS_CACHE_KEY = 'candlepin_events_status'.freeze
|
4
|
-
|
5
3
|
Event = Struct.new(:subject, :content)
|
6
4
|
|
7
5
|
cattr_accessor :client_factory
|
@@ -14,22 +12,20 @@ module Katello
|
|
14
12
|
end
|
15
13
|
|
16
14
|
def self.running?
|
17
|
-
@
|
15
|
+
@client&.running? || false
|
18
16
|
end
|
19
17
|
|
20
18
|
def self.close
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
@client&.close
|
19
|
+
if @client&.close
|
20
|
+
logger.info("Closed candlepin event listener")
|
21
|
+
end
|
25
22
|
reset
|
26
23
|
end
|
27
24
|
|
28
25
|
def self.reset
|
29
26
|
@processed_count = 0
|
30
27
|
@failed_count = 0
|
31
|
-
@
|
32
|
-
Rails.cache.delete(STATUS_CACHE_KEY)
|
28
|
+
@client = nil
|
33
29
|
end
|
34
30
|
|
35
31
|
def self.run
|
@@ -37,18 +33,14 @@ module Katello
|
|
37
33
|
@client.subscribe do |message|
|
38
34
|
handle_message(message)
|
39
35
|
end
|
40
|
-
|
41
|
-
@running = true
|
42
36
|
end
|
43
37
|
|
44
|
-
def self.status
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
}
|
51
|
-
end
|
38
|
+
def self.status
|
39
|
+
{
|
40
|
+
processed_count: @processed_count,
|
41
|
+
failed_count: @failed_count,
|
42
|
+
running: running?
|
43
|
+
}
|
52
44
|
end
|
53
45
|
|
54
46
|
def self.handle_message(message)
|
@@ -2,7 +2,6 @@ module Katello
|
|
2
2
|
module EventMonitor
|
3
3
|
class PollerThread
|
4
4
|
SLEEP_INTERVAL = 3
|
5
|
-
STATUS_CACHE_KEY = 'katello_events_status'.freeze
|
6
5
|
|
7
6
|
cattr_accessor :instance
|
8
7
|
|
@@ -15,7 +14,6 @@ module Katello
|
|
15
14
|
self.instance.close
|
16
15
|
self.instance = nil
|
17
16
|
end
|
18
|
-
reset_status
|
19
17
|
end
|
20
18
|
|
21
19
|
def self.run
|
@@ -24,14 +22,8 @@ module Katello
|
|
24
22
|
instance.poll_for_events
|
25
23
|
end
|
26
24
|
|
27
|
-
def self.status
|
28
|
-
|
29
|
-
instance&.status
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.reset_status
|
34
|
-
Rails.cache.delete(STATUS_CACHE_KEY)
|
25
|
+
def self.status
|
26
|
+
instance&.status
|
35
27
|
end
|
36
28
|
|
37
29
|
def initialize(logger = nil)
|
@@ -85,7 +77,6 @@ module Katello
|
|
85
77
|
end
|
86
78
|
|
87
79
|
def poll_for_events
|
88
|
-
@thread&.kill
|
89
80
|
@thread = Thread.new do
|
90
81
|
@logger.info("Polling Katello Event Queue")
|
91
82
|
loop do
|
@@ -296,13 +296,11 @@ module Katello
|
|
296
296
|
|
297
297
|
if proxy
|
298
298
|
uri = URI(proxy.url)
|
299
|
-
username = CGI.escape(proxy.username) if proxy.username
|
300
|
-
password = CGI.escape(proxy.password) if proxy.password
|
301
299
|
proxy_options = {
|
302
300
|
proxy_host: uri.scheme + '://' + uri.host,
|
303
301
|
proxy_port: uri.port,
|
304
|
-
proxy_username: username,
|
305
|
-
proxy_password: password
|
302
|
+
proxy_username: proxy.username,
|
303
|
+
proxy_password: proxy.password
|
306
304
|
}
|
307
305
|
return proxy_options
|
308
306
|
end
|
@@ -42,21 +42,6 @@ module Katello
|
|
42
42
|
puppet_repos.where(:pulp_id => pulp_repos.map { |pulp_repo| pulp_repo['id'] })
|
43
43
|
end
|
44
44
|
|
45
|
-
def current_repositories_data(environment = nil, content_view = nil)
|
46
|
-
@pulp_repositories ||= smart_proxy.pulp_repositories
|
47
|
-
|
48
|
-
repos = Katello::Repository
|
49
|
-
repos = repos.in_environment(environment) if environment
|
50
|
-
repos = repos.in_content_views([content_view]) if content_view
|
51
|
-
puppet_envs = Katello::ContentViewPuppetEnvironment
|
52
|
-
puppet_envs = puppet_envs.in_environment(environment) if environment
|
53
|
-
puppet_envs = puppet_envs.in_content_view(content_view) if content_view
|
54
|
-
|
55
|
-
repo_ids = repos.pluck(:pulp_id) + puppet_envs.pluck(:pulp_id)
|
56
|
-
|
57
|
-
@pulp_repositories.select { |r| repo_ids.include?(r['id']) }
|
58
|
-
end
|
59
|
-
|
60
45
|
def orphaned_repos
|
61
46
|
@smart_proxy.pulp_repositories.map { |x| x["id"] } - repos_available_to_capsule.map { |x| x.pulp_id }
|
62
47
|
end
|
@@ -58,20 +58,6 @@ module Katello
|
|
58
58
|
fail NotImplementedError
|
59
59
|
end
|
60
60
|
|
61
|
-
def self.ignore_409_exception(*)
|
62
|
-
yield
|
63
|
-
rescue => e
|
64
|
-
raise e unless e&.code == 409
|
65
|
-
nil
|
66
|
-
end
|
67
|
-
|
68
|
-
def cancel_task(task_href)
|
69
|
-
data = PulpcoreClient::TaskResponse.new(state: 'canceled')
|
70
|
-
self.class.ignore_409_exception do
|
71
|
-
tasks_api.tasks_cancel(task_href, data)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
61
|
def exporter_api
|
76
62
|
PulpcoreClient::ExportersPulpApi.new(core_api_client)
|
77
63
|
end
|
@@ -35,8 +35,7 @@ module Katello
|
|
35
35
|
custom_json["issued"] = convert_date_if_epoch(custom_json["issued"])
|
36
36
|
custom_json["updated"] = convert_date_if_epoch(custom_json["updated"]) unless custom_json["updated"].blank?
|
37
37
|
|
38
|
-
if model.updated.blank? ||
|
39
|
-
(custom_json['updated'] && (custom_json['updated'].to_datetime != model.updated.to_datetime))
|
38
|
+
if model.updated.blank? || (custom_json['updated'].to_datetime != model.updated.to_datetime)
|
40
39
|
custom_json['errata_id'] = custom_json.delete('id')
|
41
40
|
custom_json['errata_type'] = custom_json.delete('type')
|
42
41
|
custom_json['updated'] = custom_json['updated'].blank? ? custom_json['issued'] : custom_json['updated']
|
@@ -4,8 +4,6 @@ module Katello
|
|
4
4
|
module Pulp3
|
5
5
|
class Migration
|
6
6
|
attr_accessor :smart_proxy, :reimport_all, :task_id
|
7
|
-
attr_reader :repository_types
|
8
|
-
|
9
7
|
GET_QUERY_ID_LENGTH = 90
|
10
8
|
|
11
9
|
MUTABLE_CONTENT_TYPES = [
|
@@ -17,12 +15,6 @@ module Katello
|
|
17
15
|
Katello::Erratum
|
18
16
|
].freeze
|
19
17
|
|
20
|
-
CORRUPTABLE_CONTENT_TYPES = [
|
21
|
-
Katello::Rpm,
|
22
|
-
Katello::FileUnit,
|
23
|
-
Katello::Deb
|
24
|
-
].freeze
|
25
|
-
|
26
18
|
def self.repository_types_for_migration
|
27
19
|
#we can migrate types that pulp3 supports, but are overridden to pulp2. These are in 'migration mode'
|
28
20
|
overridden = (SETTINGS[:katello][:use_pulp_2_for_content_type] || {}).keys.select { |key| SETTINGS[:katello][:use_pulp_2_for_content_type][key] }
|
@@ -74,9 +66,7 @@ module Katello
|
|
74
66
|
|
75
67
|
def last_successful_migration_time
|
76
68
|
task = ForemanTasks::Task.where(:label => Actions::Pulp3::ContentMigration.to_s, :result => 'success').order("started_at desc").first
|
77
|
-
|
78
|
-
reset_more_recent = reset_task && task && reset_task.started_at > task.started_at
|
79
|
-
if reimport_all || task.nil? || reset_more_recent
|
69
|
+
if reimport_all || task.nil?
|
80
70
|
0
|
81
71
|
else
|
82
72
|
task.started_at.to_i
|
@@ -114,7 +104,6 @@ module Katello
|
|
114
104
|
Katello::RepositoryTypeManager.repository_types[repository_type_label].content_types_to_index.each do |content_type|
|
115
105
|
Katello::Logging.time("CONTENT_MIGRATION - Importing Content", data: {type: content_type.label}) do
|
116
106
|
import_content_type(content_type)
|
117
|
-
mark_missing_content(content_type)
|
118
107
|
end
|
119
108
|
end
|
120
109
|
end
|
@@ -125,48 +114,9 @@ module Katello
|
|
125
114
|
Katello::Pulp3::MigrationPlan.new(@repository_types).generate.as_json
|
126
115
|
end
|
127
116
|
|
128
|
-
def reset
|
129
|
-
if @repository_types.empty?
|
130
|
-
fail ::Katello::Errors::Pulp3MigrationError, 'There are no Pulp 3 content types to reset'
|
131
|
-
end
|
132
|
-
|
133
|
-
plugins = @repository_types.sort.map do |repository_type|
|
134
|
-
{
|
135
|
-
type: ::Katello::Pulp3::MigrationPlan.pulp2_repository_type(repository_type)
|
136
|
-
}
|
137
|
-
end
|
138
|
-
plan = { plugins: plugins }
|
139
|
-
|
140
|
-
pulp3_task = migration_plan_api.reset(migration_plan_api.create(plan: plan).pulp_href)
|
141
|
-
|
142
|
-
content_types_for_migration.each do |content_type|
|
143
|
-
if content_type.model_class == ::Katello::Erratum
|
144
|
-
::Katello::RepositoryErratum.update_all(erratum_pulp3_href: nil)
|
145
|
-
else
|
146
|
-
content_type.model_class.update_all(migrated_pulp3_href: nil, missing_from_migration: false, ignore_missing_from_migration: false)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
@repository_types.each do |repo_type|
|
151
|
-
if repo_type == "file"
|
152
|
-
::Katello::Repository.file_type.update_all(remote_href: nil, publication_href: nil, version_href: nil)
|
153
|
-
elsif repo_type == "docker"
|
154
|
-
::Katello::Repository.docker_type.update_all(remote_href: nil, publication_href: nil, version_href: nil)
|
155
|
-
elsif repo_type == "yum"
|
156
|
-
::Katello::Repository.yum_type.update_all(remote_href: nil, publication_href: nil, version_href: nil)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
::Katello::Pulp3::RepositoryReference.destroy_all
|
161
|
-
::Katello::Pulp3::DistributionReference.destroy_all
|
162
|
-
::Katello::Pulp3::ContentGuard.destroy_all
|
163
|
-
|
164
|
-
pulp3_task
|
165
|
-
end
|
166
|
-
|
167
117
|
def create_migrations
|
168
118
|
plan = migration_plan
|
169
|
-
Rails.logger.info("Migration Plan: #{plan
|
119
|
+
Rails.logger.info("Migration Plan: #{plan}")
|
170
120
|
|
171
121
|
if plan['plugins'].empty?
|
172
122
|
Rails.logger.error("No Repositories to migrate")
|
@@ -177,7 +127,7 @@ module Katello
|
|
177
127
|
end
|
178
128
|
|
179
129
|
def start_migration(plan_href)
|
180
|
-
migration_plan_api.run(plan_href, dry_run: false, validate: true
|
130
|
+
migration_plan_api.run(plan_href, dry_run: false, validate: true)
|
181
131
|
end
|
182
132
|
|
183
133
|
def import_repositories(repository_type_label)
|
@@ -216,7 +166,7 @@ module Katello
|
|
216
166
|
|
217
167
|
if to_find
|
218
168
|
found = migrated_repo_items.find { |migrated_repo| migrated_repo.pulp2_repo_id == to_find.pulp_id }
|
219
|
-
import_repo(yum_repo, found)
|
169
|
+
import_repo(yum_repo, found)
|
220
170
|
end
|
221
171
|
end
|
222
172
|
end
|
@@ -305,35 +255,10 @@ module Katello
|
|
305
255
|
to_import[[errata_id, repo_id]] ||= {erratum_id: errata_id, erratum_pulp3_href: pulp3_href, repository_id: repo_id}
|
306
256
|
end
|
307
257
|
end
|
308
|
-
|
309
|
-
Katello::RepositoryErratum.import([:erratum_id, :erratum_pulp3_href, :repository_id], to_import.values, :validate => false,
|
310
|
-
on_duplicate_key_update: {conflict_target: [:erratum_id, :repository_id], columns: [:erratum_pulp3_href]})
|
311
|
-
to_import = {}
|
312
|
-
end
|
313
|
-
correct_missing_errata
|
314
|
-
end
|
315
|
-
|
316
|
-
def correct_missing_errata
|
317
|
-
Katello::RepositoryErratum.where(:erratum_pulp3_href => nil).pluck(:repository_id).uniq.each do |repo_id|
|
318
|
-
repo = Katello::Repository.find(repo_id)
|
319
|
-
if repo.link?
|
320
|
-
target = repo.target_repository
|
321
|
-
to_import = []
|
322
|
-
target.repository_errata.each do |repo_errata|
|
323
|
-
to_import << {erratum_id: repo_errata.erratum_id, erratum_pulp3_href: repo_errata.erratum_pulp3_href, repository_id: repo_id}
|
324
|
-
end
|
325
|
-
Katello::RepositoryErratum.import([:erratum_id, :erratum_pulp3_href, :repository_id], to_import, :validate => false,
|
326
|
-
on_duplicate_key_update: {conflict_target: [:erratum_id, :repository_id], columns: [:erratum_pulp3_href]})
|
327
|
-
else
|
328
|
-
Rails.logger.error("Unexpectedly found target repo (ID=#{repo_id}) with missing migrated errata!")
|
329
|
-
end
|
330
258
|
end
|
331
|
-
end
|
332
259
|
|
333
|
-
|
334
|
-
|
335
|
-
content_type.model_class.where(:migrated_pulp3_href => nil).update_all(:missing_from_migration => true)
|
336
|
-
end
|
260
|
+
Katello::RepositoryErratum.import([:erratum_id, :erratum_pulp3_href, :repository_id], to_import.values, :validate => false,
|
261
|
+
on_duplicate_key_update: {conflict_target: [:erratum_id, :repository_id], columns: [:erratum_pulp3_href]})
|
337
262
|
end
|
338
263
|
|
339
264
|
def import_content_type(content_type)
|
@@ -353,9 +278,10 @@ module Katello
|
|
353
278
|
unmigrated_units.select(:id, :pulp_id).find_in_batches(batch_size: GET_QUERY_ID_LENGTH) do |needing_hrefs|
|
354
279
|
current_count += needing_hrefs.count
|
355
280
|
update_import_status("Importing migrated content type #{content_type.label}: #{current_count}/#{total_count}")
|
356
|
-
migrated_units = pulp2_content_api.list(pulp2_id__in: needing_hrefs.map(
|
281
|
+
migrated_units = pulp2_content_api.list(pulp2_id__in: needing_hrefs.map { |unit| unit.pulp_id }.join(','))
|
357
282
|
migrated_units.results.each do |migrated_unit|
|
358
|
-
|
283
|
+
matching_record = needing_hrefs.find { |db_unit| db_unit.pulp_id == migrated_unit.pulp2_id }
|
284
|
+
matching_record&.update_column(:migrated_pulp3_href, migrated_unit.pulp3_content)
|
359
285
|
end
|
360
286
|
end
|
361
287
|
end
|
@@ -14,19 +14,20 @@ module Katello
|
|
14
14
|
Katello::Logging.time("CONTENT_MIGRATION - Generating Migration plan") do
|
15
15
|
plan[:plugins] = generate_plugins
|
16
16
|
end
|
17
|
+
Rails.logger.error("Migration Plan: #{plan.to_json}")
|
17
18
|
plan
|
18
19
|
end
|
19
20
|
|
20
21
|
def generate_plugins
|
21
22
|
@repository_types.sort.map do |repository_type|
|
22
23
|
{
|
23
|
-
type:
|
24
|
+
type: pulp2_repository_type(repository_type),
|
24
25
|
repositories: repository_migrations(repository_type)
|
25
26
|
}
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
29
|
-
def
|
30
|
+
def pulp2_repository_type(repository_type)
|
30
31
|
if repository_type == 'yum'
|
31
32
|
return 'rpm' #migration plugin uses rpm
|
32
33
|
else
|
@@ -38,7 +39,6 @@ module Katello
|
|
38
39
|
roots = Katello::RootRepository.where(:content_type => repo_type).order(:label)
|
39
40
|
plans = []
|
40
41
|
roots.each do |root|
|
41
|
-
next unless root.library_instance
|
42
42
|
plans << library_migration_for(root)
|
43
43
|
plans += content_view_migrations_for(root)
|
44
44
|
end
|
@@ -64,8 +64,6 @@ module Katello
|
|
64
64
|
def library_migration_for(root)
|
65
65
|
repo = root.library_instance
|
66
66
|
|
67
|
-
return nil unless library_repo_safe_to_migrate?(repo)
|
68
|
-
|
69
67
|
migration = {
|
70
68
|
name: repo.pulp_id,
|
71
69
|
repository_versions: [
|
@@ -79,49 +77,10 @@ module Katello
|
|
79
77
|
migration
|
80
78
|
end
|
81
79
|
|
82
|
-
def library_repo_safe_to_migrate?(repo)
|
83
|
-
publish_tasks = ForemanTasks::Task.where(label: 'Actions::Katello::ContentView::Publish')
|
84
|
-
publishing_repo_ids = publish_tasks.where(state: ['scheduled', 'running']).collect do |task|
|
85
|
-
::Katello::ContentViewVersion.find(task.input[:content_view_version_id]).library_repos.pluck(:id)
|
86
|
-
end
|
87
|
-
publishing_repo_ids = publishing_repo_ids.flatten
|
88
|
-
|
89
|
-
if publishing_repo_ids.include?(repo.id)
|
90
|
-
warn_string = "Library repository with ID #{repo.id} and name #{repo.name} unmigrated due to being "\
|
91
|
-
"associated with an actively-publishing content view. The migration will need to be run again."
|
92
|
-
Rails.logger.warn(warn_string)
|
93
|
-
return false
|
94
|
-
end
|
95
|
-
|
96
|
-
create_root_tasks = ForemanTasks::Task.where(label: 'Actions::Katello::Repository::CreateRoot')
|
97
|
-
active_creation_task = create_root_tasks.where(state: ['scheduled', 'running']).detect do |task|
|
98
|
-
task.input[:repository][:id] == repo.id
|
99
|
-
end
|
100
|
-
|
101
|
-
if active_creation_task.present?
|
102
|
-
warn_string = "Repository with ID #{repo.id} and name #{repo.name} unmigrated due to being "\
|
103
|
-
"created during the Pulp 3 migration. The migration will need to be run again."
|
104
|
-
Rails.logger.warn(warn_string)
|
105
|
-
return false
|
106
|
-
end
|
107
|
-
true
|
108
|
-
end
|
109
|
-
|
110
80
|
def content_view_migrations_for(root)
|
111
|
-
publish_tasks = ForemanTasks::Task.where(label: 'Actions::Katello::ContentView::Publish')
|
112
|
-
publishing_cv_ids = publish_tasks.where(state: ['scheduled', 'running']).collect do |task|
|
113
|
-
task.input[:content_view_id]
|
114
|
-
end
|
115
|
-
|
116
81
|
plans = []
|
117
82
|
ContentView.non_default.published_with_repositories(root).sort_by(&:label).each do |cv|
|
118
|
-
|
119
|
-
warn_string = "Repositories belonging to Content View with ID #{cv.id} and name #{cv.name} unmigrated "\
|
120
|
-
"due to being created during the Pulp 3 migration. The migration will need to be run again."
|
121
|
-
Rails.logger.warn(warn_string)
|
122
|
-
else
|
123
|
-
plans << content_view_migration(cv, root)
|
124
|
-
end
|
83
|
+
plans << content_view_migration(cv, root)
|
125
84
|
end
|
126
85
|
plans
|
127
86
|
end
|
@@ -146,15 +105,7 @@ module Katello
|
|
146
105
|
end
|
147
106
|
|
148
107
|
def name_for_content_view(content_view, root_repo)
|
149
|
-
|
150
|
-
|
151
|
-
if Katello::RootRepository.where(:label => root_repo.label).group(:label).count(:label)[root_repo.label] > 1
|
152
|
-
repo_query = Katello::Repository.joins(:root, :content_view_version => :content_view).
|
153
|
-
where("#{::Katello::RootRepository.table_name}.id != #{root_repo.id}").
|
154
|
-
where("#{::Katello::RootRepository.table_name}.label" => root_repo.label, "#{::Katello::ContentView.table_name}.label" => content_view.label)
|
155
|
-
name += "-#{root_repo.id}" if repo_query.any?
|
156
|
-
end
|
157
|
-
name
|
108
|
+
"#{content_view.label}-#{root_repo.label}"
|
158
109
|
end
|
159
110
|
|
160
111
|
def content_view_migration(content_view, root)
|
@@ -21,20 +21,6 @@ module Katello
|
|
21
21
|
Katello::Logging.time("CONTENT_SWITCHOVER - combine_duplicate_content_types") { combine_duplicate_content_types }
|
22
22
|
Katello::Logging.time("CONTENT_SWITCHOVER - combine_duplicate_docker_tags") { combine_duplicate_docker_tags } if docker_migration?
|
23
23
|
Katello::Logging.time("CONTENT_SWITCHOVER - migrate_pulp3_hrefs") { migrate_pulp3_hrefs }
|
24
|
-
Katello::Logging.time("CONTENT_SWITCHOVER - remove_missing_content") { remove_missing_content }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def remove_orphaned_content
|
29
|
-
models = []
|
30
|
-
@migration.repository_types.each do |repo_type_label|
|
31
|
-
repo_type = ::Katello::RepositoryTypeManager.repository_types[repo_type_label]
|
32
|
-
indexable_types = repo_type.content_types_to_index
|
33
|
-
models += indexable_types&.map(&:model_class)
|
34
|
-
models.select! { |model| model.many_repository_associations }
|
35
|
-
end
|
36
|
-
models.each do |model|
|
37
|
-
model.joins("left join katello_#{model.repository_association} on #{model.table_name}.id = katello_#{model.repository_association}.#{model.unit_id_field}").where("katello_#{model.repository_association}.#{model.unit_id_field} IS NULL").destroy_all
|
38
24
|
end
|
39
25
|
end
|
40
26
|
|
@@ -120,29 +106,12 @@ module Katello
|
|
120
106
|
end
|
121
107
|
end
|
122
108
|
|
123
|
-
def remove_missing_content
|
124
|
-
content_types.each do |content_type|
|
125
|
-
if Migration::CORRUPTABLE_CONTENT_TYPES.include?(content_type.model_class)
|
126
|
-
content_type.model_class.ignored_missing_migrated_content.destroy_all
|
127
|
-
elsif content_type.model_class == Katello::Erratum
|
128
|
-
Katello::RepositoryErratum.where(:erratum_pulp3_href => nil).delete_all
|
129
|
-
else
|
130
|
-
content_type.model_class.unmigrated_content.destroy_all
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
109
|
def migrated_content_type_check
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
fail SwitchOverError, "ERROR: at least one #{content_type.table_name} record has been detected as corrupt or missing. Run 'foreman-rake katello:pulp3_migration_stats' for more information.\n"
|
142
|
-
end
|
143
|
-
|
144
|
-
if content_type.unmigrated_content.any?
|
145
|
-
fail SwitchOverError, "ERROR: at least one #{content_type.table_name} record was not able to be migrated\n"
|
110
|
+
content_types.each do |content_type|
|
111
|
+
if content_type.model_class == Katello::Erratum
|
112
|
+
migrated_errata_check
|
113
|
+
elsif content_type.model_class.where(migrated_pulp3_href: nil).any?
|
114
|
+
fail SwitchOverError, "ERROR: at least one #{content_type.model_class.table_name} record has migrated_pulp3_href NULL value\n"
|
146
115
|
end
|
147
116
|
end
|
148
117
|
end
|
@@ -27,7 +27,8 @@ module Katello
|
|
27
27
|
popts = super(repository_version)
|
28
28
|
popts.merge!(
|
29
29
|
{
|
30
|
-
structured
|
30
|
+
# structured is not necessary for subscription-manager
|
31
|
+
#structured: true, # publish real suites (e.g. 'stable')
|
31
32
|
simple: true # publish all into 'default'-suite
|
32
33
|
}
|
33
34
|
)
|
@@ -14,16 +14,7 @@ module Katello
|
|
14
14
|
url, sles_token = extract_sles_token
|
15
15
|
options = common_remote_options
|
16
16
|
options.merge!(sles_auth_token: sles_token) if sles_token
|
17
|
-
|
18
|
-
options.merge!(url: url, policy: translated_download_policy)
|
19
|
-
end
|
20
|
-
|
21
|
-
def translated_download_policy
|
22
|
-
if root.download_policy == ::Runcible::Models::YumImporter::DOWNLOAD_BACKGROUND
|
23
|
-
::Runcible::Models::YumImporter::DOWNLOAD_IMMEDIATE
|
24
|
-
else
|
25
|
-
root.download_policy
|
26
|
-
end
|
17
|
+
options.merge!(url: url, policy: root.download_policy)
|
27
18
|
end
|
28
19
|
|
29
20
|
def extract_sles_token
|
@@ -349,7 +340,7 @@ module Katello
|
|
349
340
|
multi_copy_units(repo_id_map, dependency_solving)
|
350
341
|
end
|
351
342
|
|
352
|
-
def copy_content_for_source(source_repository, options = {})
|
343
|
+
def copy_content_for_source(source_repository, options = {}) # rubocop:disable Metrics/CyclomaticComplexity
|
353
344
|
filters = [ContentViewErratumFilter, ContentViewPackageGroupFilter, ContentViewPackageFilter].collect do |filter_class|
|
354
345
|
filter_class.where(:id => options[:filter_ids])
|
355
346
|
end
|