katello 3.4.5 → 3.5.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/app/assets/stylesheets/katello/katello.scss +7 -5
- data/app/controllers/katello/api/v2/activation_keys_controller.rb +3 -3
- data/app/controllers/katello/api/v2/api_controller.rb +8 -0
- data/app/controllers/katello/api/v2/capsule_content_controller.rb +6 -1
- data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +2 -1
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +1 -1
- data/app/controllers/katello/api/v2/content_views_controller.rb +1 -1
- data/app/controllers/katello/api/v2/host_collections_controller.rb +1 -1
- data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +2 -2
- data/app/controllers/katello/api/v2/host_tracer_controller.rb +1 -1
- data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +6 -6
- data/app/controllers/katello/api/v2/repositories_controller.rb +6 -7
- data/app/controllers/katello/api/v2/repository_sets_controller.rb +25 -4
- data/app/controllers/katello/concerns/api/v2/content_overrides_controller.rb +2 -4
- data/app/controllers/katello/concerns/api/v2/hostgroups_controller_extensions.rb +10 -27
- data/app/controllers/katello/concerns/api/v2/smart_proxies_controller_extensions.rb +10 -14
- data/app/controllers/katello/concerns/hosts_controller_extensions.rb +33 -0
- data/app/helpers/katello/hosts_and_hostgroups_helper.rb +2 -1
- data/app/helpers/katello/organizations_helper.rb +1 -1
- data/app/helpers/katello/providers_helper.rb +1 -1
- data/app/lib/actions/candlepin/abstract_async_task.rb +1 -1
- data/app/lib/actions/candlepin/candlepin_listening_service.rb +17 -6
- data/app/lib/actions/candlepin/import_pool_handler.rb +21 -56
- data/app/lib/actions/candlepin/listen_on_candlepin_events.rb +1 -0
- data/app/lib/actions/candlepin/owner/import_products.rb +1 -3
- data/app/lib/actions/candlepin/product/content_create.rb +2 -0
- data/app/lib/actions/candlepin/product/content_update.rb +2 -0
- data/app/lib/actions/candlepin/product/create.rb +2 -10
- data/app/lib/actions/candlepin/product/create_unlimited_subscription.rb +8 -1
- data/app/lib/actions/katello/capsule_content/sync.rb +12 -3
- data/app/lib/actions/katello/host/attach_subscriptions.rb +1 -1
- data/app/lib/actions/katello/host/hypervisors_update.rb +2 -4
- data/app/lib/actions/katello/host/remove_subscriptions.rb +1 -1
- data/app/lib/actions/katello/organization/create.rb +2 -2
- data/app/lib/actions/katello/organization/manifest_refresh.rb +1 -2
- data/app/lib/actions/katello/product/content_create.rb +4 -4
- data/app/lib/actions/katello/product/create.rb +13 -11
- data/app/lib/actions/katello/repository/sync.rb +0 -1
- data/app/lib/actions/katello/repository/update.rb +2 -1
- data/app/lib/actions/pulp/consumer/generate_applicability.rb +5 -1
- data/app/lib/actions/pulp/repository/create.rb +1 -0
- data/app/lib/actions/pulp/repository/create_in_plan.rb +4 -4
- data/app/lib/actions/pulp/repository/sync.rb +1 -1
- data/app/lib/katello/http_resource.rb +1 -1
- data/app/lib/katello/lazy_accessor.rb +1 -1
- data/app/lib/katello/resources/candlepin.rb +2 -2
- data/app/lib/katello/util/data.rb +6 -0
- data/app/lib/katello/util/support.rb +1 -1
- data/app/models/katello/activation_key.rb +25 -7
- data/app/models/katello/concerns/host_managed_extensions.rb +60 -17
- data/app/models/katello/concerns/subscription_facet_host_extensions.rb +31 -10
- data/app/models/katello/content_facet_applicable_rpm.rb +0 -2
- data/app/models/katello/content_facet_erratum.rb +0 -2
- data/app/models/katello/content_facet_repository.rb +0 -2
- data/app/models/katello/content_view.rb +3 -4
- data/app/models/katello/content_view_component.rb +1 -3
- data/app/models/katello/content_view_docker_filter_rule.rb +0 -2
- data/app/models/katello/content_view_environment.rb +2 -4
- data/app/models/katello/content_view_erratum_filter_rule.rb +0 -2
- data/app/models/katello/content_view_filter.rb +0 -2
- data/app/models/katello/content_view_package_filter_rule.rb +0 -2
- data/app/models/katello/content_view_package_group_filter_rule.rb +0 -2
- data/app/models/katello/content_view_puppet_environment.rb +0 -2
- data/app/models/katello/content_view_puppet_environment_puppet_module.rb +0 -2
- data/app/models/katello/content_view_puppet_module.rb +0 -2
- data/app/models/katello/content_view_repository.rb +0 -2
- data/app/models/katello/content_view_version.rb +0 -2
- data/app/models/katello/erratum_bugzilla.rb +0 -2
- data/app/models/katello/erratum_cve.rb +0 -2
- data/app/models/katello/erratum_package.rb +0 -2
- data/app/models/katello/ext/label_from_name.rb +1 -1
- data/app/models/katello/glue/candlepin/pool.rb +18 -11
- data/app/models/katello/glue/candlepin/product.rb +1 -2
- data/app/models/katello/glue/pulp/repo.rb +13 -6
- data/app/models/katello/glue/pulp/repos.rb +16 -16
- data/app/models/katello/gpg_key.rb +0 -2
- data/app/models/katello/host/content_facet.rb +21 -0
- data/app/models/katello/host/info_provider.rb +56 -0
- data/app/models/katello/host/subscription_facet.rb +5 -3
- data/app/models/katello/host_collection.rb +0 -2
- data/app/models/katello/host_collection_hosts.rb +0 -2
- data/app/models/katello/host_installed_package.rb +0 -2
- data/app/models/katello/host_tracer.rb +0 -2
- data/app/models/katello/key_host_collection.rb +0 -2
- data/app/models/katello/kt_environment.rb +0 -2
- data/app/models/katello/model.rb +1 -1
- data/app/models/katello/pool.rb +3 -3
- data/app/models/katello/product.rb +10 -3
- data/app/models/katello/provider.rb +0 -2
- data/app/models/katello/repository.rb +0 -2
- data/app/models/katello/repository_docker_manifest.rb +0 -2
- data/app/models/katello/repository_erratum.rb +0 -2
- data/app/models/katello/repository_file.rb +0 -2
- data/app/models/katello/repository_ostree_branch.rb +0 -2
- data/app/models/katello/repository_package_group.rb +0 -1
- data/app/models/katello/repository_puppet_module.rb +0 -2
- data/app/models/katello/repository_rpm.rb +0 -2
- data/app/models/katello/rpm.rb +2 -2
- data/app/models/katello/subscription_facet_activation_key.rb +0 -2
- data/app/models/katello/subscription_facet_pool.rb +6 -0
- data/app/models/katello/subscription_product.rb +0 -1
- data/app/models/katello/sync_plan.rb +0 -2
- data/app/models/katello/task_status.rb +2 -4
- data/app/models/setting/content.rb +2 -0
- data/app/services/katello/candlepin/consumer.rb +1 -2
- data/app/services/katello/candlepin/message_handler.rb +88 -0
- data/app/services/katello/repository_type_manager.rb +1 -1
- data/app/views/dashboard/_content_views_widget.html.erb +2 -2
- data/app/views/dashboard/_errata_widget.html.erb +3 -3
- data/app/views/foreman/smart_proxies/_content_sync.html.erb +25 -8
- data/app/views/foreman/unattended/kickstart-katello-atomic.erb +1 -1
- data/app/views/foreman/unattended/kickstart-katello.erb +1 -1
- data/app/views/katello/api/v2/common/_org_reference.json.rabl +1 -0
- data/app/views/katello/api/v2/content_facet/base.json.rabl +3 -14
- data/app/views/katello/api/v2/products/base.json.rabl +1 -1
- data/app/views/katello/api/v2/repositories/base.json.rabl +1 -1
- data/app/views/katello/api/v2/repository_sets/show.json.rabl +8 -1
- data/app/views/katello/api/v2/subscriptions/base.json.rabl +0 -7
- data/app/views/katello/api/v2/subscriptions/show.json.rabl +4 -37
- data/config/routes/overrides.rb +1 -0
- data/db/migrate/20140422000001_update_products_add_organization.rb +1 -1
- data/db/migrate/20140610154745_content_view_puppet_environment_id.rb +1 -1
- data/db/migrate/20140626204657_add_unlimited_to_activation_keys.rb +1 -1
- data/db/migrate/20140626204902_add_unlimited_to_host_collection.rb +1 -1
- data/db/migrate/20141209103005_disown_foreman_templates.rb +1 -1
- data/db/migrate/20150901213759_remove_distributors.rb +1 -1
- data/db/migrate/20150908222711_drop_marketing_engineering_products.rb +1 -1
- data/db/migrate/20150930183738_migrate_content_hosts.rb +20 -20
- data/db/migrate/20151014144004_host_collection_to_hosts.rb +5 -5
- data/db/migrate/20160114200145_add_mirror_on_sync_to_repositories.rb +1 -1
- data/db/migrate/20160131182301_add_download_policy_to_katello_repositories.rb +1 -1
- data/db/migrate/20160222143432_move_system_description_to_host.rb +2 -2
- data/db/migrate/20160404132250_remove_katello_from_notification_name.rb +1 -1
- data/db/migrate/20160426145517_move_host_description_to_host_comment.rb +1 -1
- data/db/migrate/20160617124149_remove_duplicate_view_filters.rb +4 -4
- data/db/migrate/20160619223332_fix_viewer_role.rb +4 -4
- data/db/migrate/20160701180402_add_sortable_version_to_puppet_modules.rb +1 -1
- data/db/migrate/20160924213020_change_katello_widget_names.rb +1 -1
- data/db/migrate/20161014133811_move_content_view_version_description_to_histories.rb +2 -2
- data/db/migrate/20161026191118_fix_invalid_interfaces.rb +1 -1
- data/db/migrate/20170321012632_fill_in_content_view_components.rb +3 -3
- data/db/migrate/20170718142148_create_katello_subscription_facet_pools.rb +15 -0
- data/db/migrate/20170821170915_add_index_to_installed_packages.rb +5 -0
- data/db/migrate/20170821170916_add_nvra_index_to_installed_packages.rb +5 -0
- data/db/migrate/20170913183848_add_errata_counts.rb +23 -0
- data/db/seeds.d/101-locations.rb +2 -2
- data/db/seeds.d/102-organizations.rb +3 -3
- data/db/seeds.d/103-provisioning_templates.rb +29 -31
- data/db/seeds.d/104-proxy.rb +10 -12
- data/db/seeds.d/106-mail_notifications.rb +30 -32
- data/db/seeds.d/107-enable_dynflow.rb +3 -4
- data/db/seeds.d/108-subcription-bookmarks.rb +12 -10
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/activation-keys.routes.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/new/views/activation-key-new.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/architectures/architecture.factory.js +15 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/architectures/architectures.module.js +14 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion_katello.js +3 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.controller.js +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-repository-sets-modal.controller.js +107 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-repository-sets-modal.html +113 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js +13 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +25 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js +4 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +15 -12
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-repository-sets.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +11 -5
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-activation-keys.html +15 -12
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-content-hosts.html +16 -12
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +9 -6
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/errata-counts.html +6 -12
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/errata.html +4 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/views/packages.html +5 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +20 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +9 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +22 -3
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +17 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.module.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repository-sets/repository-set.factory.js +16 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/subscription-details.controller.js +4 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-details.html +0 -19
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-info.html +31 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/subscriptions.routes.js +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/views/tasks-table.html +6 -3
- data/lib/katello/permissions/host_permissions.rb +1 -0
- data/lib/katello/plugin.rb +7 -5
- data/lib/katello/tasks/clean_installed_packages.rake +54 -0
- data/lib/katello/tasks/import_subscriptions.rake +8 -0
- data/lib/katello/tasks/{setup.rake → reset.rake} +10 -0
- data/lib/katello/tasks/test.rake +18 -0
- data/lib/katello/version.rb +1 -1
- data/vendor/assets/stylesheets/katello/{jquery-ui-1.8.11.custom.css → jquery-ui-1.8.11.custom.css.scss} +0 -0
- data/vendor/assets/stylesheets/katello/{jquery.loadmask.css → jquery.loadmask.css.scss} +0 -0
- data/vendor/assets/stylesheets/katello/{jquery.treeTable.scss → jquery.treeTable.css.scss} +0 -0
- data/vendor/assets/stylesheets/katello/{ui.spinner.css → ui.spinner.css.scss} +0 -0
- metadata +43 -21
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/subscription-activation-keys.controller.js +0 -30
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/subscription-content-hosts.controller.js +0 -45
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-activation-keys.html +0 -48
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-content-hosts.html +0 -62
- data/lib/katello/tasks/upgrades/2.4/import_subscriptions.rake +0 -12
- data/lib/katello/tasks/upgrades/3.3/import_subscriptions.rake +0 -12
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
module Katello
|
|
2
2
|
class ContentFacetApplicableRpm < Katello::Model
|
|
3
|
-
self.include_root_in_json = false
|
|
4
|
-
|
|
5
3
|
belongs_to :content_facet, :inverse_of => :content_facet_applicable_rpms, :class_name => 'Katello::Host::ContentFacet'
|
|
6
4
|
belongs_to :rpm, :inverse_of => :content_facet_applicable_rpms, :class_name => 'Katello::Rpm'
|
|
7
5
|
end
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
module Katello
|
|
2
2
|
class ContentFacetErratum < Katello::Model
|
|
3
|
-
self.include_root_in_json = false
|
|
4
|
-
|
|
5
3
|
# Do not use active record callbacks in this join model. Direct INSERTs and DELETEs are done
|
|
6
4
|
belongs_to :content_facet, :inverse_of => :content_facet_errata, :class_name => 'Katello::Host::ContentFacet'
|
|
7
5
|
belongs_to :erratum, :inverse_of => :content_facet_errata, :class_name => 'Katello::Erratum'
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
module Katello
|
|
2
2
|
class ContentFacetRepository < Katello::Model
|
|
3
|
-
self.include_root_in_json = false
|
|
4
|
-
|
|
5
3
|
belongs_to :content_facet, :inverse_of => :content_facet_repositories, :class_name => 'Katello::Host::ContentFacet'
|
|
6
4
|
belongs_to :repository, :inverse_of => :content_facet_repositories, :class_name => 'Katello::Repository'
|
|
7
5
|
end
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
module Katello
|
|
2
2
|
# rubocop:disable Metrics/ClassLength
|
|
3
3
|
class ContentView < Katello::Model
|
|
4
|
-
self.include_root_in_json = false
|
|
5
|
-
|
|
6
4
|
include Ext::LabelFromName
|
|
7
5
|
include Katello::Authorization::ContentView
|
|
8
6
|
include ForemanTasks::Concerns::ActionSubject
|
|
@@ -613,11 +611,12 @@ module Katello
|
|
|
613
611
|
end
|
|
614
612
|
|
|
615
613
|
def generate_cp_environment_id(env)
|
|
616
|
-
# The id for a default view, will simply be the
|
|
614
|
+
# The id for a default view, will simply be the org label; otherwise, it
|
|
617
615
|
# will be a combination of env id and view id. The reason being,
|
|
618
616
|
# for a default view, the same candlepin environment will be referenced
|
|
619
617
|
# by the kt_environment and content_view_environment.
|
|
620
|
-
self.default ? env.
|
|
618
|
+
value = self.default ? env.organization.label.to_s : [env.organization.label, env.label, self.label].join('-')
|
|
619
|
+
Katello::Util::Data.md5hash(value)
|
|
621
620
|
end
|
|
622
621
|
|
|
623
622
|
def confirm_not_promoted
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
module Katello
|
|
2
2
|
class ContentViewComponent < Katello::Model
|
|
3
|
-
self.include_root_in_json = false
|
|
4
|
-
|
|
5
3
|
belongs_to :composite_content_view, :class_name => "Katello::ContentView",
|
|
6
4
|
:inverse_of => :content_view_components
|
|
7
5
|
belongs_to :content_view_version, :class_name => "Katello::ContentViewVersion",
|
|
@@ -74,7 +72,7 @@ module Katello
|
|
|
74
72
|
end
|
|
75
73
|
|
|
76
74
|
def update_content_view
|
|
77
|
-
if content_view_version.present? &&
|
|
75
|
+
if content_view_version.present? && content_view.blank?
|
|
78
76
|
self.content_view = content_view_version.content_view
|
|
79
77
|
end
|
|
80
78
|
end
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
module Katello
|
|
2
2
|
class ContentViewEnvironment < Katello::Model
|
|
3
|
-
self.include_root_in_json = false
|
|
4
|
-
|
|
5
3
|
include ForemanTasks::Concerns::ActionSubject
|
|
6
4
|
include Glue::Candlepin::Environment if SETTINGS[:katello][:use_cp]
|
|
7
5
|
include Glue if SETTINGS[:katello][:use_cp]
|
|
@@ -45,10 +43,10 @@ module Katello
|
|
|
45
43
|
|
|
46
44
|
if content_view.default?
|
|
47
45
|
self.label ||= environment.label
|
|
48
|
-
self.cp_id ||= environment.
|
|
46
|
+
self.cp_id ||= Katello::Util::Data.md5hash(environment.organization.label)
|
|
49
47
|
else
|
|
50
48
|
self.label ||= [environment.label, content_view.label].join('/')
|
|
51
|
-
self.cp_id ||= [environment.id, content_view.id].join('-')
|
|
49
|
+
self.cp_id ||= Katello::Util::Data.md5hash([environment.id, content_view.id].join('-'))
|
|
52
50
|
end
|
|
53
51
|
end
|
|
54
52
|
end
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
module Katello
|
|
2
2
|
class ContentViewPuppetEnvironmentPuppetModule < Katello::Model
|
|
3
|
-
self.include_root_in_json = false
|
|
4
|
-
|
|
5
3
|
# Do not use active record callbacks in this join model. Direct INSERTs and DELETEs are done
|
|
6
4
|
belongs_to :content_view_puppet_environment,
|
|
7
5
|
:inverse_of => :content_view_puppet_environment_puppet_modules,
|
|
@@ -31,12 +31,12 @@ module Katello
|
|
|
31
31
|
Katello::Resources::Candlepin::Pool.get_for_owner(organization, true)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def import_pool(cp_pool_id)
|
|
34
|
+
def import_pool(cp_pool_id, index_hosts = true)
|
|
35
35
|
pool = nil
|
|
36
36
|
::Katello::Util::Support.active_record_retry do
|
|
37
37
|
pool = Katello::Pool.where(:cp_id => cp_pool_id).first_or_create
|
|
38
38
|
end
|
|
39
|
-
pool.import_data
|
|
39
|
+
pool.import_data(index_hosts)
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -93,8 +93,7 @@ module Katello
|
|
|
93
93
|
subscription
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
def import_data
|
|
96
|
+
def import_data(index_hosts = true)
|
|
98
97
|
pool_attributes = {}.with_indifferent_access
|
|
99
98
|
pool_json = self.backend_data
|
|
100
99
|
product_attributes = pool_json["productAttributes"] + pool_json["attributes"]
|
|
@@ -127,22 +126,30 @@ module Katello
|
|
|
127
126
|
pool_attributes[:unmapped_guest] = true
|
|
128
127
|
end
|
|
129
128
|
|
|
130
|
-
|
|
131
|
-
pool_attributes[:virt_who] = pool_attributes['virt_limit'] != "0" && pool_attributes['virt_limit'].present?
|
|
132
|
-
else
|
|
133
|
-
pool_attributes[:virt_who] = false
|
|
134
|
-
end
|
|
129
|
+
pool_attributes[:virt_who] = pool_attributes['virt_limit'] != "0" && !pool_attributes['virt_limit'].nil? && subscription.try(:redhat?)
|
|
135
130
|
|
|
136
131
|
exceptions = pool_attributes.keys.map(&:to_sym) - self.attribute_names.map(&:to_sym)
|
|
137
132
|
self.update_attributes(pool_attributes.except!(*exceptions))
|
|
138
133
|
self.save!
|
|
139
134
|
self.create_activation_key_associations
|
|
135
|
+
self.import_hosts if index_hosts
|
|
140
136
|
end
|
|
141
137
|
|
|
142
|
-
def
|
|
138
|
+
def import_hosts
|
|
143
139
|
entitlements = Resources::Candlepin::Pool.entitlements(self.cp_id, ["consumer.uuid"])
|
|
144
140
|
uuids = entitlements.map { |ent| ent["consumer"]["uuid"] }
|
|
145
|
-
|
|
141
|
+
sub_facets = Katello::Host::SubscriptionFacet.where(:uuid => uuids)
|
|
142
|
+
sub_facet_ids = sub_facets.pluck(:id)
|
|
143
|
+
sub_facet_ids.each do |sub_facet_id|
|
|
144
|
+
Katello::SubscriptionFacetPool.where(:pool_id => self.id, :subscription_facet_id => sub_facet_id).first_or_create
|
|
145
|
+
end
|
|
146
|
+
existing_associations = Katello::SubscriptionFacetPool.where(:pool_id => self.id)
|
|
147
|
+
correct_associations = Katello::SubscriptionFacetPool.where(:pool_id => self.id, :subscription_facet_id => sub_facet_ids)
|
|
148
|
+
(existing_associations - correct_associations).map(&:destroy)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def hosts
|
|
152
|
+
::Host.where(:id => self.subscription_facets.pluck(:host_id))
|
|
146
153
|
end
|
|
147
154
|
|
|
148
155
|
def create_activation_key_associations
|
|
@@ -49,7 +49,6 @@ module Katello
|
|
|
49
49
|
product.productContent_will_change!
|
|
50
50
|
product.productContent = product.build_product_content(product_content_attrs)
|
|
51
51
|
product.save!
|
|
52
|
-
|
|
53
52
|
rescue => e
|
|
54
53
|
[Rails.logger, import_logger].each do |logger|
|
|
55
54
|
logger.error "Failed to create product #{attrs['name']}: #{e}" if logger
|
|
@@ -58,7 +57,7 @@ module Katello
|
|
|
58
57
|
end
|
|
59
58
|
|
|
60
59
|
module InstanceMethods
|
|
61
|
-
def initialize(attribs = nil
|
|
60
|
+
def initialize(attribs = nil)
|
|
62
61
|
unless attribs.nil?
|
|
63
62
|
attributes_key = attribs.key?(:attributes) ? :attributes : 'attributes'
|
|
64
63
|
if attribs.key?(attributes_key)
|
|
@@ -85,7 +85,7 @@ module Katello
|
|
|
85
85
|
last.nil? ? nil : last.to_s
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
-
def initialize(attrs = nil
|
|
88
|
+
def initialize(attrs = nil)
|
|
89
89
|
if attrs.nil?
|
|
90
90
|
super
|
|
91
91
|
else
|
|
@@ -97,7 +97,7 @@ module Katello
|
|
|
97
97
|
attrs_used_by_model = attrs.reject do |k, _v|
|
|
98
98
|
!self.class.column_defaults.keys.member?(k.to_s) && (!respond_to?(:"#{k.to_s}=") rescue true)
|
|
99
99
|
end
|
|
100
|
-
super(attrs_used_by_model
|
|
100
|
+
super(attrs_used_by_model)
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
|
|
@@ -157,8 +157,7 @@ module Katello
|
|
|
157
157
|
when Repository::FILE_TYPE
|
|
158
158
|
Runcible::Models::IsoImporter.new(importer_ssl_options(capsule).merge(:feed => importer_feed_url(capsule)))
|
|
159
159
|
when Repository::PUPPET_TYPE
|
|
160
|
-
|
|
161
|
-
Runcible::Models::PuppetImporter.new(importer_ssl_options(capsule).merge(options))
|
|
160
|
+
Runcible::Models::PuppetImporter.new(puppet_importer_values(capsule))
|
|
162
161
|
when Repository::DOCKER_TYPE
|
|
163
162
|
options = {}
|
|
164
163
|
options[:upstream_name] = capsule.default_capsule? ? self.docker_upstream_name : self.container_repository_name
|
|
@@ -207,6 +206,14 @@ module Katello
|
|
|
207
206
|
config.merge(importer_ssl_options(capsule))
|
|
208
207
|
end
|
|
209
208
|
|
|
209
|
+
def puppet_importer_values(capsule)
|
|
210
|
+
config = {
|
|
211
|
+
:feed => self.importer_feed_url(capsule),
|
|
212
|
+
:remove_missing => capsule.default_capsule? ? self.mirror_on_sync? : true
|
|
213
|
+
}
|
|
214
|
+
config.merge(importer_ssl_options(capsule))
|
|
215
|
+
end
|
|
216
|
+
|
|
210
217
|
def importer_ssl_options(capsule = SmartProxy.default_capsule!)
|
|
211
218
|
if !capsule.default_capsule?
|
|
212
219
|
ueber_cert = ::Cert::Certs.ueber_cert(organization)
|
|
@@ -709,14 +716,14 @@ module Katello
|
|
|
709
716
|
begin
|
|
710
717
|
history = Katello.pulp_server.extensions.repository.sync_status(pulp_id)
|
|
711
718
|
|
|
712
|
-
if history.
|
|
719
|
+
if history.blank?
|
|
713
720
|
history = PulpSyncStatus.convert_history(Katello.pulp_server.extensions.repository.sync_history(pulp_id))
|
|
714
721
|
end
|
|
715
722
|
rescue
|
|
716
723
|
history = PulpSyncStatus.convert_history(Katello.pulp_server.extensions.repository.sync_history(pulp_id))
|
|
717
724
|
end
|
|
718
725
|
|
|
719
|
-
if history.
|
|
726
|
+
if history.blank?
|
|
720
727
|
return PulpSyncStatus.new(:state => PulpSyncStatus::Status::NOT_SYNCED)
|
|
721
728
|
else
|
|
722
729
|
history = sort_sync_status(history)
|
|
@@ -213,30 +213,30 @@ module Katello
|
|
|
213
213
|
end
|
|
214
214
|
end
|
|
215
215
|
|
|
216
|
-
def add_repo(
|
|
217
|
-
unprotected = unprotected.nil? ? false : unprotected
|
|
216
|
+
def add_repo(repo_param)
|
|
217
|
+
repo_param[:unprotected] = repo_param[:unprotected].nil? ? false : repo_param[:unprotected]
|
|
218
218
|
|
|
219
|
-
if download_policy.blank? &&
|
|
220
|
-
download_policy = Setting[:default_download_policy]
|
|
219
|
+
if repo_param[:download_policy].blank? && repo_param[:content_type] == Repository::YUM_TYPE
|
|
220
|
+
repo_param[:download_policy] = Setting[:default_download_policy]
|
|
221
221
|
end
|
|
222
222
|
|
|
223
|
-
rel_path = if
|
|
224
|
-
Glue::Pulp::Repos.custom_docker_repo_path(self.library, self, label)
|
|
223
|
+
rel_path = if repo_param[:content_type] == 'docker'
|
|
224
|
+
Glue::Pulp::Repos.custom_docker_repo_path(self.library, self, repo_param[:label])
|
|
225
225
|
else
|
|
226
|
-
Glue::Pulp::Repos.custom_repo_path(self.library, self, label)
|
|
226
|
+
Glue::Pulp::Repos.custom_repo_path(self.library, self, repo_param[:label])
|
|
227
227
|
end
|
|
228
228
|
Repository.new(:environment => self.organization.library,
|
|
229
229
|
:product => self,
|
|
230
230
|
:relative_path => rel_path,
|
|
231
|
-
:arch => arch,
|
|
232
|
-
:name => name,
|
|
233
|
-
:label => label,
|
|
234
|
-
:url => url,
|
|
235
|
-
:gpg_key =>
|
|
236
|
-
:unprotected => unprotected,
|
|
237
|
-
:content_type =>
|
|
238
|
-
:checksum_type => checksum_type,
|
|
239
|
-
:download_policy => download_policy,
|
|
231
|
+
:arch => repo_param[:arch],
|
|
232
|
+
:name => repo_param[:name],
|
|
233
|
+
:label => repo_param[:label],
|
|
234
|
+
:url => repo_param[:url],
|
|
235
|
+
:gpg_key => repo_param[:gpg_key],
|
|
236
|
+
:unprotected => repo_param[:unprotected],
|
|
237
|
+
:content_type => repo_param[:content_type],
|
|
238
|
+
:checksum_type => repo_param[:checksum_type],
|
|
239
|
+
:download_policy => repo_param[:download_policy],
|
|
240
240
|
:content_view_version => self.organization.library.default_content_view_version)
|
|
241
241
|
end
|
|
242
242
|
|
|
@@ -64,9 +64,30 @@ module Katello
|
|
|
64
64
|
self.applicable_rpms.in_repositories(repos).uniq
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
def errata_counts
|
|
68
|
+
hash = {
|
|
69
|
+
:security => installable_security_errata_count,
|
|
70
|
+
:bugfix => installable_bugfix_errata_count,
|
|
71
|
+
:enhancement => installable_enhancement_errata_count
|
|
72
|
+
}
|
|
73
|
+
hash[:total] = hash.values.inject(:+)
|
|
74
|
+
hash
|
|
75
|
+
end
|
|
76
|
+
|
|
67
77
|
def import_applicability(partial = false)
|
|
68
78
|
import_errata_applicability(partial)
|
|
69
79
|
import_rpm_applicability(partial)
|
|
80
|
+
update_applicability_counts
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def update_applicability_counts
|
|
84
|
+
self.update_attributes!(
|
|
85
|
+
:installable_security_errata_count => self.installable_errata.security.count,
|
|
86
|
+
:installable_bugfix_errata_count => self.installable_errata.bugfix.count,
|
|
87
|
+
:installable_enhancement_errata_count => self.installable_errata.enhancement.count,
|
|
88
|
+
:applicable_rpm_count => self.applicable_rpms.count,
|
|
89
|
+
:upgradable_rpm_count => self.installable_rpms.count
|
|
90
|
+
)
|
|
70
91
|
end
|
|
71
92
|
|
|
72
93
|
def import_rpm_applicability(partial)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'host_info'
|
|
2
|
+
|
|
3
|
+
module Katello
|
|
4
|
+
module Host
|
|
5
|
+
class InfoProvider < ::HostInfo::Provider
|
|
6
|
+
def host_info
|
|
7
|
+
info = {}
|
|
8
|
+
info['parameters'] = {
|
|
9
|
+
'kt_env' => host.lifecycle_environment.try(:label), #deprecated
|
|
10
|
+
'kt_cv' => host.content_view.try(:label), #deprecated
|
|
11
|
+
'foreman_host_collections' => host.host_collections.map(&:name),
|
|
12
|
+
'lifecycle_environment' => host.lifecycle_environment.try(:label),
|
|
13
|
+
|
|
14
|
+
'content_view' => host.content_view.try(:label),
|
|
15
|
+
'content_view_info' => content_view_info
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if host.content_facet.present?
|
|
19
|
+
info['parameters']['kickstart_repository'] = host.content_facet.kickstart_repository.try(:label)
|
|
20
|
+
end
|
|
21
|
+
info
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def content_view_info
|
|
25
|
+
return {} if host.content_view.blank?
|
|
26
|
+
|
|
27
|
+
content_view_info = {
|
|
28
|
+
'label' => host.content_view.try(:label),
|
|
29
|
+
'latest-version' => host.content_view.try(:latest_version),
|
|
30
|
+
'version' => content_version.try(:version),
|
|
31
|
+
'published' => content_version.try(:created_at),
|
|
32
|
+
'components' => content_view_components
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
content_view_info
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def content_view_components
|
|
39
|
+
return {} unless host.content_view.try(:composite)
|
|
40
|
+
|
|
41
|
+
components = {}
|
|
42
|
+
content_version.try(:content_view_version_components).map do |cv|
|
|
43
|
+
cv_label = cv.component_version.content_view.label
|
|
44
|
+
components[cv_label] = {}
|
|
45
|
+
components[cv_label]['version'] = cv.component_version.try(:version)
|
|
46
|
+
components[cv_label]['published'] = cv.component_version.try(:created_at)
|
|
47
|
+
end
|
|
48
|
+
components
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def content_version
|
|
52
|
+
host.content_view.try(:version, host.lifecycle_environment)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|