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
@@ -13,16 +13,22 @@ module Katello
|
|
13
13
|
unless bulk_params[:included][:ids].blank?
|
14
14
|
@hosts = ::Host::Managed.authorized(permission).where(:id => bulk_params[:included][:ids])
|
15
15
|
@hosts = @hosts.where(:organization_id => organization.id) if organization
|
16
|
-
@hosts = @hosts.where('id not in (?)', bulk_params[:excluded]) unless bulk_params[:excluded][:ids].blank?
|
17
|
-
@hosts = restrict_to.call(@hosts) if restrict_to
|
18
16
|
end
|
19
17
|
|
20
18
|
if bulk_params[:included][:search]
|
21
|
-
search_hosts = ::Host::Managed.
|
19
|
+
search_hosts = ::Host::Managed.authorized(permission)
|
20
|
+
search_hosts = search_hosts.where(:organization_id => organization_id) if params[:organization_id]
|
22
21
|
search_hosts = search_hosts.search_for(bulk_params[:included][:search])
|
23
|
-
@hosts
|
22
|
+
if @hosts.any?
|
23
|
+
::Host.where("id in (?) OR id in (?)", @hosts, search_hosts)
|
24
|
+
else
|
25
|
+
@hosts = search_hosts
|
26
|
+
end
|
24
27
|
end
|
25
28
|
|
29
|
+
@hosts = restrict_to.call(@hosts) if restrict_to
|
30
|
+
@hosts = @hosts.where('id not in (?)', bulk_params[:excluded][:ids]) unless bulk_params[:excluded][:ids].blank?
|
31
|
+
|
26
32
|
if bulk_params[:included][:ids].blank? && bulk_params[:included][:search].nil?
|
27
33
|
fail HttpErrors::BadRequest, _("No hosts have been specified.")
|
28
34
|
elsif @hosts.empty?
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Katello
|
2
|
+
module Concerns
|
3
|
+
module SettingsHelperExtensions
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
alias_method_chain :value, :katello
|
8
|
+
end
|
9
|
+
|
10
|
+
def value_with_katello(setting)
|
11
|
+
return value_without_katello(setting) unless [
|
12
|
+
'default_download_policy',
|
13
|
+
'katello_default_finish',
|
14
|
+
'katello_default_iPXE',
|
15
|
+
'katello_default_provision',
|
16
|
+
'katello_default_ptable',
|
17
|
+
'katello_default_PXELinux',
|
18
|
+
'katello_default_user_data',
|
19
|
+
'katello_default_kexec'
|
20
|
+
].include?(setting.name)
|
21
|
+
|
22
|
+
case setting.name
|
23
|
+
when "default_download_policy"
|
24
|
+
edit_select(setting, :value, :select_values => Hash[::Runcible::Models::YumImporter::DOWNLOAD_POLICIES.collect { |p| [p, p] }].to_json)
|
25
|
+
when "katello_default_finish"
|
26
|
+
edit_select(setting, :value, :select_values => katello_template_setting_values("finish"))
|
27
|
+
when "katello_default_iPXE"
|
28
|
+
edit_select(setting, :value, :select_values => katello_template_setting_values("iPXE"))
|
29
|
+
when "katello_default_provision"
|
30
|
+
edit_select(setting, :value, :select_values => katello_template_setting_values("provision"))
|
31
|
+
when "katello_default_ptable"
|
32
|
+
edit_select(setting, :value, :select_values => Hash[Template.all.where(:type => "Ptable").map { |tmp| [tmp[:name], tmp[:name]] }].to_json)
|
33
|
+
when "katello_default_PXELinux"
|
34
|
+
edit_select(setting, :value, :select_values => katello_template_setting_values("PXELinux"))
|
35
|
+
when "katello_default_user_data"
|
36
|
+
edit_select(setting, :value, :select_values => katello_template_setting_values("user_data"))
|
37
|
+
when "katello_default_kexec"
|
38
|
+
edit_select(setting, :value, :select_values => katello_template_setting_values("kexec"))
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def katello_template_setting_values(name)
|
45
|
+
templates = ProvisioningTemplate.where(:template_kind => TemplateKind.where(:name => name))
|
46
|
+
templates.each_with_object({}) { |tmpl, hash| hash[tmpl.name] = tmpl.name }.to_json
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -34,13 +34,27 @@ module Katello
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
def fetch_lifecycle_environment(host, options = {})
|
38
|
+
selected_host_group = options.fetch(:selected_host_group, nil)
|
39
|
+
selected_env = lifecycle_environment(host)
|
40
|
+
return selected_env if selected_env.present?
|
41
|
+
lifecycle_environment(selected_host_group) if selected_host_group.present?
|
42
|
+
end
|
43
|
+
|
44
|
+
def fetch_content_view(host, options = {})
|
45
|
+
selected_host_group = options.fetch(:selected_host_group, nil)
|
46
|
+
selected_content_view = content_view(host)
|
47
|
+
return selected_content_view if selected_content_view.present?
|
48
|
+
content_view(selected_host_group) if selected_host_group.present?
|
49
|
+
end
|
50
|
+
|
37
51
|
def lifecycle_environment_options(host, options = {})
|
38
52
|
include_blank = options.fetch(:include_blank, nil)
|
39
53
|
if include_blank == true #check for true specifically
|
40
54
|
include_blank = '<option></option>'
|
41
55
|
end
|
56
|
+
selected_id = fetch_lifecycle_environment(host, options).try(:id)
|
42
57
|
|
43
|
-
selected_id = lifecycle_environment(host).try(:id)
|
44
58
|
orgs = Organization.current ? [Organization.current] : Organization.my_organizations
|
45
59
|
all_options = []
|
46
60
|
orgs.each do |org|
|
@@ -67,9 +81,8 @@ module Katello
|
|
67
81
|
if include_blank == true #check for true specifically
|
68
82
|
include_blank = '<option></option>'
|
69
83
|
end
|
70
|
-
|
71
|
-
content_view =
|
72
|
-
lifecycle_environment = lifecycle_environment(host)
|
84
|
+
lifecycle_environment = fetch_lifecycle_environment(host, options)
|
85
|
+
content_view = fetch_content_view(host, options)
|
73
86
|
|
74
87
|
views = []
|
75
88
|
if lifecycle_environment
|
@@ -5,14 +5,15 @@ module Katello
|
|
5
5
|
URI(url).host unless url.nil?
|
6
6
|
end
|
7
7
|
|
8
|
-
def subscription_manager_configuration_url(host = nil)
|
8
|
+
def subscription_manager_configuration_url(host = nil, rpm = true)
|
9
9
|
prefix = if host && host.content_source
|
10
10
|
"http://#{@host.content_source.hostname}"
|
11
11
|
else
|
12
12
|
Setting[:foreman_url].sub(/\Ahttps/, 'http')
|
13
13
|
end
|
14
|
+
config = rpm ? SETTINGS[:katello][:consumer_cert_rpm] : SETTINGS[:katello][:consumer_cert_sh]
|
14
15
|
|
15
|
-
"#{prefix}/pub/#{
|
16
|
+
"#{prefix}/pub/#{config}"
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -11,7 +11,6 @@ module Katello
|
|
11
11
|
{:id => :debug, :name => _('Debug RPMs'), :products => {}},
|
12
12
|
{:id => :beta, :name => _('Beta'), :products => {}},
|
13
13
|
{:id => :isos, :name => _('ISOs'), :products => {}},
|
14
|
-
{:id => :docker_manifests, :name => _('Docker Manifests'), :products => {}},
|
15
14
|
{:id => :ostree, :name => _('OSTree'), :products => {}},
|
16
15
|
{:id => :other, :name => _('Other'), :products => {}}
|
17
16
|
]
|
@@ -22,11 +21,9 @@ module Katello
|
|
22
21
|
redhat_repo_tabs.each { |tab| tabs[tab[:id]] = tab }
|
23
22
|
|
24
23
|
provider.products.each do |product|
|
25
|
-
product.
|
24
|
+
product.displayable_product_contents.each do |prod_content|
|
26
25
|
name = prod_content.content.name
|
27
|
-
if prod_content.
|
28
|
-
key = :docker_manifests
|
29
|
-
elsif prod_content.content.type == ::Katello::Repository::CANDLEPIN_OSTREE_TYPE
|
26
|
+
if prod_content.content_type == ::Katello::Repository::CANDLEPIN_OSTREE_TYPE
|
30
27
|
key = :ostree
|
31
28
|
elsif name.include?(" Beta ")
|
32
29
|
key = :beta
|
@@ -5,7 +5,7 @@ module Actions
|
|
5
5
|
def plan(capsule, environment, content_view)
|
6
6
|
sequence do
|
7
7
|
plan_action(RemoveUnneededRepos, capsule)
|
8
|
-
plan_action(
|
8
|
+
plan_action(CreateRepos, capsule, environment, content_view)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Actions
|
2
2
|
module Katello
|
3
3
|
module CapsuleContent
|
4
|
-
class
|
4
|
+
class CreateRepos < ::Actions::EntryAction
|
5
5
|
# @param capsule_content [::Katello::CapsuleContent]
|
6
6
|
def plan(capsule_content, environment = nil, content_view = nil)
|
7
7
|
fail _("Action not allowed for the default capsule.") if capsule_content.default_capsule?
|
@@ -9,15 +9,10 @@ module Actions
|
|
9
9
|
current_repos_on_capsule = capsule_content.current_repositories(environment, content_view)
|
10
10
|
list_of_repos_to_sync = capsule_content.repos_available_to_capsule(environment, content_view)
|
11
11
|
need_creation = list_of_repos_to_sync - current_repos_on_capsule
|
12
|
-
need_update = current_repos_on_capsule & list_of_repos_to_sync
|
13
12
|
|
14
13
|
need_creation.each do |repo|
|
15
14
|
create_repo_in_pulp(capsule_content, repo)
|
16
15
|
end
|
17
|
-
|
18
|
-
need_update.each do |repo|
|
19
|
-
plan_action(Pulp::Repository::Refresh, repo, capsule_id: capsule_content.capsule.id)
|
20
|
-
end
|
21
16
|
end
|
22
17
|
|
23
18
|
def create_repo_in_pulp(capsule_content, repository)
|
@@ -37,7 +32,7 @@ module Actions
|
|
37
32
|
checksum_type: checksum_type,
|
38
33
|
path: relative_path,
|
39
34
|
with_importer: true,
|
40
|
-
docker_upstream_name: repository.
|
35
|
+
docker_upstream_name: repository.pulp_id,
|
41
36
|
download_policy: repository.capsule_download_policy,
|
42
37
|
capsule_id: capsule_content.capsule.id)
|
43
38
|
end
|
@@ -3,13 +3,14 @@ module Actions
|
|
3
3
|
module CapsuleContent
|
4
4
|
class RemoveUnneededRepos < ::Actions::Base
|
5
5
|
def plan(capsule_content)
|
6
|
-
|
7
|
-
|
6
|
+
currently_on_capsule = capsule_content.current_repositories.map(&:pulp_id)
|
7
|
+
needed_on_capsule = capsule_content.repos_available_to_capsule.map(&:pulp_id)
|
8
8
|
|
9
|
-
need_removal =
|
10
|
-
need_removal
|
9
|
+
need_removal = currently_on_capsule - needed_on_capsule
|
10
|
+
need_removal += capsule_content.orphaned_repos
|
11
|
+
need_removal.each do |pulp_id|
|
11
12
|
plan_action(Pulp::Repository::Destroy,
|
12
|
-
:pulp_id =>
|
13
|
+
:pulp_id => pulp_id,
|
13
14
|
:capsule_id => capsule_content.capsule.id)
|
14
15
|
end
|
15
16
|
end
|
@@ -19,6 +19,11 @@ module Actions
|
|
19
19
|
|
20
20
|
fail _("Action not allowed for the default capsule.") if capsule_content.default_capsule?
|
21
21
|
|
22
|
+
need_updates = repos_needing_updates(capsule_content, environment, content_view)
|
23
|
+
need_updates.each do |repo|
|
24
|
+
plan_action(Pulp::Repository::Refresh, repo, capsule_id: capsule_content.capsule.id)
|
25
|
+
end
|
26
|
+
|
22
27
|
repository_ids = get_repository_ids(capsule_content, environment, content_view, repository)
|
23
28
|
unless repository_ids.blank?
|
24
29
|
sequence do
|
@@ -33,6 +38,7 @@ module Actions
|
|
33
38
|
repo_pulp_id: repo_id)
|
34
39
|
end
|
35
40
|
end
|
41
|
+
plan_action(RemoveOrphans, :capsule_id => capsule_content.capsule.id)
|
36
42
|
end
|
37
43
|
end
|
38
44
|
end
|
@@ -54,6 +60,32 @@ module Actions
|
|
54
60
|
repository_ids
|
55
61
|
end
|
56
62
|
|
63
|
+
def repos_needing_updates(capsule_content, environment, content_view)
|
64
|
+
need_importer_update = repos_needing_importer_updates(capsule_content, environment, content_view)
|
65
|
+
need_distributor_update = repos_needing_distributor_updates(capsule_content, environment, content_view)
|
66
|
+
(need_distributor_update + need_importer_update).uniq
|
67
|
+
end
|
68
|
+
|
69
|
+
def repos_needing_distributor_updates(capsule, environment, content_view)
|
70
|
+
repos = capsule.repos_available_to_capsule(environment, content_view)
|
71
|
+
repos.select do |repo|
|
72
|
+
repo_details = capsule.pulp_repo_facts(repo.pulp_id)
|
73
|
+
next unless repo_details
|
74
|
+
capsule_distributors = repo_details["distributors"]
|
75
|
+
!(repo.distributors_match?(capsule_distributors))
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def repos_needing_importer_updates(capsule, environment, content_view)
|
80
|
+
repos = capsule.repos_available_to_capsule(environment, content_view)
|
81
|
+
repos.select do |repo|
|
82
|
+
repo_details = capsule.pulp_repo_facts(repo.pulp_id)
|
83
|
+
next unless repo_details
|
84
|
+
capsule_importer = repo_details["importers"][0]["config"]
|
85
|
+
!(repo.importer_matches?(capsule_importer))
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
57
89
|
def rescue_strategy
|
58
90
|
Dynflow::Action::Rescue::Skip
|
59
91
|
end
|
@@ -4,7 +4,7 @@ module Actions
|
|
4
4
|
class IncrementalUpdates < Actions::EntryAction
|
5
5
|
include Helpers::Presenter
|
6
6
|
|
7
|
-
def plan(version_environments, composite_version_environments, content, dep_solve,
|
7
|
+
def plan(version_environments, composite_version_environments, content, dep_solve, hosts, description)
|
8
8
|
old_new_version_map = {}
|
9
9
|
output_for_version_ids = []
|
10
10
|
|
@@ -28,8 +28,9 @@ module Actions
|
|
28
28
|
handle_composites(old_new_version_map, composite_version_environments, output_for_version_ids, description, content[:puppet_module_ids])
|
29
29
|
end
|
30
30
|
|
31
|
-
if
|
32
|
-
|
31
|
+
if hosts.any? && !content[:errata_ids].blank?
|
32
|
+
errata = ::Katello::Erratum.with_identifiers(content[:errata_ids])
|
33
|
+
hosts = hosts.where(:id => ::Katello::Host::ContentFacet.with_applicable_errata(errata).pluck(:host_id))
|
33
34
|
plan_action(::Actions::BulkAction, ::Actions::Katello::Host::Erratum::ApplicableErrataInstall, hosts, content[:errata_ids])
|
34
35
|
end
|
35
36
|
plan_self(:version_outputs => output_for_version_ids)
|
@@ -48,6 +48,10 @@ module Actions
|
|
48
48
|
::Katello::KTEnvironment.find(input[:environment_id]))
|
49
49
|
end
|
50
50
|
|
51
|
+
def rescue_strategy_for_self
|
52
|
+
Dynflow::Action::Rescue::Skip
|
53
|
+
end
|
54
|
+
|
51
55
|
def finalize
|
52
56
|
history = ::Katello::ContentViewHistory.find(input[:history_id])
|
53
57
|
history.status = ::Katello::ContentViewHistory::SUCCESSFUL
|
@@ -54,6 +54,10 @@ module Actions
|
|
54
54
|
::Katello::KTEnvironment.find(input[:environment_id]))
|
55
55
|
end
|
56
56
|
|
57
|
+
def rescue_strategy_for_self
|
58
|
+
Dynflow::Action::Rescue::Skip
|
59
|
+
end
|
60
|
+
|
57
61
|
def finalize
|
58
62
|
history = ::Katello::ContentViewHistory.find(input[:history_id])
|
59
63
|
history.status = ::Katello::ContentViewHistory::SUCCESSFUL
|
@@ -11,12 +11,12 @@ module Actions
|
|
11
11
|
repository.puppet_modules.each do |puppet_module|
|
12
12
|
# first, process content view puppet modules that have been specified by version
|
13
13
|
library_repos = ::Katello::Repository.in_environment(repository.organization.library).
|
14
|
-
|
14
|
+
where(:pulp_id => puppet_module.repositories.map(&:pulp_id))
|
15
15
|
|
16
16
|
if library_repos.length == 1
|
17
17
|
content_view_puppet_modules = ::Katello::ContentViewPuppetModule.joins(:content_view).
|
18
18
|
where("#{::Katello::ContentView.table_name}.organization_id" => repository.organization.id).
|
19
|
-
where(:uuid => puppet_module.id)
|
19
|
+
where(:uuid => puppet_module.id.to_s)
|
20
20
|
|
21
21
|
content_view_puppet_modules.destroy_all
|
22
22
|
end
|
@@ -29,9 +29,8 @@ module Actions
|
|
29
29
|
if content_view_puppet_modules.any?
|
30
30
|
puppet_repoids = ::Katello::Repository.puppet_type.in_environment(repository.organization.library).
|
31
31
|
pluck(:pulp_id).reject { |repoid| repoid == repository.pulp_id }
|
32
|
-
found_puppet_module = ::Katello::PuppetModule.
|
33
|
-
|
34
|
-
puppet_repoids).first
|
32
|
+
found_puppet_module = ::Katello::PuppetModule.
|
33
|
+
latest_module(puppet_module.name, puppet_module.author, puppet_repoids)
|
35
34
|
|
36
35
|
content_view_puppet_modules.destroy_all unless found_puppet_module
|
37
36
|
end
|
@@ -149,16 +149,18 @@ module Actions
|
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
|
-
def copy_yum_content(new_repo, dep_solve,
|
152
|
+
def copy_yum_content(new_repo, dep_solve, package_ids, errata_ids)
|
153
153
|
copy_outputs = []
|
154
154
|
if new_repo.content_type == ::Katello::Repository::YUM_TYPE
|
155
|
-
unless
|
155
|
+
unless errata_ids.blank?
|
156
|
+
errata_uuids = ::Katello::Erratum.with_identifiers(errata_ids).pluck(:uuid)
|
156
157
|
copy_outputs << plan_copy(Pulp::Repository::CopyErrata, new_repo.library_instance, new_repo,
|
157
158
|
{ :filters => {:association => {'unit_id' => {'$in' => errata_uuids}}}},
|
158
159
|
:recursive => true, :resolve_dependencies => dep_solve).output
|
159
160
|
end
|
160
161
|
|
161
|
-
unless
|
162
|
+
unless package_ids.blank?
|
163
|
+
package_uuids = ::Katello::Rpm.with_identifiers(package_ids).pluck(:uuid)
|
162
164
|
copy_outputs << plan_copy(Pulp::Repository::CopyRpm, new_repo.library_instance, new_repo,
|
163
165
|
{ :filters => {:association => {'unit_id' => {'$in' => package_uuids}}}},
|
164
166
|
:resolve_dependencies => dep_solve).output
|
@@ -6,8 +6,8 @@ module Actions
|
|
6
6
|
include Helpers::Presenter
|
7
7
|
|
8
8
|
#takes a list of errata and schedules the installation of those that are applicable
|
9
|
-
def plan(host,
|
10
|
-
applicable_errata = host.content_facet.applicable_errata.
|
9
|
+
def plan(host, errata_ids)
|
10
|
+
applicable_errata = host.content_facet.applicable_errata.with_identifiers(errata_ids)
|
11
11
|
plan_action(Actions::Katello::Host::Erratum::Install, host, applicable_errata.pluck(:errata_id))
|
12
12
|
plan_self(:hostname => host.name)
|
13
13
|
end
|
@@ -43,7 +43,7 @@ module Actions
|
|
43
43
|
content_view.organization)
|
44
44
|
host.subscription_facet ||= ::Katello::Host::SubscriptionFacet.new
|
45
45
|
host.subscription_facet.update_from_consumer_attributes(hypervisor_json)
|
46
|
-
host.subscription_facet.
|
46
|
+
host.subscription_facet.uuid = hypervisor_json[:uuid]
|
47
47
|
host.subscription_facet.save!
|
48
48
|
|
49
49
|
# TODO: Remove this legacy
|
@@ -6,7 +6,10 @@ module Actions
|
|
6
6
|
|
7
7
|
def plan(host, system, consumer_params, content_view_environment, activation_keys = [])
|
8
8
|
sequence do
|
9
|
-
|
9
|
+
unless host.new_record?
|
10
|
+
plan_action(Katello::Host::Unregister, host)
|
11
|
+
host.reload
|
12
|
+
end
|
10
13
|
::Katello::Host::SubscriptionFacet.update_facts(host, consumer_params[:facts]) unless consumer_params[:facts].blank?
|
11
14
|
|
12
15
|
unless activation_keys.empty?
|
@@ -20,12 +23,12 @@ module Actions
|
|
20
23
|
system.save!
|
21
24
|
|
22
25
|
host.content_host = system
|
26
|
+
host.save!
|
23
27
|
host.content_facet = plan_content_facet(host, content_view_environment)
|
24
28
|
host.subscription_facet = plan_subscription_facet(host, activation_keys, consumer_params)
|
25
29
|
host.save!
|
26
30
|
|
27
31
|
action_subject host
|
28
|
-
connect_to_smart_proxy(host)
|
29
32
|
|
30
33
|
cp_create = plan_action(Candlepin::Consumer::Create, cp_environment_id: content_view_environment.cp_id,
|
31
34
|
consumer_parameters: consumer_params, activation_keys: activation_keys.map(&:cp_name))
|
@@ -51,6 +54,8 @@ module Actions
|
|
51
54
|
host.content_facet.save!
|
52
55
|
host.subscription_facet.update_from_consumer_attributes(host.subscription_facet.candlepin_consumer.consumer_attributes)
|
53
56
|
host.subscription_facet.save!
|
57
|
+
host.refresh_global_status!
|
58
|
+
connect_to_smart_proxy(host)
|
54
59
|
|
55
60
|
system = ::Katello::System.find(input[:system_id])
|
56
61
|
system.uuid = input[:uuid]
|
@@ -62,7 +67,8 @@ module Actions
|
|
62
67
|
|
63
68
|
if smart_proxy
|
64
69
|
smart_proxy.content_host = system.content_host
|
65
|
-
|
70
|
+
org = system.content_facet.lifecycle_environment.organization
|
71
|
+
smart_proxy.organizations << org unless smart_proxy.organizations.include?(org)
|
66
72
|
smart_proxy.save!
|
67
73
|
end
|
68
74
|
end
|
@@ -77,7 +83,7 @@ module Actions
|
|
77
83
|
if !host_collection.unlimited_hosts && host_collection.max_hosts >= 0 &&
|
78
84
|
host_collection.systems.length >= host_collection.max_hosts
|
79
85
|
fail _("Host collection '%{name}' exceeds maximum usage limit of '%{limit}'") %
|
80
|
-
{:limit => host_collection.
|
86
|
+
{:limit => host_collection.max_hosts, :name => host_collection.name}
|
81
87
|
end
|
82
88
|
end
|
83
89
|
host.host_collection_ids = host_collection_ids
|