Sha256: 3c6484c4bb4cae7b4ec51e1d2e9099da1a5dab2d092501d1062c6d035a9fe439

Contents?: true

Size: 1.04 KB

Versions: 72

Compression:

Stored size: 1.04 KB

Contents

module Katello
  module Concerns
    module SettingExtensions
      extend ActiveSupport::Concern

      included do
        validates :value, inclusion: { in: ::Runcible::Models::YumImporter::DOWNLOAD_POLICIES },
          if: ->(setting) { setting.name == 'default_download_policy' }

        after_save :recalculate_errata_status
        after_commit :update_global_proxies
      end

      def recalculate_errata_status
        ForemanTasks.async_task(Actions::Katello::Host::RecalculateErrataStatus) if saved_change_to_attribute?(:value) && name == 'errata_status_installable'
      end

      def update_global_proxies
        if saved_change_to_attribute?(:value) && name == 'content_default_http_proxy'
          repos = RootRepository.with_global_proxy.collect(&:library_instance).uniq

          unless repos.empty?
            ForemanTasks.async_task(
              ::Actions::BulkAction,
              ::Actions::Katello::Repository::UpdateHttpProxyDetails,
              repos.sort_by(&:pulp_id))
          end
        end
      end
    end
  end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
katello-4.0.3 app/models/katello/concerns/setting_extensions.rb
katello-3.18.5 app/models/katello/concerns/setting_extensions.rb
katello-4.0.2.1 app/models/katello/concerns/setting_extensions.rb
katello-4.0.2 app/models/katello/concerns/setting_extensions.rb
katello-3.18.4 app/models/katello/concerns/setting_extensions.rb
katello-4.0.1.2 app/models/katello/concerns/setting_extensions.rb
katello-3.18.3.1 app/models/katello/concerns/setting_extensions.rb
katello-4.0.1.1 app/models/katello/concerns/setting_extensions.rb
katello-3.18.3 app/models/katello/concerns/setting_extensions.rb
katello-4.0.1 app/models/katello/concerns/setting_extensions.rb
katello-4.1.0.rc1.1 app/models/katello/concerns/setting_extensions.rb
katello-4.1.0.rc1 app/models/katello/concerns/setting_extensions.rb
katello-4.0.0 app/models/katello/concerns/setting_extensions.rb
katello-4.0.0.rc3.1 app/models/katello/concerns/setting_extensions.rb
katello-4.0.0.rc3 app/models/katello/concerns/setting_extensions.rb
katello-3.18.2.1 app/models/katello/concerns/setting_extensions.rb
katello-3.18.2 app/models/katello/concerns/setting_extensions.rb
katello-3.17.3 app/models/katello/concerns/setting_extensions.rb
katello-4.0.0.rc2 app/models/katello/concerns/setting_extensions.rb
katello-3.18.1.1 app/models/katello/concerns/setting_extensions.rb