katello 4.1.4 → 4.2.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/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +2 -2
- data/app/controllers/katello/api/v2/content_credentials_controller.rb +3 -3
- data/app/controllers/katello/api/v2/content_uploads_controller.rb +3 -1
- data/app/controllers/katello/api/v2/content_view_components_controller.rb +33 -1
- data/app/controllers/katello/api/v2/content_views_controller.rb +12 -0
- data/app/controllers/katello/api/v2/host_errata_controller.rb +1 -1
- data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +1 -2
- data/app/controllers/katello/api/v2/products_controller.rb +4 -4
- data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +3 -11
- data/app/controllers/katello/api/v2/repositories_controller.rb +68 -47
- data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +0 -28
- data/app/controllers/katello/concerns/api/v2/registration_commands_controller_extensions.rb +26 -5
- data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +26 -1
- data/app/lib/actions/candlepin/environment/destroy.rb +2 -0
- data/app/lib/actions/katello/agent_action.rb +2 -2
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +3 -2
- data/app/lib/actions/katello/{gpg_key → content_credential}/update.rb +1 -1
- data/app/lib/actions/katello/content_view/publish.rb +6 -1
- data/app/lib/actions/katello/content_view_version/create_repos.rb +1 -1
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +0 -47
- data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +1 -1
- data/app/lib/actions/katello/repository/clone_contents.rb +1 -7
- data/app/lib/actions/katello/repository/clone_to_environment.rb +1 -7
- data/app/lib/actions/katello/repository/create.rb +4 -8
- data/app/lib/actions/katello/repository/create_root.rb +1 -1
- data/app/lib/actions/katello/repository/destroy.rb +1 -3
- data/app/lib/actions/katello/repository/import_upload.rb +3 -2
- data/app/lib/actions/katello/repository/instance_update.rb +1 -1
- data/app/lib/actions/katello/repository/metadata_generate.rb +2 -8
- data/app/lib/actions/katello/repository/multi_clone_contents.rb +0 -1
- data/app/lib/actions/katello/repository/refresh_repository.rb +1 -4
- data/app/lib/actions/katello/repository/remove_content.rb +6 -4
- data/app/lib/actions/katello/repository/sync.rb +5 -25
- data/app/lib/actions/katello/repository/update.rb +1 -2
- data/app/lib/actions/katello/repository/update_http_proxy_details.rb +2 -5
- data/app/lib/actions/katello/repository/update_redhat_repository.rb +1 -1
- data/app/lib/actions/katello/repository/upload_files.rb +8 -3
- data/app/lib/actions/katello/repository/upload_package_group.rb +2 -11
- data/app/lib/actions/katello/repository/verify_checksum.rb +0 -1
- data/app/lib/actions/katello/repository_set/enable_repository.rb +1 -1
- data/app/lib/actions/pulp3/orchestration/repository/create.rb +2 -2
- data/app/lib/actions/pulp3/repository/create.rb +3 -4
- data/app/lib/actions/pulp3/repository/create_remote.rb +1 -6
- data/app/lib/actions/pulp3/repository/repair.rb +4 -0
- data/app/lib/katello/errors.rb +1 -0
- data/app/lib/katello/http_resource.rb +26 -73
- data/app/lib/katello/qpid/connection.rb +1 -3
- data/app/lib/katello/resources/candlepin/consumer.rb +1 -1
- data/app/lib/katello/resources/candlepin/environment.rb +2 -0
- data/app/lib/katello/resources/registry.rb +7 -20
- data/app/lib/katello/util/http_proxy.rb +0 -3
- data/app/lib/katello/validators/gpg_key_content_validator.rb +1 -1
- data/app/models/katello/authorization/{gpg_key.rb → content_credential.rb} +1 -1
- data/app/models/katello/authorization/product.rb +0 -4
- data/app/models/katello/concerns/host_managed_extensions.rb +2 -16
- data/app/models/katello/concerns/organization_extensions.rb +1 -1
- data/app/models/katello/concerns/pulp_database_unit.rb +13 -5
- data/app/models/katello/concerns/smart_proxy_extensions.rb +45 -41
- data/app/models/katello/{gpg_key.rb → content_credential.rb} +4 -4
- data/app/models/katello/content_view.rb +6 -1
- data/app/models/katello/generic_content_unit.rb +16 -0
- data/app/models/katello/glue/pulp/repos.rb +9 -25
- data/app/models/katello/kt_environment.rb +1 -1
- data/app/models/katello/product.rb +4 -4
- data/app/models/katello/repository.rb +13 -7
- data/app/models/katello/repository_generic_content_unit.rb +7 -0
- data/app/models/katello/root_repository.rb +38 -7
- data/app/models/setting/content.rb +5 -0
- data/app/services/cert/certs.rb +16 -8
- data/app/services/katello/applicability/applicable_content_helper.rb +1 -2
- data/app/services/katello/candlepin/consumer.rb +6 -0
- data/app/services/katello/component_view_presenter.rb +27 -0
- data/app/services/katello/pulp/repository.rb +1 -1
- data/app/services/katello/pulp/server.rb +2 -2
- data/app/services/katello/pulp3/api/core.rb +4 -0
- data/app/services/katello/pulp3/api/generic.rb +68 -0
- data/app/services/katello/pulp3/generic_content_unit.rb +29 -0
- data/app/services/katello/pulp3/pulp_content_unit.rb +5 -1
- data/app/services/katello/pulp3/repository/generic.rb +94 -0
- data/app/services/katello/pulp3/repository/yum.rb +4 -5
- data/app/services/katello/pulp3/repository.rb +27 -12
- data/app/services/katello/pulp3/repository_mirror.rb +2 -2
- data/app/services/katello/pulp3/smart_proxy_repository.rb +4 -4
- data/app/services/katello/registration_manager.rb +18 -7
- data/app/services/katello/repository_type.rb +59 -1
- data/app/services/katello/repository_type_manager.rb +116 -24
- data/app/views/katello/api/v2/content_views/base.json.rabl +4 -4
- data/app/views/katello/api/v2/repositories/show.json.rabl +1 -0
- data/app/views/smart_proxies/plugins/_pulpcore.html.erb +2 -5
- data/app/views/smart_proxies/pulp_status.html.erb +0 -7
- data/config/katello.yaml.example +0 -21
- data/config/routes/api/v2.rb +2 -1
- data/db/functions/deb_version_cmp_v01.sql +200 -0
- data/db/migrate/20171110082124_add_ssl_certs_to_products_and_repos.rb +5 -1
- data/db/migrate/20200402130013_add_repsoitory_docker_meta_tag_f_key.rb +3 -1
- data/db/migrate/20210624221630_katello_generic_content.rb +22 -0
- data/db/migrate/20210625095042_add_retain_package_versions_count.rb +9 -0
- data/db/migrate/20210628182553_add_generic_remote_options_to_root_repository.rb +5 -0
- data/db/migrate/20210714140440_remove_repo_export_permission.rb +5 -0
- data/db/migrate/20210721163730_change_gpg_keys_to_content_credentials.rb +8 -0
- data/db/migrate/20210728130748_create_function_deb_version_cmp.rb +12 -0
- data/db/seeds.d/111-upgrade_tasks.rb +1 -2
- data/engines/bastion/app/views/bastion/layouts/assets.html.erb +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.controller.js +7 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +4 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/apply-errata-confirm.html +2 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +25 -33
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/views/products-bulk-advanced-sync-modal.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-repositories.controller.js +1 -6
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +10 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.filter.js +9 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +0 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-advanced-sync-options.html +1 -25
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +31 -13
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +11 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +0 -6
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/aggregate-task.factory.js +3 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/task.factory.js +1 -1
- data/lib/katello/engine.rb +2 -4
- data/lib/katello/permission_creator.rb +6 -12
- data/lib/katello/plugin.rb +76 -80
- data/lib/katello/repository_types/python.rb +37 -0
- data/lib/katello/tasks/reimport.rake +0 -9
- data/lib/katello/tasks/repository.rake +3 -4
- data/lib/katello/version.rb +1 -1
- data/locale/action_names.rb +28 -29
- data/locale/bn/katello.po +699 -221
- data/locale/cs/katello.po +167 -59
- data/locale/de/katello.po +585 -352
- data/locale/en/katello.po +167 -59
- data/locale/es/katello.po +1388 -1189
- data/locale/fr/katello.po +1740 -1494
- data/locale/gu/katello.po +896 -416
- data/locale/hi/katello.po +892 -415
- data/locale/it/katello.po +371 -170
- data/locale/ja/katello.po +1657 -1439
- data/locale/katello.pot +933 -736
- data/locale/kn/katello.po +894 -416
- data/locale/ko/katello.po +515 -317
- data/locale/mr/katello.po +857 -415
- data/locale/or/katello.po +894 -416
- data/locale/pa/katello.po +874 -411
- data/locale/pt/katello.po +347 -154
- data/locale/pt_BR/katello.po +1398 -1215
- data/locale/ru/katello.po +671 -463
- data/locale/ta/katello.po +697 -221
- data/locale/te/katello.po +891 -415
- data/locale/zh_CN/katello.po +2029 -1845
- data/locale/zh_TW/katello.po +735 -407
- data/package.json +3 -1
- data/webpack/components/EditableTextInput/EditableTextInput.js +3 -3
- data/webpack/components/RoutedTabs/RoutedTabs.js +7 -8
- data/webpack/components/Table/TableWrapper.js +19 -11
- data/webpack/components/Table/helpers.js +1 -1
- data/webpack/components/extensions/HostDetails/Tabs/ContentTab.js +42 -0
- data/webpack/components/extensions/HostDetails/Tabs/SubscriptionTab.js +12 -0
- data/webpack/components/extensions/RegistrationCommands/__tests__/__snapshots__/ActivationKeys.test.js.snap +4 -0
- data/webpack/components/extensions/RegistrationCommands/fields/ActivationKeys.js +1 -1
- data/webpack/components/extensions/RegistrationCommands/index.js +1 -2
- data/webpack/components/pf3Table/formatters/selectionHeaderCellFormatter.js +2 -1
- data/webpack/fills_index.js +4 -1
- data/webpack/redux/actions/RedHatRepositories/helpers.js +2 -4
- data/webpack/redux/reducers/RedHatRepositories/enabled.js +4 -1
- data/webpack/scenes/ContentViews/ContentViewsActions.js +16 -1
- data/webpack/scenes/ContentViews/ContentViewsConstants.js +15 -0
- data/webpack/scenes/ContentViews/ContentViewsPage.js +12 -22
- data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +4 -3
- data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +25 -14
- data/webpack/scenes/ContentViews/Create/CreateContentViewModal.js +4 -2
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewAddModal.js +153 -0
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentVersion.js +21 -10
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +157 -19
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.fixtures.json +100 -108
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/contentViewComponents.test.js +140 -16
- data/webpack/scenes/ContentViews/Details/ComponentContentViews/__tests__/publishedContentViewDetails.fixtures.json +367 -0
- data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +59 -6
- data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +43 -0
- data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +44 -13
- data/webpack/scenes/ContentViews/Details/Filters/Add/CVFilterAddModal.js +161 -0
- data/webpack/scenes/ContentViews/Details/Filters/Add/__tests__/cvFilterAdd.test.js +54 -0
- data/webpack/scenes/ContentViews/Details/Filters/Add/__tests__/cvFilterCreateResult.fixtures.json +124 -0
- data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +8 -6
- data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +7 -6
- data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetails.js +4 -3
- data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +71 -12
- data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +77 -0
- data/webpack/scenes/ContentViews/Details/Histories/ContentViewHistories.js +13 -12
- data/webpack/scenes/ContentViews/Details/Histories/__tests__/contentViewHistory.test.js +2 -2
- data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +17 -14
- data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +3 -3
- data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewAddRemove.test.js +2 -2
- data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +6 -2
- data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +61 -20
- data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewTaskInProgressResponse.fixtures.json +71 -0
- data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewTaskResponse.fixtures.json +75 -0
- data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +86 -1
- data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersionsWithTask.fixtures.json +713 -0
- data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +3 -0
- data/webpack/scenes/ContentViews/Publish/CVPublishFinish.js +184 -0
- data/webpack/scenes/ContentViews/Publish/CVPublishForm.js +104 -0
- data/webpack/scenes/ContentViews/Publish/CVPublishReview.js +71 -0
- data/webpack/scenes/ContentViews/Publish/ContentViewPublishSelectors.js +17 -0
- data/webpack/scenes/ContentViews/Publish/PublishContentViewWizard.js +145 -0
- data/webpack/scenes/ContentViews/Publish/__tests__/environmentPaths.fixtures.json +352 -0
- data/webpack/scenes/ContentViews/Publish/__tests__/publishContentView.test.js +184 -0
- data/webpack/scenes/ContentViews/Publish/__tests__/publishResponse.fixture.json +69 -0
- data/webpack/scenes/ContentViews/Publish/cvPublishForm.scss +3 -0
- data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +75 -48
- data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +15 -2
- data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +6 -10
- data/webpack/scenes/ContentViews/components/EnvironmentLabels.js +22 -10
- data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPathActions.js +12 -0
- data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPathConstants.js +2 -0
- data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPathSelectors.js +16 -0
- data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.js +72 -0
- data/webpack/scenes/ContentViews/components/EnvironmentPaths/EnvironmentPaths.scss +8 -0
- data/webpack/scenes/ContentViews/components/TaskPresenter/TaskPresenter.js +85 -0
- data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +9 -8
- data/webpack/scenes/Subscriptions/SubscriptionsPage.js +4 -25
- data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +0 -3
- data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +3 -3
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +4 -2
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +24 -0
- data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Table.js +4 -1
- data/webpack/scenes/Subscriptions/index.js +1 -4
- metadata +74 -39
- data/app/lib/actions/candlepin/environment/create.rb +0 -21
- data/app/lib/actions/foreman/environment/destroy.rb +0 -23
- data/app/lib/actions/katello/content_view/environment_create.rb +0 -21
- data/app/lib/actions/katello/repository/export.rb +0 -85
- data/app/lib/actions/katello/repository/purge_empty_content.rb +0 -16
- data/app/lib/actions/katello/repository/upload_errata.rb +0 -38
- data/app/lib/katello/util/proxy_uri.rb +0 -64
- data/app/models/katello/rhsm_fact_importer.rb +0 -20
- data/app/models/katello/rhsm_fact_name.rb +0 -17
- data/app/models/katello/rhsm_fact_parser.rb +0 -120
@@ -7,7 +7,7 @@ module Katello
|
|
7
7
|
self.table_name = "katello_environments"
|
8
8
|
include Ext::LabelFromName
|
9
9
|
|
10
|
-
belongs_to :organization, :class_name => "Organization", :inverse_of => :
|
10
|
+
belongs_to :organization, :class_name => "Organization", :inverse_of => :kt_environments
|
11
11
|
has_many :activation_keys, :class_name => "Katello::ActivationKey",
|
12
12
|
:dependent => :restrict_with_exception, :foreign_key => :environment_id
|
13
13
|
|
@@ -14,13 +14,13 @@ module Katello
|
|
14
14
|
belongs_to :organization, :inverse_of => :products
|
15
15
|
belongs_to :provider, :inverse_of => :products, :class_name => 'Katello::Provider'
|
16
16
|
belongs_to :sync_plan, :inverse_of => :products, :class_name => 'Katello::SyncPlan'
|
17
|
-
belongs_to :gpg_key, :inverse_of => :products, :class_name => "Katello::
|
17
|
+
belongs_to :gpg_key, :inverse_of => :products, :class_name => "Katello::ContentCredential"
|
18
18
|
has_many :product_contents, :foreign_key => 'product_id', :class_name => "Katello::ProductContent", :dependent => :destroy
|
19
19
|
has_many :contents, :through => :product_contents
|
20
20
|
has_many :displayable_product_contents, -> { displayable }, :foreign_key => 'product_id', :class_name => "Katello::ProductContent", :dependent => :destroy
|
21
|
-
belongs_to :ssl_ca_cert, :class_name => "Katello::
|
22
|
-
belongs_to :ssl_client_cert, :class_name => "Katello::
|
23
|
-
belongs_to :ssl_client_key, :class_name => "Katello::
|
21
|
+
belongs_to :ssl_ca_cert, :class_name => "Katello::ContentCredential", :inverse_of => :ssl_ca_products
|
22
|
+
belongs_to :ssl_client_cert, :class_name => "Katello::ContentCredential", :inverse_of => :ssl_client_products
|
23
|
+
belongs_to :ssl_client_key, :class_name => "Katello::ContentCredential", :inverse_of => :ssl_key_products
|
24
24
|
has_many :root_repositories, :class_name => "Katello::RootRepository", :dependent => :restrict_with_exception
|
25
25
|
has_many :repositories, :through => :root_repositories
|
26
26
|
|
@@ -29,6 +29,7 @@ module Katello
|
|
29
29
|
DOCKER_TYPE = 'docker'.freeze
|
30
30
|
OSTREE_TYPE = 'ostree'.freeze
|
31
31
|
ANSIBLE_COLLECTION_TYPE = 'ansible_collection'.freeze
|
32
|
+
GENERIC_TYPE = 'generic'.freeze
|
32
33
|
|
33
34
|
EXPORTABLE_TYPES = [YUM_TYPE, FILE_TYPE, ANSIBLE_COLLECTION_TYPE].freeze
|
34
35
|
|
@@ -57,6 +58,9 @@ module Katello
|
|
57
58
|
has_many :repository_srpms, :class_name => "Katello::RepositorySrpm", :dependent => :delete_all
|
58
59
|
has_many :srpms, :through => :repository_srpms
|
59
60
|
|
61
|
+
has_many :repository_generic_content_units, :class_name => "Katello::RepositoryGenericContentUnit", :dependent => :delete_all
|
62
|
+
has_many :generic_content_units, :through => :repository_generic_content_units
|
63
|
+
|
60
64
|
has_many :repository_file_units, :class_name => "Katello::RepositoryFileUnit", :dependent => :delete_all
|
61
65
|
has_many :files, :through => :repository_file_units, :source => :file_unit
|
62
66
|
alias_attribute :file_units, :files
|
@@ -130,6 +134,7 @@ module Katello
|
|
130
134
|
scope :docker_type, -> { with_type(DOCKER_TYPE) }
|
131
135
|
scope :ostree_type, -> { with_type(OSTREE_TYPE) }
|
132
136
|
scope :ansible_collection_type, -> { with_type(ANSIBLE_COLLECTION_TYPE) }
|
137
|
+
scope :generic_type, -> { with_type(Katello::RepositoryTypeManager.enabled_repository_types.select { |_, v| v.pulp3_service_class == Katello::Pulp3::Repository::Generic }.keys) }
|
133
138
|
scope :non_archived, -> { where('environment_id is not NULL') }
|
134
139
|
scope :archived, -> { where('environment_id is NULL') }
|
135
140
|
scope :in_published_environments, -> { in_content_views(Katello::ContentView.non_default).where.not(:environment_id => nil) }
|
@@ -148,7 +153,7 @@ module Katello
|
|
148
153
|
scoped_search :rename => :product, :on => :name, :relation => :product, :complete_value => true
|
149
154
|
scoped_search :rename => :product_id, :on => :id, :relation => :product
|
150
155
|
scoped_search :on => :content_type, :relation => :root, :complete_value => -> do
|
151
|
-
Katello::RepositoryTypeManager.
|
156
|
+
Katello::RepositoryTypeManager.enabled_repository_types.keys.index_by { |value| value.to_sym }
|
152
157
|
end
|
153
158
|
scoped_search :on => :content_view_id, :relation => :content_view_repositories, :validator => ScopedSearch::Validators::INTEGER, :only_explicit => true
|
154
159
|
scoped_search :on => :distribution_version, :complete_value => true
|
@@ -166,7 +171,7 @@ module Katello
|
|
166
171
|
scoped_search :on => :content_label, :ext_method => :search_by_content_label
|
167
172
|
|
168
173
|
delegate :product, :redhat?, :custom?, :to => :root
|
169
|
-
delegate :yum?, :docker?, :deb?, :file?, :ostree?, :ansible_collection?, :to => :root
|
174
|
+
delegate :yum?, :docker?, :deb?, :file?, :ostree?, :ansible_collection?, :generic?, :to => :root
|
170
175
|
delegate :name, :label, :docker_upstream_name, :url, :download_concurrency, :to => :root
|
171
176
|
|
172
177
|
delegate :name, :created_at, :updated_at, :major, :minor, :gpg_key_id, :gpg_key, :arch, :label, :url, :unprotected,
|
@@ -178,6 +183,7 @@ module Katello
|
|
178
183
|
:ansible_collection_auth_url, :ansible_collection_auth_token, :http_proxy_policy, :http_proxy_id, :to => :root
|
179
184
|
|
180
185
|
delegate :content_id, to: :root, allow_nil: true
|
186
|
+
delegate :repository_type, to: :root
|
181
187
|
|
182
188
|
def self.with_type(content_type)
|
183
189
|
joins(:root).where("#{RootRepository.table_name}.content_type" => content_type)
|
@@ -872,10 +878,6 @@ module Katello
|
|
872
878
|
parts.map { |x| x.gsub(/[^-\w]/, "_") }.join("-").downcase
|
873
879
|
end
|
874
880
|
|
875
|
-
def repository_type
|
876
|
-
RepositoryTypeManager.find(self.content_type)
|
877
|
-
end
|
878
|
-
|
879
881
|
def copy_indexed_data(source_repository)
|
880
882
|
repository_type.content_types_to_index.each do |type|
|
881
883
|
type.model_class.copy_repository_associations(source_repository, self)
|
@@ -901,7 +903,11 @@ module Katello
|
|
901
903
|
else
|
902
904
|
repository_type.content_types_to_index.each do |type|
|
903
905
|
Katello::Logging.time("CONTENT_INDEX", data: {type: type.model_class}) do
|
904
|
-
|
906
|
+
if self.generic?
|
907
|
+
type.model_class.import_for_repository(self, type.content_type)
|
908
|
+
else
|
909
|
+
type.model_class.import_for_repository(self)
|
910
|
+
end
|
905
911
|
end
|
906
912
|
end
|
907
913
|
repository_type.index_additional_data_proc&.call(self)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
module Katello
|
2
|
+
class RepositoryGenericContentUnit < Katello::Model
|
3
|
+
# Do not use active record callbacks in this join model. Direct INSERTs and DELETEs are done
|
4
|
+
belongs_to :repository, :inverse_of => :repository_generic_content_units, :class_name => 'Katello::Repository'
|
5
|
+
belongs_to :generic_content_unit, :inverse_of => :repository_generic_content_units, :class_name => 'Katello::GenericContentUnit'
|
6
|
+
end
|
7
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module Katello
|
2
|
+
# rubocop:disable Metrics/ClassLength
|
2
3
|
class RootRepository < Katello::Model
|
3
4
|
audited :except => [:content_id]
|
4
5
|
serialize :ignorable_content
|
@@ -41,10 +42,10 @@ module Katello
|
|
41
42
|
ALLOWED_OS_VERSIONS = [RHEL6, RHEL7, RHEL8].freeze
|
42
43
|
|
43
44
|
belongs_to :product, :inverse_of => :root_repositories, :class_name => "Katello::Product"
|
44
|
-
belongs_to :gpg_key, :inverse_of => :root_repositories, :class_name => "Katello::
|
45
|
-
belongs_to :ssl_ca_cert, :class_name => "Katello::
|
46
|
-
belongs_to :ssl_client_cert, :class_name => "Katello::
|
47
|
-
belongs_to :ssl_client_key, :class_name => "Katello::
|
45
|
+
belongs_to :gpg_key, :inverse_of => :root_repositories, :class_name => "Katello::ContentCredential"
|
46
|
+
belongs_to :ssl_ca_cert, :class_name => "Katello::ContentCredential", :inverse_of => :ssl_ca_root_repos
|
47
|
+
belongs_to :ssl_client_cert, :class_name => "Katello::ContentCredential", :inverse_of => :ssl_client_root_repos
|
48
|
+
belongs_to :ssl_client_key, :class_name => "Katello::ContentCredential", :inverse_of => :ssl_key_root_repos
|
48
49
|
belongs_to :http_proxy, :inverse_of => :root_repositories
|
49
50
|
has_many :repositories, :class_name => "Katello::Repository", :foreign_key => :root_id,
|
50
51
|
:inverse_of => :root, :dependent => :destroy
|
@@ -68,6 +69,7 @@ module Katello
|
|
68
69
|
validate :ensure_ostree_repo_protected, :if => :ostree?
|
69
70
|
validate :ensure_compatible_download_policy, :if => :yum?
|
70
71
|
validate :ensure_valid_collection_attributes, :if => :ansible_collection?
|
72
|
+
validate :ensure_valid_auth_url_token, :if => :ansible_collection?
|
71
73
|
validate :ensure_valid_ignorable_content
|
72
74
|
validate :ensure_valid_docker_tags_whitelist
|
73
75
|
validate :ensure_valid_os_versions
|
@@ -81,9 +83,9 @@ module Katello
|
|
81
83
|
validates :ostree_upstream_sync_depth, :presence => true, :numericality => { :only_integer => true },
|
82
84
|
:if => proc { |r| r.ostree? && r.ostree_upstream_sync_policy == OSTREE_UPSTREAM_SYNC_POLICY_CUSTOM }
|
83
85
|
validates :content_type, :inclusion => {
|
84
|
-
:in => ->(_) { Katello::RepositoryTypeManager.
|
86
|
+
:in => ->(_) { Katello::RepositoryTypeManager.enabled_repository_types.keys },
|
85
87
|
:allow_blank => false,
|
86
|
-
:message => ->(_, _) { _("must be one of the following: %s") % Katello::RepositoryTypeManager.
|
88
|
+
:message => ->(_, _) { _("is not enabled. must be one of the following: %s") % Katello::RepositoryTypeManager.enabled_repository_types.keys.join(', ') }
|
87
89
|
}
|
88
90
|
validates :download_policy, inclusion: {
|
89
91
|
:in => ::Runcible::Models::YumImporter::DOWNLOAD_POLICIES,
|
@@ -120,6 +122,10 @@ module Katello
|
|
120
122
|
Repository.where(:root => self)
|
121
123
|
end
|
122
124
|
|
125
|
+
def repository_type
|
126
|
+
RepositoryTypeManager.find(self.content_type)
|
127
|
+
end
|
128
|
+
|
123
129
|
def custom?
|
124
130
|
!redhat?
|
125
131
|
end
|
@@ -253,7 +259,14 @@ module Katello
|
|
253
259
|
end
|
254
260
|
|
255
261
|
def ensure_valid_upstream_authorization
|
256
|
-
|
262
|
+
# Make sure that the upstream_username / upstream_password is really unset
|
263
|
+
# in case if the string is maybe just ""
|
264
|
+
if self.upstream_username.blank? && self.upstream_password.blank?
|
265
|
+
self.upstream_username = nil
|
266
|
+
self.upstream_password = nil
|
267
|
+
return
|
268
|
+
end
|
269
|
+
|
257
270
|
if redhat?
|
258
271
|
errors.add(:base, N_("Upstream username and password may only be set on custom repositories."))
|
259
272
|
elsif self.upstream_username.blank?
|
@@ -263,6 +276,20 @@ module Katello
|
|
263
276
|
end
|
264
277
|
end
|
265
278
|
|
279
|
+
def ensure_valid_auth_url_token
|
280
|
+
if self.ansible_collection_auth_url.blank? && self.ansible_collection_auth_token.blank?
|
281
|
+
self.ansible_collection_auth_url = nil
|
282
|
+
self.ansible_collection_auth_token = nil
|
283
|
+
return
|
284
|
+
end
|
285
|
+
|
286
|
+
if self.ansible_collection_auth_url.blank?
|
287
|
+
errors.add(:base, N_("Auth token requires Auth URL be set."))
|
288
|
+
elsif !self.ansible_collection_auth_token
|
289
|
+
errors.add(:base, N_("Auth URL requires Auth token be set."))
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
266
293
|
def custom_content_path
|
267
294
|
parts = []
|
268
295
|
# We generate repo path only for custom product content. We add this
|
@@ -306,6 +333,10 @@ module Katello
|
|
306
333
|
self.content_type == Repository::ANSIBLE_COLLECTION_TYPE
|
307
334
|
end
|
308
335
|
|
336
|
+
def generic?
|
337
|
+
Katello::RepositoryTypeManager.generic_repository_types(enabled_only: false).values.map(&:id).map(&:to_s).flatten.include? self.content_type
|
338
|
+
end
|
339
|
+
|
309
340
|
def metadata_generate_needed?
|
310
341
|
(%w(unprotected checksum_type container_repsoitory_name) & previous_changes.keys).any?
|
311
342
|
end
|
@@ -143,6 +143,11 @@ class Setting::Content < Setting
|
|
143
143
|
self.set('host_profile_assume', N_("Allow new Host registrations to assume registered profiles with matching hostname " \
|
144
144
|
"as long as the registering DMI UUID is not used by another host."),
|
145
145
|
true, N_('Host Profile Assume')),
|
146
|
+
self.set('host_profile_assume_build_can_change', N_("Allow Host registrations to bypass 'Host Profile Assume' " \
|
147
|
+
"as long as the host is in build mode."),
|
148
|
+
false, N_('Host Profile Can Change In Build')),
|
149
|
+
self.set('host_re_register_build_only', N_("Allow hosts to re-register themselves only when they are in build mode"),
|
150
|
+
false, N_('Host Can Re-Register Only In Build')),
|
146
151
|
self.set('host_tasks_workers_pool_size', N_("Amount of workers in the pool to handle the execution of host-related tasks. When set to 0, the default queue will be used instead. Restart of the dynflowd/foreman-tasks service is required."),
|
147
152
|
5, N_('Host Tasks Workers Pool Size')),
|
148
153
|
self.set('applicability_batch_size', N_("Number of host applicability calculations to process per task."),
|
data/app/services/cert/certs.rb
CHANGED
@@ -12,20 +12,28 @@ module Cert
|
|
12
12
|
File.read(SETTINGS[:katello][:candlepin][:ca_cert_file])
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.ssl_client_cert
|
16
|
-
@ssl_client_cert ||= OpenSSL::X509::Certificate.new(File.read(ssl_client_cert_filename))
|
15
|
+
def self.ssl_client_cert(use_admin_as_cn_cert: false)
|
16
|
+
@ssl_client_cert ||= OpenSSL::X509::Certificate.new(File.read(ssl_client_cert_filename(use_admin_as_cn_cert: use_admin_as_cn_cert)))
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.ssl_client_cert_filename
|
20
|
-
|
19
|
+
def self.ssl_client_cert_filename(use_admin_as_cn_cert: false)
|
20
|
+
if use_admin_as_cn_cert
|
21
|
+
Setting[:pulp_client_cert]
|
22
|
+
else
|
23
|
+
Setting[:ssl_certificate]
|
24
|
+
end
|
21
25
|
end
|
22
26
|
|
23
|
-
def self.ssl_client_key
|
24
|
-
@ssl_client_key ||= OpenSSL::PKey::RSA.new(File.read(ssl_client_key_filename))
|
27
|
+
def self.ssl_client_key(use_admin_as_cn_cert: false)
|
28
|
+
@ssl_client_key ||= OpenSSL::PKey::RSA.new(File.read(ssl_client_key_filename(use_admin_as_cn_cert: use_admin_as_cn_cert)))
|
25
29
|
end
|
26
30
|
|
27
|
-
def self.ssl_client_key_filename
|
28
|
-
|
31
|
+
def self.ssl_client_key_filename(use_admin_as_cn_cert: false)
|
32
|
+
if use_admin_as_cn_cert
|
33
|
+
Setting[:pulp_client_key]
|
34
|
+
else
|
35
|
+
Setting[:ssl_priv_key]
|
36
|
+
end
|
29
37
|
end
|
30
38
|
|
31
39
|
def self.verify_ueber_cert(organization)
|
@@ -92,8 +92,7 @@ module Katello
|
|
92
92
|
::Katello::ModuleStream.
|
93
93
|
joins("inner join katello_available_module_streams on
|
94
94
|
katello_module_streams.name = katello_available_module_streams.name and
|
95
|
-
katello_module_streams.stream = katello_available_module_streams.stream
|
96
|
-
katello_module_streams.context = katello_available_module_streams.context").
|
95
|
+
katello_module_streams.stream = katello_available_module_streams.stream").
|
97
96
|
joins("inner join katello_host_available_module_streams on
|
98
97
|
katello_available_module_streams.id = katello_host_available_module_streams.available_module_stream_id").
|
99
98
|
where("katello_host_available_module_streams.host_id = :content_facet_id and
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Katello
|
2
|
+
class ComponentViewPresenter < SimpleDelegator
|
3
|
+
attr_accessor :view, :component_view
|
4
|
+
|
5
|
+
def initialize(composite_cv, component_content_view = nil, content_view_component = nil)
|
6
|
+
@view = component_content_view
|
7
|
+
cv_component_record = content_view_component || Katello::ContentViewComponent.where(composite_content_view_id: composite_cv.id, content_view_id: @view.id).first
|
8
|
+
@component_view = cv_component_record || Katello::ContentViewComponent.new(composite_content_view_id: composite_cv.id, content_view_id: @view.id, latest: true)
|
9
|
+
super(@component_view)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.component_presenter(composite_cv, status, views:)
|
13
|
+
case status
|
14
|
+
when 'All'
|
15
|
+
views.map { |component_content_view| ComponentViewPresenter.new(composite_cv, component_content_view) }
|
16
|
+
when 'Added'
|
17
|
+
added_cvs = views.map { |component_content_view| Katello::ContentViewComponent.where(composite_content_view_id: composite_cv.id, content_view_id: component_content_view.id).first }
|
18
|
+
added_cvs.compact.map { |content_view| ComponentViewPresenter.new(composite_cv, nil, content_view) }
|
19
|
+
when 'Not added'
|
20
|
+
not_added_cvs = views.reject { |component_content_view| Katello::ContentViewComponent.where(composite_content_view_id: composite_cv.id, content_view_id: component_content_view.id).first }
|
21
|
+
not_added_cvs.map { |component_content_view| ComponentViewPresenter.new(composite_cv, nil, Katello::ContentViewComponent.where(composite_content_view_id: composite_cv.id, content_view_id: component_content_view.id, latest: true).new) }
|
22
|
+
else
|
23
|
+
views.map { |component_content_view| ComponentViewPresenter.new(cv, component_content_view) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -21,7 +21,7 @@ module Katello
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.instance_for_type(repo, smart_proxy)
|
24
|
-
Katello::RepositoryTypeManager.
|
24
|
+
Katello::RepositoryTypeManager.enabled_repository_types[repo.root.content_type].service_class.new(repo, smart_proxy)
|
25
25
|
end
|
26
26
|
|
27
27
|
def unit_type_id(_uploads = [])
|
@@ -17,8 +17,8 @@ module Katello
|
|
17
17
|
:debug => true
|
18
18
|
},
|
19
19
|
:cert_auth => {
|
20
|
-
:ssl_client_cert => ::Cert::Certs.ssl_client_cert,
|
21
|
-
:ssl_client_key => ::Cert::Certs.ssl_client_key
|
20
|
+
:ssl_client_cert => ::Cert::Certs.ssl_client_cert(use_admin_as_cn_pulp_cert: true),
|
21
|
+
:ssl_client_key => ::Cert::Certs.ssl_client_key(use_admin_as_cn_pulp_cert: true)
|
22
22
|
}
|
23
23
|
}
|
24
24
|
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require "pulpcore_client"
|
2
|
+
|
3
|
+
module Katello
|
4
|
+
module Pulp3
|
5
|
+
module Api
|
6
|
+
class Generic < Core
|
7
|
+
attr_accessor :repository_type
|
8
|
+
|
9
|
+
def initialize(smart_proxy, repository_type)
|
10
|
+
@repository_type = repository_type
|
11
|
+
super(smart_proxy)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.api_exception_class
|
15
|
+
fail NotImplementedError
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.client_module(repository_type)
|
19
|
+
repository_type.client_module_class
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.remote_class(repository_type)
|
23
|
+
repository_type.remote_class
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.distribution_class(repository_type)
|
27
|
+
repository_type.distribution_class
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.publication_class(repository_type)
|
31
|
+
repository_type.publication_class
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.repository_sync_url_class(repository_type)
|
35
|
+
repository_type.repo_sync_url_class
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.add_remove_content_class
|
39
|
+
fail NotImplementedError
|
40
|
+
end
|
41
|
+
|
42
|
+
def api_client
|
43
|
+
api_client_class(@repository_type.api_class.new(smart_proxy.pulp3_configuration(@repository_type.configuration_class)))
|
44
|
+
end
|
45
|
+
|
46
|
+
def repositories_api
|
47
|
+
@repository_type.repositories_api_class.new(api_client)
|
48
|
+
end
|
49
|
+
|
50
|
+
def repository_versions_api
|
51
|
+
@repository_type.repository_versions_api_class.new(api_client)
|
52
|
+
end
|
53
|
+
|
54
|
+
def remotes_api
|
55
|
+
@repository_type.remotes_api_class.new(api_client)
|
56
|
+
end
|
57
|
+
|
58
|
+
def publications_api
|
59
|
+
@repository_type.publications_api_class.new(api_client)
|
60
|
+
end
|
61
|
+
|
62
|
+
def distributions_api
|
63
|
+
@repository_type.distributions_api_class.new(api_client)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Katello
|
2
|
+
module Pulp3
|
3
|
+
class GenericContentUnit < PulpContentUnit
|
4
|
+
include LazyAccessor
|
5
|
+
CONTENT_TYPE = "generic_content_unit".freeze
|
6
|
+
|
7
|
+
def self.fetch_content_list(page_opts, repository_type, content_type)
|
8
|
+
content_unit_list page_opts, repository_type, content_type
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.content_unit_list(page_opts, repository_type, content_type)
|
12
|
+
self.content_api(repository_type, content_type).list page_opts
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.content_api(repository_type, content_type)
|
16
|
+
repository_type.content_types.find { |type| type.content_type == content_type }.pulp3_api.new(repository_type.pulp3_api_class.new(SmartProxy.pulp_primary!, repository_type).api_client)
|
17
|
+
end
|
18
|
+
|
19
|
+
def update_model(model, repository_type, content_type)
|
20
|
+
custom_json = {}
|
21
|
+
custom_json['pulp_id'] = backend_data['pulp_href']
|
22
|
+
custom_json['name'] = repository_type.model_name.call(backend_data)
|
23
|
+
custom_json['version'] = repository_type.model_version.call(backend_data)
|
24
|
+
custom_json['content_type'] = content_type
|
25
|
+
model.update!(custom_json)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -72,7 +72,11 @@ module Katello
|
|
72
72
|
(response["count"] && page_opts["offset"] < response["count"]) ||
|
73
73
|
page_opts["offset"] == 0)
|
74
74
|
page_opts = page_options page_opts
|
75
|
-
|
75
|
+
if repository.generic?
|
76
|
+
response = fetch_content_list page_opts, repository.repository_type, options[:content_type]
|
77
|
+
else
|
78
|
+
response = fetch_content_list page_opts
|
79
|
+
end
|
76
80
|
response = response.as_json.with_indifferent_access
|
77
81
|
yielder.yield response[:results]
|
78
82
|
page_opts[:offset] += page_size
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module Katello
|
2
|
+
module Pulp3
|
3
|
+
class Repository
|
4
|
+
class Generic < ::Katello::Pulp3::Repository
|
5
|
+
def copy_content_for_source(source_repository, _options = {})
|
6
|
+
copy_units_by_href(source_repository.files.pluck(:pulp_id))
|
7
|
+
end
|
8
|
+
|
9
|
+
def distribution_options(path)
|
10
|
+
{
|
11
|
+
base_path: path,
|
12
|
+
publication: repo.publication_href,
|
13
|
+
name: "#{generate_backend_object_name}"
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def remote_options
|
18
|
+
generic_remote_options = JSON.parse(root.generic_remote_options)
|
19
|
+
if generic_remote_options.any?
|
20
|
+
common_remote_options.merge(generic_remote_options.select { |_, v| !v.nil? }).symbolize_keys
|
21
|
+
else
|
22
|
+
common_remote_options
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def partial_repo_path
|
27
|
+
repo.repository_type.partial_repo_path
|
28
|
+
end
|
29
|
+
|
30
|
+
def api
|
31
|
+
@api ||= repo.repository_type.pulp3_api(smart_proxy)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.api(smart_proxy, repo)
|
35
|
+
api_class = RepositoryTypeManager.find_by(:pulp3_service_class, self).pulp3_api_class
|
36
|
+
api_class ? api_class.new(smart_proxy, repo) : Katello::Pulp3::Api::Core.new(smart_proxy)
|
37
|
+
end
|
38
|
+
|
39
|
+
def create_distribution(path)
|
40
|
+
distribution_data = api.class.distribution_class(repo.repository_type).new(secure_distribution_options(path))
|
41
|
+
api.distributions_api.create(distribution_data)
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_remote
|
45
|
+
remote_file_data = api.class.remote_class(repo.repository_type).new(remote_options)
|
46
|
+
response = api.remotes_api.create(remote_file_data)
|
47
|
+
repo.update!(:remote_href => response.pulp_href)
|
48
|
+
end
|
49
|
+
|
50
|
+
def refresh_distributions
|
51
|
+
dist = lookup_distributions(base_path: repo.relative_path).first
|
52
|
+
|
53
|
+
# First check if the distribution exists
|
54
|
+
if dist
|
55
|
+
dist_ref = distribution_reference
|
56
|
+
# If we have a DistributionReference, update the distribution
|
57
|
+
if dist_ref
|
58
|
+
return update_distribution
|
59
|
+
# If no DistributionReference, create a DistributionReference and return
|
60
|
+
else
|
61
|
+
save_distribution_references([dist.pulp_href])
|
62
|
+
return []
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# So far, it looks like there is no distribution. Try to create one.
|
67
|
+
begin
|
68
|
+
create_distribution(relative_path)
|
69
|
+
rescue api.class.client_module(repo.repository_type)::ApiError => e
|
70
|
+
# Now it seems there is a distribution. Fetch it and save the reference.
|
71
|
+
if e.message.include?("\"base_path\":[\"This field must be unique.\"]") ||
|
72
|
+
e.message.include?("\"base_path\":[\"Overlaps with existing distribution\"")
|
73
|
+
dist = lookup_distributions(base_path: repo.relative_path).first
|
74
|
+
save_distribution_references([dist.pulp_href])
|
75
|
+
return []
|
76
|
+
else
|
77
|
+
raise e
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def sync(options = {})
|
83
|
+
repository_sync_url_data = api.class.repository_sync_url_class(repo.repository_type).new(sync_url_params(options))
|
84
|
+
[api.repositories_api.sync(repository_reference.repository_href, repository_sync_url_data)]
|
85
|
+
end
|
86
|
+
|
87
|
+
def create_publication
|
88
|
+
publication_data = api.class.publication_class(repo.repository_type).new(publication_options(repo.version_href))
|
89
|
+
api.publications_api.create(publication_data)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -17,6 +17,10 @@ module Katello
|
|
17
17
|
options.merge!(url: url, policy: root.download_policy)
|
18
18
|
end
|
19
19
|
|
20
|
+
def specific_create_options
|
21
|
+
{ retain_package_versions: retain_package_versions_count }
|
22
|
+
end
|
23
|
+
|
20
24
|
def extract_sles_token
|
21
25
|
return [nil, nil] if root.url.blank?
|
22
26
|
uri = URI(root.url)
|
@@ -214,11 +218,6 @@ module Katello
|
|
214
218
|
api.repositories_api.modify(repo_href, data)
|
215
219
|
end
|
216
220
|
|
217
|
-
def repair(repository_version_href)
|
218
|
-
data = PulpRpmClient::RepositoryVersion.new
|
219
|
-
api.repository_versions_api.repair(repository_version_href, data)
|
220
|
-
end
|
221
|
-
|
222
221
|
def remove_all_content
|
223
222
|
data = PulpRpmClient::RepositoryAddRemoveContent.new(
|
224
223
|
remove_content_units: ['*'])
|
@@ -60,6 +60,11 @@ module Katello
|
|
60
60
|
!repo.publication_href.nil?
|
61
61
|
end
|
62
62
|
|
63
|
+
def repair(repository_version_href)
|
64
|
+
data = api.class.repository_version_class.new
|
65
|
+
api.repository_versions_api.repair(repository_version_href, data)
|
66
|
+
end
|
67
|
+
|
63
68
|
def skip_types
|
64
69
|
nil
|
65
70
|
end
|
@@ -99,7 +104,7 @@ module Katello
|
|
99
104
|
end
|
100
105
|
|
101
106
|
def self.instance_for_type(repo, smart_proxy)
|
102
|
-
Katello::RepositoryTypeManager.
|
107
|
+
Katello::RepositoryTypeManager.enabled_repository_types[repo.root.content_type].pulp3_service_class.new(repo, smart_proxy)
|
103
108
|
end
|
104
109
|
|
105
110
|
def should_purge_empty_contents?
|
@@ -161,22 +166,19 @@ module Katello
|
|
161
166
|
computed_options.except(:name, :client_key)
|
162
167
|
end
|
163
168
|
|
164
|
-
def create
|
165
|
-
|
166
|
-
response = api.repositories_api.create(
|
167
|
-
RepositoryReference.
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
root_repository_id: repo.root_id,
|
172
|
-
content_view_id: repo.content_view.id,
|
173
|
-
repository_href: response.pulp_href).create!
|
169
|
+
def create
|
170
|
+
unless repository_reference
|
171
|
+
response = api.repositories_api.create(create_options)
|
172
|
+
RepositoryReference.create!(
|
173
|
+
root_repository_id: repo.root_id,
|
174
|
+
content_view_id: repo.content_view.id,
|
175
|
+
repository_href: response.pulp_href)
|
174
176
|
response
|
175
177
|
end
|
176
178
|
end
|
177
179
|
|
178
180
|
def update
|
179
|
-
api.repositories_api.update(repository_reference.try(:repository_href),
|
181
|
+
api.repositories_api.update(repository_reference.try(:repository_href), create_options)
|
180
182
|
end
|
181
183
|
|
182
184
|
def list(options)
|
@@ -360,6 +362,14 @@ module Katello
|
|
360
362
|
remote_options.merge!(ssl_remote_options)
|
361
363
|
end
|
362
364
|
|
365
|
+
def create_options
|
366
|
+
{ name: generate_backend_object_name }.merge!(specific_create_options)
|
367
|
+
end
|
368
|
+
|
369
|
+
def specific_create_options
|
370
|
+
{}
|
371
|
+
end
|
372
|
+
|
363
373
|
def secure_distribution_options(path)
|
364
374
|
secured_distribution_options = {}
|
365
375
|
if root.unprotected
|
@@ -425,6 +435,11 @@ module Katello
|
|
425
435
|
upload.except('id')
|
426
436
|
end
|
427
437
|
end
|
438
|
+
|
439
|
+
def retain_package_versions_count
|
440
|
+
return 0 if root.retain_package_versions_count.nil? || root.mirror_on_sync?
|
441
|
+
root.retain_package_versions_count.to_i
|
442
|
+
end
|
428
443
|
end
|
429
444
|
end
|
430
445
|
end
|