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
@@ -1,126 +0,0 @@
|
|
1
|
-
# Used exclusively by fix_hostgroup_facets.rake task
|
2
|
-
module Katello
|
3
|
-
module Util
|
4
|
-
class HostgroupFacetsHelper
|
5
|
-
def initialize
|
6
|
-
@logger = Logger.new($stdout)
|
7
|
-
end
|
8
|
-
|
9
|
-
def interested_hostgroups
|
10
|
-
groups = ::Hostgroup.unscoped.where(
|
11
|
-
id: Katello::Hostgroup::ContentFacet.
|
12
|
-
where(content_source_id: nil,
|
13
|
-
kickstart_repository_id: nil,
|
14
|
-
content_view_id: nil,
|
15
|
-
lifecycle_environment_id: nil).select(:hostgroup_id))
|
16
|
-
parents = groups.select { |group| group.parent.blank? }
|
17
|
-
children = groups.reject { |group| group.parent.blank? }
|
18
|
-
# we want the parents to get created before the children
|
19
|
-
# hence the order
|
20
|
-
parents + children
|
21
|
-
end
|
22
|
-
|
23
|
-
def pick_facet_values(hg)
|
24
|
-
# This call looks at the audit logs for a host group.
|
25
|
-
# Pries out information related to lce, ks, cv and content_source_id from the audit logs.
|
26
|
-
# The audit logs typically only contain updates.
|
27
|
-
# So if the user changed just the content_view_id, then that is the only thing marked as audited_changes.
|
28
|
-
# Hence we need to go through all the audit logs until we have information on lce, ks, cv and cs.
|
29
|
-
# If there was only one audit log and that was during the creation of hostgroup
|
30
|
-
# the audited changes look like this
|
31
|
-
# ```ruby
|
32
|
-
# {
|
33
|
-
# content_view_id: 10,
|
34
|
-
# kickstart_repository_id: 1000
|
35
|
-
# ......
|
36
|
-
# }
|
37
|
-
# ```
|
38
|
-
# However if you updated the hostgroup and set the kickstart_repository_id, or
|
39
|
-
# content_view_id then audited changes look like
|
40
|
-
# ```ruby
|
41
|
-
# {
|
42
|
-
# content_view_id: [10, 11],
|
43
|
-
# kickstart_repository_id: [1000, 1200]
|
44
|
-
# ......
|
45
|
-
# }
|
46
|
-
# ```
|
47
|
-
# So the code says "if the attribute value is an array pick the last value else just keep the value as it is "
|
48
|
-
|
49
|
-
# Further along it is to be noted that `hostgroup.audits` returns the audits ordered by the version number in ascending order, so the latest audit will be `hostgroup.audits.last`
|
50
|
-
|
51
|
-
# We want to iterate though each audit from latest audit to start, and as soon as we find a content_view_id key or kickstart_repository_id key or lifecycle environment_id key or content_source_id key we want it to be set once.
|
52
|
-
|
53
|
-
# So if I had an audit history like
|
54
|
-
# ``` ruby
|
55
|
-
# {
|
56
|
-
# content_view_id: 10,
|
57
|
-
# kickstart_repository_id: 1000,
|
58
|
-
# version:1
|
59
|
-
# ......
|
60
|
-
# },
|
61
|
-
# {
|
62
|
-
# content_view_id: [10, 11],
|
63
|
-
# kickstart_repository_id: [1000, 1200],
|
64
|
-
# version: 2
|
65
|
-
# ......
|
66
|
-
# }
|
67
|
-
# ```
|
68
|
-
|
69
|
-
# The code would start at version 2, notice that cv_id and ks_repo were set there
|
70
|
-
# and keep them as the final.
|
71
|
-
# So when it goes to version 1 since cv_id and ks_repo are already set,
|
72
|
-
# it will ignore. It will finally
|
73
|
-
# return {content_view_id: 11, kickstart_repository_id: 1200}
|
74
|
-
facet_values = {}
|
75
|
-
hg.audits.reverse_each do |audit|
|
76
|
-
hg_changes = audit.audited_changes.slice("lifecycle_environment_id",
|
77
|
-
"kickstart_repository_id",
|
78
|
-
"content_view_id",
|
79
|
-
"content_source_id")
|
80
|
-
facet_values = hg_changes.merge(facet_values)
|
81
|
-
end
|
82
|
-
|
83
|
-
values = facet_values.map do |k, v|
|
84
|
-
v = v[-1] if v.is_a? Array
|
85
|
-
[k, v]
|
86
|
-
end
|
87
|
-
values.to_h.with_indifferent_access
|
88
|
-
end
|
89
|
-
|
90
|
-
def main
|
91
|
-
bad_hgs = []
|
92
|
-
good_hgs = []
|
93
|
-
|
94
|
-
groups = interested_hostgroups.each do |hg|
|
95
|
-
facet = hg.content_facet
|
96
|
-
values = pick_facet_values(hg)
|
97
|
-
if !values.empty? && facet.update(values)
|
98
|
-
good_hgs << { hostgroup: hg, facet_values: values }
|
99
|
-
else
|
100
|
-
bad_hgs << { hostgroup: hg, facet_values: values }
|
101
|
-
facet.save(validate: false)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
unless bad_hgs.empty?
|
106
|
-
@logger.warn "Some of the hostgroups reported a validation error. "\
|
107
|
-
"The hostgroups have been updated. "\
|
108
|
-
"Check via the Web UI."
|
109
|
-
|
110
|
-
bad_hgs.each do |bad_group|
|
111
|
-
@logger.warn "Hostgroup #{bad_group[:hostgroup]}"
|
112
|
-
@logger.warn "Facet Values #{bad_group[:facet_values]}"
|
113
|
-
end
|
114
|
-
end
|
115
|
-
unless good_hgs.empty?
|
116
|
-
@logger.info "Following hostgroups were succesfully updated."
|
117
|
-
good_hgs.each do |good_group|
|
118
|
-
@logger.info "Hostgroup #{good_group[:hostgroup]}"
|
119
|
-
@logger.info "Facet Values #{good_group[:facet_values]}"
|
120
|
-
end
|
121
|
-
end
|
122
|
-
@logger.info("#{groups.count} Hostgroup(s) were updated.")
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
@@ -1,135 +0,0 @@
|
|
1
|
-
module Katello
|
2
|
-
class EventDaemon
|
3
|
-
@services = {}
|
4
|
-
@cache = ActiveSupport::Cache::MemoryStore.new
|
5
|
-
|
6
|
-
class Monitor
|
7
|
-
def initialize(service_classes)
|
8
|
-
@service_classes = service_classes
|
9
|
-
end
|
10
|
-
|
11
|
-
def start
|
12
|
-
error = nil
|
13
|
-
status = nil
|
14
|
-
loop do
|
15
|
-
Rails.application.executor.wrap do
|
16
|
-
check_services(error, status)
|
17
|
-
end
|
18
|
-
sleep 15
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def check_services(error, status)
|
23
|
-
@service_classes.each do |service_class|
|
24
|
-
status = service_class.status
|
25
|
-
rescue => error
|
26
|
-
Rails.logger.error("Error occurred while pinging #{service_class}")
|
27
|
-
Rails.logger.error(error.message)
|
28
|
-
Rails.logger.error(error.backtrace.join("\n"))
|
29
|
-
ensure
|
30
|
-
if error || !status&.dig(:running)
|
31
|
-
begin
|
32
|
-
service_class.close
|
33
|
-
service_class.run
|
34
|
-
service_class.status
|
35
|
-
rescue => error
|
36
|
-
Rails.logger.error("Error occurred while starting #{service_class}")
|
37
|
-
Rails.logger.error(error.message)
|
38
|
-
Rails.logger.error(error.backtrace.join("\n"))
|
39
|
-
ensure
|
40
|
-
error = nil
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
class << self
|
48
|
-
def initialize
|
49
|
-
FileUtils.touch(lock_file)
|
50
|
-
end
|
51
|
-
|
52
|
-
def settings
|
53
|
-
SETTINGS[:katello][:event_daemon]
|
54
|
-
end
|
55
|
-
|
56
|
-
def pid
|
57
|
-
return unless pid_file && File.exist?(pid_file)
|
58
|
-
|
59
|
-
File.open(pid_file) { |f| f.read.to_i }
|
60
|
-
end
|
61
|
-
|
62
|
-
def pid_file
|
63
|
-
pid_dir.join('katello_event_daemon.pid')
|
64
|
-
end
|
65
|
-
|
66
|
-
def pid_dir
|
67
|
-
Rails.root.join('tmp', 'pids')
|
68
|
-
end
|
69
|
-
|
70
|
-
def lock_file
|
71
|
-
Rails.root.join('tmp', 'katello_event_daemon.lock')
|
72
|
-
end
|
73
|
-
|
74
|
-
def write_pid_file
|
75
|
-
return unless pid_file
|
76
|
-
|
77
|
-
FileUtils.mkdir_p(pid_dir)
|
78
|
-
File.open(pid_file, 'w') { |f| f.puts Process.pid }
|
79
|
-
end
|
80
|
-
|
81
|
-
def stop
|
82
|
-
return unless pid == Process.pid
|
83
|
-
@monitor_thread.kill
|
84
|
-
@cache.clear
|
85
|
-
@services.values.each(&:close)
|
86
|
-
File.unlink(pid_file) if pid_file && File.exist?(pid_file)
|
87
|
-
end
|
88
|
-
|
89
|
-
def start
|
90
|
-
return unless runnable?
|
91
|
-
|
92
|
-
lockfile = File.open(lock_file, 'r')
|
93
|
-
begin
|
94
|
-
lockfile.flock(File::LOCK_EX)
|
95
|
-
return if started? # ensure it wasn't started while we waited for the lock
|
96
|
-
|
97
|
-
start_monitor_thread
|
98
|
-
write_pid_file
|
99
|
-
|
100
|
-
at_exit do
|
101
|
-
stop
|
102
|
-
end
|
103
|
-
|
104
|
-
Rails.logger.info("Katello event daemon started process=#{Process.pid}")
|
105
|
-
ensure
|
106
|
-
lockfile.flock(File::LOCK_UN)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def started?
|
111
|
-
Process.kill(0, pid)
|
112
|
-
true
|
113
|
-
rescue Errno::ESRCH, TypeError # process no longer exists or we had no PID cached
|
114
|
-
false
|
115
|
-
end
|
116
|
-
|
117
|
-
def start_monitor_thread
|
118
|
-
@monitor_thread = Thread.new do
|
119
|
-
Monitor.new(@services.values).start
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def runnable?
|
124
|
-
# avoid accessing the disk on each request
|
125
|
-
@cache.fetch('katello_event_daemon_runnable', expires_in: 1.minute) do
|
126
|
-
!started? && settings[:enabled] && !::Foreman.in_rake? && !Rails.env.test?
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def register_service(name, klass)
|
131
|
-
@services[name] = klass
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
module Katello
|
2
|
-
module Pulp
|
3
|
-
class ContentCountsCalculator
|
4
|
-
def initialize(repos)
|
5
|
-
@repos = repos
|
6
|
-
end
|
7
|
-
|
8
|
-
# rubocop:disable Metrics/MethodLength
|
9
|
-
def calculate
|
10
|
-
counts = {
|
11
|
-
:apt_repositories => 0,
|
12
|
-
:deb_packages => 0,
|
13
|
-
:yum_repositories => 0,
|
14
|
-
:packages => 0,
|
15
|
-
:package_groups => 0,
|
16
|
-
:errata => 0,
|
17
|
-
:puppet_repositories => 0,
|
18
|
-
:puppet_modules => 0,
|
19
|
-
:docker_repositories => 0,
|
20
|
-
:docker_images => 0
|
21
|
-
}
|
22
|
-
|
23
|
-
@repos.each do |repo|
|
24
|
-
case
|
25
|
-
when repo_type?(repo, 'deb')
|
26
|
-
counts[:apt_repositories] += 1
|
27
|
-
counts[:deb_packages] += get_unit_count(repo, 'deb')
|
28
|
-
when repo_type?(repo, 'rpm')
|
29
|
-
counts[:yum_repositories] += 1
|
30
|
-
counts[:packages] += get_unit_count(repo, 'rpm')
|
31
|
-
counts[:package_groups] += get_unit_count(repo, 'package_group')
|
32
|
-
counts[:errata] += get_unit_count(repo, 'erratum')
|
33
|
-
when repo_type?(repo, 'docker')
|
34
|
-
counts[:docker_repositories] += 1
|
35
|
-
counts[:docker_images] += get_unit_count(repo, 'docker_image')
|
36
|
-
when repo_type?(repo, 'puppet')
|
37
|
-
counts[:puppet_repositories] += 1
|
38
|
-
counts[:puppet_modules] += get_unit_count(repo, 'puppet_module')
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
counts
|
43
|
-
end
|
44
|
-
|
45
|
-
protected
|
46
|
-
|
47
|
-
def repo_type?(repo, repo_type)
|
48
|
-
repo['notes'] && (repo['notes']['_repo-type'] == "#{repo_type}-repo")
|
49
|
-
end
|
50
|
-
|
51
|
-
def get_unit_count(repo, unit_type)
|
52
|
-
if repo['content_unit_counts']
|
53
|
-
repo['content_unit_counts'][unit_type] || 0
|
54
|
-
else
|
55
|
-
0
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class AddMigrationMissingContent < ActiveRecord::Migration[6.0]
|
2
|
-
def change
|
3
|
-
content_models = [Katello::Rpm, Katello::ModuleStream, Katello::Erratum, Katello::PackageGroup, Katello::YumMetadataFile,
|
4
|
-
Katello::Srpm, Katello::FileUnit, Katello::DockerManifestList, Katello::DockerManifest, Katello::DockerTag,
|
5
|
-
Katello::Deb]
|
6
|
-
|
7
|
-
content_models.each do |model|
|
8
|
-
add_column model.table_name, :missing_from_migration, :bool, :default => false, :null => false
|
9
|
-
add_column model.table_name, :ignore_missing_from_migration, :bool, :default => false, :null => false
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
task :check_config => ['environment'] do
|
3
|
-
desc "Task that can be run before a content migration to check that the configuration valid"
|
4
|
-
fail_msg = _("The system appears to already be using pulp3 with all content migrated.")
|
5
|
-
|
6
|
-
puts "Checking for valid Katello configuraton."
|
7
|
-
if SETTINGS[:katello][:use_pulp_2_for_content_type].nil?
|
8
|
-
fail fail_msg
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
desc "This task collates hostgroup content facts that were missed during the upgrade from audit.\
|
3
|
-
It then updates the hostgroup content_facet accordingly."
|
4
|
-
task :fix_hostgroup_facets => :environment do
|
5
|
-
User.current = User.anonymous_admin
|
6
|
-
::Katello::Util::HostgroupFacetsHelper.new.main
|
7
|
-
end
|
8
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
desc "Marks corrupted or missing content as approved to be ignored during the migration"
|
3
|
-
task :approve_corrupted_migration_content => ["dynflow:client"] do
|
4
|
-
services = [:candlepin, :foreman_tasks, :pulp3, :pulp, :pulp_auth]
|
5
|
-
Katello::Ping.ping!(services: services)
|
6
|
-
|
7
|
-
Katello::Pulp3::Migration::CORRUPTABLE_CONTENT_TYPES.each do |type|
|
8
|
-
type.missing_migrated_content.update_all(:ignore_missing_from_migration => true)
|
9
|
-
end
|
10
|
-
puts "Any missing or corrupt content will be ignored on migration to Pulp 3. This can be undone with 'foreman-rake katello:unapprove_corrupted_migration_content'"
|
11
|
-
end
|
12
|
-
|
13
|
-
task :unapprove_corrupted_migration_content => ["dynflow:client"] do
|
14
|
-
services = [:candlepin, :foreman_tasks, :pulp3, :pulp, :pulp_auth]
|
15
|
-
Katello::Ping.ping!(services: services)
|
16
|
-
Katello::Pulp3::Migration::CORRUPTABLE_CONTENT_TYPES.each do |type|
|
17
|
-
type.ignored_missing_migrated_content.update_all(:ignore_missing_from_migration => false)
|
18
|
-
end
|
19
|
-
puts "Resetting approval on any corrupted or missing content, you may want to re-run the 'foreman-maintain content prepare' step to attempt re-migration."
|
20
|
-
end
|
21
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
desc "Reset the Pulp 2 -> Pulp 3 migration for content types that haven't been fully switched over"
|
3
|
-
task :pulp3_migration_reset => ["dynflow:client", "check_ping"] do
|
4
|
-
puts "Starting Content Migration Reset."
|
5
|
-
SmartProxy.pulp_primary.refresh
|
6
|
-
|
7
|
-
task = ForemanTasks.async_task(Actions::Pulp3::ContentMigrationReset, SmartProxy.pulp_primary)
|
8
|
-
|
9
|
-
if ENV['wait'].nil? || ::Foreman::Cast.to_bool(ENV['wait'])
|
10
|
-
until !task.pending? || task.paused?
|
11
|
-
sleep(20)
|
12
|
-
task = ForemanTasks::Task.find(task.id)
|
13
|
-
end
|
14
|
-
|
15
|
-
if task.result == 'warning' || task.result == 'pending'
|
16
|
-
msg = _("Content Migration Reset failed, You will want to investigate: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}\n")
|
17
|
-
$stderr.print(msg)
|
18
|
-
fail ForemanTasks::TaskError, task
|
19
|
-
else
|
20
|
-
puts _("Content Migration Reset completed successfully")
|
21
|
-
end
|
22
|
-
else
|
23
|
-
puts "Content Migration Reset started, you may monitor it at: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
load "#{Rails.root}/lib/tasks/reports.rake"
|
2
|
-
|
3
|
-
#Katello reports can generate a foreman task, so mark the task as a dynflow client
|
4
|
-
["reports:daily", "reports:weekly", "reports:monthly"].each do |task|
|
5
|
-
Rake::Task[task].clear
|
6
|
-
Rake::Task[task].enhance ["dynflow:client"]
|
7
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
namespace :katello do
|
2
|
-
namespace :upgrades do
|
3
|
-
namespace '3.10' do
|
4
|
-
desc "Update repositories with API V1 GPG URLs"
|
5
|
-
task :update_gpg_key_urls => ["environment", "katello:check_ping"] do
|
6
|
-
User.current = User.anonymous_admin
|
7
|
-
|
8
|
-
::Organization.all.each do |org|
|
9
|
-
org_contents = Katello::Resources::Candlepin::Content.all(org.label, include_only: [:id, :gpgUrl])
|
10
|
-
|
11
|
-
org_contents.each do |cp_content|
|
12
|
-
gpg_url = cp_content['gpgUrl']
|
13
|
-
if gpg_url&.match(/katello\/api\/repositories/)
|
14
|
-
content = Katello::Content.where(cp_content_id: cp_content['id'], organization: org).first
|
15
|
-
|
16
|
-
if content.nil?
|
17
|
-
Rails.logger.warn("Candlepin Content id=#{cp_content['id']} isn't in our DB. Try running 'rake katello:reimport' first.")
|
18
|
-
else
|
19
|
-
root_repo = Katello::RootRepository.in_organization(org).where(content_id: content.cp_content_id).first
|
20
|
-
new_gpg_url = root_repo.library_instance.yum_gpg_key_url
|
21
|
-
cp_content['gpgUrl'] = new_gpg_url
|
22
|
-
Katello::Resources::Candlepin::Content.update(org.label, cp_content)
|
23
|
-
content.gpg_url = new_gpg_url
|
24
|
-
content.save!
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
const actionResolver = (rowData, { _rowIndex }) => {
|
2
|
-
// don't show actions for the expanded parts
|
3
|
-
if (rowData.parent || rowData.compoundParent || rowData.noactions) return null;
|
4
|
-
|
5
|
-
// printing to the console for now until these are hooked up
|
6
|
-
/* eslint-disable no-console */
|
7
|
-
return [
|
8
|
-
{
|
9
|
-
title: 'Publish and Promote',
|
10
|
-
onClick: (_event, rowId, _rowInfo) => console.log(`clicked on row ${rowId}`),
|
11
|
-
},
|
12
|
-
{
|
13
|
-
title: 'Promote',
|
14
|
-
onClick: (_event, rowId, _rowInfo) => console.log(`clicked on row ${rowId}`),
|
15
|
-
},
|
16
|
-
{
|
17
|
-
title: 'Copy',
|
18
|
-
onClick: (_event, rowId, _rowInfo) => console.log(`clicked on row ${rowId}`),
|
19
|
-
},
|
20
|
-
{
|
21
|
-
title: 'Delete',
|
22
|
-
onClick: (_event, rowId, _rowInfo) => console.log(`clicked on row ${rowId}`),
|
23
|
-
},
|
24
|
-
];
|
25
|
-
/* eslint-enable no-console */
|
26
|
-
};
|
27
|
-
|
28
|
-
export default actionResolver;
|