katello 3.0.0.rc1 → 3.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of katello might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/katello/katello.scss +5 -5
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +3 -3
- data/app/controllers/katello/api/v2/activation_keys_controller.rb +12 -12
- data/app/controllers/katello/api/v2/api_controller.rb +13 -5
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +30 -27
- data/app/controllers/katello/api/v2/content_views_controller.rb +4 -1
- data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +100 -3
- data/app/controllers/katello/api/v2/repositories_controller.rb +2 -2
- data/app/controllers/katello/api/v2/repository_sets_controller.rb +1 -1
- data/app/controllers/katello/api/v2/subscriptions_controller.rb +0 -1
- data/app/controllers/katello/api/v2/systems_controller.rb +1 -88
- data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +10 -4
- data/app/controllers/katello/remote_execution_controller.rb +1 -1
- data/app/helpers/katello/concerns/settings_helper_extensions.rb +50 -0
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +17 -4
- data/app/helpers/katello/katello_urls_helper.rb +3 -2
- data/app/helpers/katello/providers_helper.rb +2 -5
- data/app/lib/actions/katello/capsule_content/configure_capsule.rb +1 -1
- data/app/lib/actions/katello/capsule_content/{create_or_update.rb → create_repos.rb} +2 -7
- data/app/lib/actions/katello/capsule_content/remove_orphans.rb +15 -0
- data/app/lib/actions/katello/capsule_content/remove_unneeded_repos.rb +6 -5
- data/app/lib/actions/katello/capsule_content/sync.rb +32 -0
- data/app/lib/actions/katello/content_view/incremental_updates.rb +4 -3
- data/app/lib/actions/katello/content_view/promote.rb +4 -0
- data/app/lib/actions/katello/content_view/publish.rb +4 -0
- data/app/lib/actions/katello/content_view_puppet_module/destroy.rb +4 -5
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +5 -3
- data/app/lib/actions/katello/host/erratum/applicable_errata_install.rb +2 -2
- data/app/lib/actions/katello/host/generate_applicability.rb +1 -1
- data/app/lib/actions/katello/host/hypervisors_update.rb +1 -1
- data/app/lib/actions/katello/host/register.rb +10 -4
- data/app/lib/actions/katello/repository/destroy.rb +2 -1
- data/app/lib/actions/katello/repository/import_applicability.rb +23 -0
- data/app/lib/actions/katello/repository/sync.rb +1 -8
- data/app/lib/actions/pulp/abstract_async_task.rb +8 -0
- data/app/lib/actions/pulp/consumer/content_install.rb +14 -0
- data/app/lib/actions/pulp/repository/create.rb +2 -1
- data/app/lib/actions/pulp/repository/delete_distributor.rb +18 -0
- data/app/lib/actions/pulp/repository/refresh.rb +25 -7
- data/app/lib/katello/api/v2/error_handling.rb +2 -2
- data/app/lib/katello/capsule_content.rb +11 -0
- data/app/lib/katello/errors.rb +1 -1
- data/app/mailers/katello/errata_mailer.rb +3 -3
- data/app/models/katello/activation_key.rb +6 -6
- data/app/models/katello/candlepin/product_content.rb +15 -0
- data/app/models/katello/concerns/content_facet_host_extensions.rb +13 -0
- data/app/models/katello/concerns/operatingsystem_extensions.rb +17 -1
- data/app/models/katello/concerns/pulp_database_unit.rb +3 -1
- data/app/models/katello/concerns/setting_extensions.rb +12 -0
- data/app/models/katello/content_view.rb +2 -2
- data/app/models/katello/erratum.rb +7 -0
- data/app/models/katello/glue/candlepin/product.rb +4 -0
- data/app/models/katello/glue/candlepin/subscription.rb +1 -1
- data/app/models/katello/glue/pulp/repo.rb +31 -3
- data/app/models/katello/host/content_facet.rb +43 -16
- data/app/models/katello/host/subscription_facet.rb +1 -0
- data/app/models/katello/pool.rb +6 -11
- data/app/models/katello/repository.rb +20 -15
- data/app/models/katello/subscription.rb +14 -0
- data/app/models/katello/sync_plan.rb +5 -0
- data/app/models/katello/system.rb +0 -10
- data/app/models/setting/katello.rb +2 -1
- data/app/presenters/katello/product_content_presenter.rb +16 -0
- data/app/services/katello/candlepin/consumer.rb +22 -1
- data/app/services/katello/repository_type_manager.rb +4 -0
- data/app/views/dashboard/_content_views_widget.html.erb +2 -2
- data/app/views/dashboard/_errata_widget.html.erb +1 -1
- data/app/views/dashboard/_host_collection_widget.html.erb +2 -2
- data/app/views/dashboard/_subscription_status_widget.html.erb +5 -5
- data/app/views/dashboard/_subscription_widget.html.erb +1 -1
- data/app/views/dashboard/_sync_widget.html.erb +2 -2
- data/app/views/foreman/unattended/finish-katello.erb +2 -0
- data/app/views/foreman/unattended/kickstart-katello-atomic.erb +42 -0
- data/app/views/foreman/unattended/kickstart-katello.erb +2 -0
- data/app/views/foreman/unattended/snippets/_subscription_manager_registration.erb +15 -9
- data/app/views/foreman/unattended/userdata-katello.erb +6 -1
- data/app/views/katello/api/v2/activation_keys/show.json.rabl +2 -2
- data/app/views/katello/api/v2/common/_metadata.json.rabl +1 -0
- data/app/views/katello/api/v2/content_facet/show.json.rabl +4 -0
- data/app/views/katello/api/v2/host_subscriptions/content_override.json.rabl +3 -0
- data/app/views/katello/api/v2/{systems/_content.json.rabl → host_subscriptions/product_content.json.rabl} +1 -3
- data/app/views/katello/api/v2/sync_plans/show.json.rabl +5 -1
- data/app/views/katello/errata_mailer/host_errata.html.erb +2 -2
- data/app/views/katello/errata_mailer/promote_errata.html.erb +1 -1
- data/app/views/katello/errata_mailer/promote_errata.text.erb +1 -1
- data/app/views/katello/errata_mailer/sync_errata.html.erb +1 -1
- data/app/views/katello/errata_mailer/sync_errata.text.erb +1 -1
- data/app/views/overrides/activation_keys/_host_environment_select.html.erb +21 -11
- data/config/katello.yaml.example +1 -0
- data/config/routes/api/v2.rb +0 -6
- data/config/routes/overrides.rb +3 -0
- data/db/migrate/20140117160939_refactor_content_views.rb +1 -0
- data/db/migrate/20140222022712_remove_provider_discovery.rb +2 -0
- data/db/migrate/20140502164009_rename_system_groups_to_host_collections.rb +7 -0
- data/db/migrate/20141210173220_create_docker_tables.rb +4 -3
- data/db/migrate/20151219203225_rename_index_repository_puppet_module.rb +1 -1
- data/db/migrate/20160203195736_remove_docker_image_schema.rb +1 -0
- data/db/migrate/20160317171813_change_activation_key_column_names.rb +11 -0
- data/db/migrate/20160323065901_increase_cdn_length.rb +11 -0
- data/db/migrate/20160404132250_remove_katello_from_notification_name.rb +26 -0
- data/db/seeds.d/103-provisioning_templates.rb +3 -1
- data/db/seeds.d/106-mail_notifications.rb +3 -3
- data/db/seeds.d/109-atomic_os.rb +11 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/activationKeyConsumed.filter.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-associations.controller.js +21 -9
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-add-subscriptions.html +3 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html +41 -40
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-info.html +7 -7
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-subscriptions-list.html +3 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/new/new-activation-key.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/new/views/activation-key-new.html +8 -8
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.routes.js +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +0 -8
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +19 -16
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js +5 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +27 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-products.controller.js +79 -26
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-add-subscriptions.html +3 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-details.html +32 -10
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +8 -8
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-products.html +11 -11
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-subscriptions-list.html +3 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-promotion.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-puppet-modules.html +3 -3
- 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/details/errata-content-hosts.controller.js +33 -10
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/errata-details-content-hosts.html +5 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/apply-errata-confirm.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/views/gpg-key-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/new/new-gpg-key.controller.js +7 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/new/views/host-collection-new-form.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-subscription.factory.js +3 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/check-current-organization.run.js +3 -15
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js +36 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/organization.factory.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/views/bulk-actions.html +14 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-details.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-repositories.html +13 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/details/views/repository-info.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/details/views/repository-manage-docker-manifests.html +3 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/details/views/repository-manage-packages.html +7 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/details/views/repository-manage-puppet-modules.html +5 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/manifest-import.controller.js +16 -6
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/sync-plan-details-info.controller.js +7 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-details.html +1 -1
- data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +6 -0
- data/lib/katello/engine.rb +4 -3
- data/lib/katello/permissions/host_permissions.rb +1 -0
- data/lib/katello/version.rb +1 -1
- metadata +17 -11
- data/app/controllers/katello/concerns/api/v2/bulk_systems_extensions.rb +0 -39
- data/app/views/katello/api/v2/systems/content_override.json.rabl +0 -3
- data/app/views/katello/api/v2/systems/product_content.json.rabl +0 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-product-details.controller.js +0 -97
- data/lib/katello/tasks/upgrades/2.1/import_errata.rake +0 -45
- data/lib/katello/tasks/upgrades/2.2/update_gpg_key_urls.rake +0 -20
- data/lib/katello/tasks/upgrades/2.2/update_metadata_expire.rake +0 -18
@@ -10,7 +10,8 @@ module Actions
|
|
10
10
|
def plan(repository, options = {})
|
11
11
|
planned_destroy = options.fetch(:planned_destroy, false)
|
12
12
|
|
13
|
-
skip_environment_update = options.fetch(:
|
13
|
+
skip_environment_update = options.fetch(:skip_environment_update, false) ||
|
14
|
+
options.fetch(:organization_destroy, false)
|
14
15
|
action_subject(repository)
|
15
16
|
|
16
17
|
if !planned_destroy && !repository.assert_deletable
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Actions
|
2
|
+
module Katello
|
3
|
+
module Repository
|
4
|
+
class ImportApplicability < Actions::Base
|
5
|
+
middleware.use Actions::Middleware::ExecuteIfContentsChanged
|
6
|
+
|
7
|
+
input_format do
|
8
|
+
param :repo_id
|
9
|
+
param :contents_changed
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
repo = ::Katello::Repository.find(input[:repo_id])
|
14
|
+
repo.import_host_applicability
|
15
|
+
end
|
16
|
+
|
17
|
+
def rescue_strategy_for_self
|
18
|
+
Dynflow::Action::Rescue::Skip
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -45,6 +45,7 @@ module Actions
|
|
45
45
|
plan_self(:id => repo.id, :sync_result => output, :user_id => ::User.current.id, :contents_changed => contents_changed)
|
46
46
|
plan_action(Pulp::Repository::RegenerateApplicability, :pulp_id => repo.pulp_id, :contents_changed => contents_changed)
|
47
47
|
end
|
48
|
+
plan_action(Katello::Repository::ImportApplicability, :repo_id => repo.id, :contents_changed => contents_changed)
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
@@ -70,14 +71,6 @@ module Actions
|
|
70
71
|
def rescue_strategy
|
71
72
|
Dynflow::Action::Rescue::Skip
|
72
73
|
end
|
73
|
-
|
74
|
-
def finalize
|
75
|
-
::User.current = ::User.anonymous_admin
|
76
|
-
repo = ::Katello::Repository.find(input[:id])
|
77
|
-
repo.import_system_applicability
|
78
|
-
ensure
|
79
|
-
::User.current = nil
|
80
|
-
end
|
81
74
|
end
|
82
75
|
end
|
83
76
|
end
|
@@ -20,6 +20,20 @@ module Actions
|
|
20
20
|
task
|
21
21
|
end
|
22
22
|
|
23
|
+
def finalize
|
24
|
+
check_error_details
|
25
|
+
end
|
26
|
+
|
27
|
+
def check_error_details
|
28
|
+
output[:pulp_tasks].each do |pulp_task|
|
29
|
+
error_details = pulp_task.try(:[], "result").try(:[], "details").try(:[], "rpm").try(:[], "details").try(:[], "trace")
|
30
|
+
error_message = pulp_task.try(:[], "result").try(:[], "details").try(:[], "rpm").try(:[], "details").try(:[], "message")
|
31
|
+
if error_details.include?("YumDownloadError") && error_message
|
32
|
+
fail _("An error occurred during the sync \n%{error_message}") % {:error_message => error_details}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
23
37
|
def presenter
|
24
38
|
Consumer::ContentPresenter.new(self)
|
25
39
|
end
|
@@ -91,7 +91,8 @@ module Actions
|
|
91
91
|
def distributors
|
92
92
|
case input[:content_type]
|
93
93
|
when ::Katello::Repository::YUM_TYPE
|
94
|
-
distributors = [yum_distributor,
|
94
|
+
distributors = [yum_distributor, export_distributor]
|
95
|
+
distributors << yum_clone_distributor unless input[:capsule_id]
|
95
96
|
when ::Katello::Repository::FILE_TYPE
|
96
97
|
distributors = [iso_distributor]
|
97
98
|
when ::Katello::Repository::PUPPET_TYPE
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Actions
|
2
|
+
module Pulp
|
3
|
+
module Repository
|
4
|
+
class DeleteDistributor < Pulp::Abstract
|
5
|
+
input_format do
|
6
|
+
param :repo_id
|
7
|
+
param :distributor_id
|
8
|
+
param :capsule_id
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
output[:response] = pulp_resources.repository.
|
13
|
+
delete_distributor(*input.values_at(:repo_id, :distributor_id))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -7,12 +7,14 @@ module Actions
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def plan(repository, input = {})
|
10
|
-
|
11
|
-
|
10
|
+
repository_details = pulp_extensions(input[:capsule_id]).repository.retrieve_with_details(repository.pulp_id)
|
11
|
+
update_or_associate_importer(input[:capsule_id], repository, repository_details)
|
12
|
+
update_or_associate_distributors(input[:capsule_id], repository, repository_details)
|
13
|
+
remove_unnecessary_distributors(input[:capsule_id], repository, repository_details)
|
12
14
|
end
|
13
15
|
|
14
|
-
def update_or_associate_importer(capsule_id, repository)
|
15
|
-
existing_importers =
|
16
|
+
def update_or_associate_importer(capsule_id, repository, repository_details)
|
17
|
+
existing_importers = repository_details["importers"]
|
16
18
|
importer = capsule_id ? repository.generate_importer(true) : repository.generate_importer
|
17
19
|
importer_config = capsule_id ? importer.config.merge!(importer_certs(repository)) : importer.config
|
18
20
|
found = existing_importers.find { |i| i['importer_type_id'] == importer.id }
|
@@ -35,10 +37,10 @@ module Actions
|
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
38
|
-
def update_or_associate_distributors(capsule_id, repository)
|
40
|
+
def update_or_associate_distributors(capsule_id, repository, repository_details)
|
39
41
|
concurrence do
|
40
|
-
existing_distributors =
|
41
|
-
repository.generate_distributors.each do |distributor|
|
42
|
+
existing_distributors = repository_details["distributors"]
|
43
|
+
repository.generate_distributors(capsule_id.present?).each do |distributor|
|
42
44
|
found = existing_distributors.find { |i| i['distributor_type_id'] == distributor.type_id }
|
43
45
|
if found
|
44
46
|
plan_action(::Actions::Pulp::Repository::RefreshDistributor,
|
@@ -60,6 +62,22 @@ module Actions
|
|
60
62
|
end
|
61
63
|
end
|
62
64
|
|
65
|
+
def remove_unnecessary_distributors(capsule_id, repository, repository_details)
|
66
|
+
concurrence do
|
67
|
+
existing_distributors = repository_details["distributors"]
|
68
|
+
generated_distributors = repository.generate_distributors(capsule_id.present?)
|
69
|
+
existing_distributors.each do |distributor|
|
70
|
+
found = generated_distributors.find { |dist| dist.type_id == distributor['distributor_type_id'] }
|
71
|
+
unless found
|
72
|
+
plan_action(Pulp::Repository::DeleteDistributor, :repo_id => repository.pulp_id,
|
73
|
+
:distributor_id => distributor['id'],
|
74
|
+
:capsule_id => capsule_id
|
75
|
+
)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
63
81
|
def importer_certs(repository)
|
64
82
|
ueber_cert = ::Cert::Certs.ueber_cert(repository.organization)
|
65
83
|
|
@@ -19,7 +19,7 @@ module Katello
|
|
19
19
|
rescue_from Errors::SecurityViolation, :with => :rescue_from_security_violation
|
20
20
|
rescue_from Errors::ConflictException, :with => :rescue_from_conflict_exception
|
21
21
|
rescue_from Errors::UnsupportedActionException, :with => :rescue_from_unsupported_action_exception
|
22
|
-
rescue_from Errors::
|
22
|
+
rescue_from Errors::MaxHostsReachedException, :with => :rescue_from_max_hosts_reached_exception
|
23
23
|
rescue_from Errors::CdnSubstitutionError, :with => :rescue_from_bad_data
|
24
24
|
rescue_from ActionController::ParameterMissing, :with => :rescue_from_missing_param
|
25
25
|
end
|
@@ -79,7 +79,7 @@ module Katello
|
|
79
79
|
respond_for_exception(exception, :status => :unprocessable_entity)
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
82
|
+
def rescue_from_max_hosts_reached_exception(exception)
|
83
83
|
respond_for_exception(exception, :status => :conflict, :with_logging => false)
|
84
84
|
end
|
85
85
|
|
@@ -105,6 +105,11 @@ module Katello
|
|
105
105
|
@capsule.default_capsule?
|
106
106
|
end
|
107
107
|
|
108
|
+
def orphaned_repos
|
109
|
+
@capsule.pulp_repositories.map { |x| x["id"] } - current_repositories.map { |x| x.pulp_id }
|
110
|
+
end
|
111
|
+
|
112
|
+
# shows repos available both in katello and on the capsule.
|
108
113
|
def current_repositories(environment_id = nil, content_view_id = nil)
|
109
114
|
@current_repositories ||= @capsule.pulp_repositories
|
110
115
|
katello_repo_ids = []
|
@@ -140,6 +145,12 @@ module Katello
|
|
140
145
|
self.capsule.url + "/pulp/api/v2/"
|
141
146
|
end
|
142
147
|
|
148
|
+
def pulp_repo_facts(pulp_id)
|
149
|
+
self.pulp_server.extensions.repository.retrieve_with_details(pulp_id)
|
150
|
+
rescue RestClient::ResourceNotFound
|
151
|
+
nil
|
152
|
+
end
|
153
|
+
|
143
154
|
def self.with_environment(environment, include_default = false)
|
144
155
|
features = [SmartProxy::PULP_NODE_FEATURE]
|
145
156
|
features << SmartProxy::PULP_FEATURE if include_default
|
data/app/lib/katello/errors.rb
CHANGED
@@ -9,7 +9,7 @@ module Katello
|
|
9
9
|
end
|
10
10
|
|
11
11
|
set_locale_for(user) do
|
12
|
-
mail(:to => user.mail, :subject => _("
|
12
|
+
mail(:to => user.mail, :subject => _("Host Errata Advisory"))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -22,7 +22,7 @@ module Katello
|
|
22
22
|
@errata = all_errata.take(100).group_by(&:errata_type)
|
23
23
|
|
24
24
|
set_locale_for(user) do
|
25
|
-
mail(:to => user.mail, :subject => (_("
|
25
|
+
mail(:to => user.mail, :subject => (_("Sync Summary for %s") % @repo.name))
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -37,7 +37,7 @@ module Katello
|
|
37
37
|
@errata = @content_facets.map(&:installable_errata).flatten.uniq
|
38
38
|
|
39
39
|
set_locale_for(user) do
|
40
|
-
mail(:to => user.mail, :subject => (_("
|
40
|
+
mail(:to => user.mail, :subject => (_("Promotion Summary for %{content_view}") % {:content_view => @content_view.name}))
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -30,11 +30,11 @@ module Katello
|
|
30
30
|
validates :name, :presence => true
|
31
31
|
validates :name, :uniqueness => {:scope => :organization_id}
|
32
32
|
validate :environment_exists
|
33
|
-
validates :
|
34
|
-
validates_each :
|
35
|
-
if record.
|
33
|
+
validates :max_hosts, :numericality => {:less_than => 2**31, :allow_nil => true}
|
34
|
+
validates_each :max_hosts do |record, attr, value|
|
35
|
+
if record.unlimited_hosts
|
36
36
|
unless value.nil?
|
37
|
-
record.errors[attr] << _("cannot be set because unlimited
|
37
|
+
record.errors[attr] << _("cannot be set because unlimited hosts is set")
|
38
38
|
end
|
39
39
|
else
|
40
40
|
if value.nil?
|
@@ -107,7 +107,7 @@ module Katello
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def available_content
|
110
|
-
self.products.map(&:available_content).flatten.uniq { |product| product.content.id }
|
110
|
+
self.products ? self.products.map(&:available_content).flatten.uniq { |product| product.content.id } : []
|
111
111
|
end
|
112
112
|
|
113
113
|
def valid_content_label?(content_label)
|
@@ -178,7 +178,7 @@ module Katello
|
|
178
178
|
def copy(new_name)
|
179
179
|
new_key = ActivationKey.new
|
180
180
|
new_key.name = new_name
|
181
|
-
new_key.attributes = self.attributes.slice("description", "environment_id", "organization_id", "content_view_id", "
|
181
|
+
new_key.attributes = self.attributes.slice("description", "environment_id", "organization_id", "content_view_id", "max_hosts", "unlimited_hosts")
|
182
182
|
new_key.host_collection_ids = self.host_collection_ids
|
183
183
|
new_key
|
184
184
|
end
|
@@ -34,5 +34,20 @@ module Katello
|
|
34
34
|
override = activation_key.content_overrides.find { |pc| pc[:contentLabel] == content.label }
|
35
35
|
override.nil? ? 'default' : override[:value]
|
36
36
|
end
|
37
|
+
|
38
|
+
def content_type
|
39
|
+
self.content.type
|
40
|
+
end
|
41
|
+
|
42
|
+
def displayable?
|
43
|
+
case content_type
|
44
|
+
when ::Katello::Repository::CANDLEPIN_DOCKER_TYPE
|
45
|
+
false
|
46
|
+
when ::Katello::Repository::CANDLEPIN_OSTREE_TYPE
|
47
|
+
::Katello::RepositoryTypeManager.enabled?(Repository::OSTREE_TYPE)
|
48
|
+
else
|
49
|
+
true
|
50
|
+
end
|
51
|
+
end
|
37
52
|
end
|
38
53
|
end
|
@@ -23,8 +23,11 @@ module Katello
|
|
23
23
|
has_many :applicable_errata, :through => :content_facet
|
24
24
|
|
25
25
|
scoped_search :in => :content_view, :on => :name, :complete_value => true, :rename => :content_view
|
26
|
+
scoped_search :in => :content_facet, :on => :content_view_id, :rename => :content_view_id
|
26
27
|
scoped_search :in => :lifecycle_environment, :on => :name, :complete_value => true, :rename => :lifecycle_environment
|
28
|
+
scoped_search :in => :content_facet, :on => :lifecycle_environment_id, :rename => :lifecycle_environment_id
|
27
29
|
scoped_search :in => :applicable_errata, :on => :errata_id, :rename => :applicable_errata, :complete_value => true, :ext_method => :find_by_applicable_errata
|
30
|
+
scoped_search :in => :applicable_errata, :on => :errata_id, :rename => :installable_errata, :complete_value => true, :ext_method => :find_by_installable_errata
|
28
31
|
|
29
32
|
accepts_nested_attributes_for :content_facet, :reject_if => proc { |attributes| attributes['content_view_id'].blank? && attributes['lifecycle_environment_id'].blank? }
|
30
33
|
attr_accessible :content_facet_attributes
|
@@ -40,6 +43,16 @@ module Katello
|
|
40
43
|
{ :conditions => "#{::Host::Managed.table_name}.id IN (#{hosts.pluck(:id).join(',')})" }
|
41
44
|
end
|
42
45
|
end
|
46
|
+
|
47
|
+
def find_by_installable_errata(_key, operator, value)
|
48
|
+
conditions = sanitize_sql_for_conditions(["#{Katello::Erratum.table_name}.errata_id #{operator} ?", value_to_sql(operator, value)])
|
49
|
+
facets = Katello::Host::ContentFacet.joins_installable_errata.where(conditions)
|
50
|
+
if facets.empty?
|
51
|
+
{ :conditions => "1=0" }
|
52
|
+
else
|
53
|
+
{ :conditions => "#{::Host::Managed.table_name}.id IN (#{facets.pluck(:host_id).join(',')})" }
|
54
|
+
end
|
55
|
+
end
|
43
56
|
end
|
44
57
|
end
|
45
58
|
end
|
@@ -3,15 +3,25 @@ module Katello
|
|
3
3
|
module OperatingsystemExtensions
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
+
REDHAT_ATOMIC_HOST_DISTRO_NAME = "Red Hat Enterprise Linux Atomic Host"
|
7
|
+
REDHAT_ATOMIC_HOST_OS = "RedHat_Enterprise_Linux_Atomic_Host"
|
8
|
+
|
6
9
|
included do
|
7
10
|
after_create :assign_templates!
|
11
|
+
before_create :set_atomic_attributes, :if => proc { |os| os.name == ::Operatingsystem::REDHAT_ATOMIC_HOST_OS }
|
8
12
|
end
|
9
13
|
|
10
14
|
def assign_templates!
|
11
15
|
# Automatically assign default templates
|
12
16
|
if self.family == 'Redhat'
|
13
17
|
TemplateKind.all.each do |kind|
|
14
|
-
if
|
18
|
+
if name == ::Operatingsystem::REDHAT_ATOMIC_HOST_OS && kind.name == "provision"
|
19
|
+
provisioning_template_name = Setting["katello_default_atomic_provision"]
|
20
|
+
else
|
21
|
+
provisioning_template_name = Setting["katello_default_#{kind.name}"]
|
22
|
+
end
|
23
|
+
|
24
|
+
if (template = ProvisioningTemplate.find_by_name(provisioning_template_name))
|
15
25
|
provisioning_templates << template unless provisioning_templates.include?(template)
|
16
26
|
if OsDefaultTemplate.where(:template_kind_id => kind.id, :operatingsystem_id => id).empty?
|
17
27
|
OsDefaultTemplate.create(:template_kind_id => kind.id, :provisioning_template_id => template.id, :operatingsystem_id => id)
|
@@ -24,6 +34,12 @@ module Katello
|
|
24
34
|
end
|
25
35
|
end
|
26
36
|
end
|
37
|
+
|
38
|
+
def set_atomic_attributes
|
39
|
+
self.description = "#{::Operatingsystem::REDHAT_ATOMIC_HOST_DISTRO_NAME} #{release}"
|
40
|
+
self.architectures << Architecture.where(:name => "x86_64").first_or_create
|
41
|
+
self.family = "Redhat"
|
42
|
+
end
|
27
43
|
end
|
28
44
|
end
|
29
45
|
end
|
@@ -51,7 +51,9 @@ module Katello
|
|
51
51
|
table_name = self.repository_association_class.table_name
|
52
52
|
attribute_name = "#{self.name.demodulize.underscore}_id"
|
53
53
|
|
54
|
-
existing_ids = self.repository_association_class.
|
54
|
+
existing_ids = self.repository_association_class.uncached do
|
55
|
+
self.repository_association_class.where(:repository_id => repository).pluck(attribute_name)
|
56
|
+
end
|
55
57
|
new_ids = associated_ids - existing_ids
|
56
58
|
delete_ids = existing_ids - associated_ids
|
57
59
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Katello
|
2
|
+
module Concerns
|
3
|
+
module SettingExtensions
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
validates :value, inclusion: { in: ::Runcible::Models::YumImporter::DOWNLOAD_POLICIES },
|
8
|
+
if: ->(setting) { setting.name == 'default_download_policy' }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -25,7 +25,7 @@ module Katello
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
has_many :content_view_repositories, :dependent => :destroy
|
28
|
+
has_many :content_view_repositories, :dependent => :destroy, :inverse_of => :content_view
|
29
29
|
has_many :repositories, :through => :content_view_repositories, :class_name => "Katello::Repository",
|
30
30
|
:after_remove => :remove_repository
|
31
31
|
|
@@ -83,9 +83,9 @@ module Katello
|
|
83
83
|
new_view = ContentView.new
|
84
84
|
new_view.name = new_name
|
85
85
|
new_view.attributes = self.attributes.slice("description", "organization_id", "default", "composite")
|
86
|
+
new_view.save!
|
86
87
|
new_view.repositories = self.repositories
|
87
88
|
new_view.components = self.components
|
88
|
-
new_view.save!
|
89
89
|
|
90
90
|
self.content_view_puppet_modules.each do |puppet_module|
|
91
91
|
new_view.content_view_puppet_modules << puppet_module.dup
|
@@ -54,6 +54,13 @@ module Katello
|
|
54
54
|
return self.errata_id <=> other.errata_id
|
55
55
|
end
|
56
56
|
|
57
|
+
def self.with_identifiers(ids)
|
58
|
+
ids = [ids] unless ids.is_a?(Array)
|
59
|
+
ids.map!(&:to_s)
|
60
|
+
id_integers = ids.map { |string| Integer(string) rescue -1 }
|
61
|
+
where("#{self.table_name}.id = (?) or #{self.table_name}.uuid = (?) or #{self.table_name}.errata_id = (?)", id_integers, ids, ids)
|
62
|
+
end
|
63
|
+
|
57
64
|
def hosts_applicable
|
58
65
|
self.content_facets_applicable.joins(:host)
|
59
66
|
end
|