Sha256: 1741bf8a0e1794dcf10b7a46e1bffb17f3f6cdd190345010ab4346ed002adec8

Contents?: true

Size: 1.3 KB

Versions: 7

Compression:

Stored size: 1.3 KB

Contents

module Actions
  module Katello
    module CdnConfiguration
      class Update < Actions::EntryAction
        def plan(cdn_configuration, options)
          cdn_configuration.update!(options)

          if cdn_configuration.upstream_server?
            resource = ::Katello::Resources::CDN::CdnResource.create(cdn_configuration: cdn_configuration)
            resource.validate!
            keypair = resource.debug_certificate
            cdn_configuration.ssl_cert = OpenSSL::X509::Certificate.new(keypair)
            cdn_configuration.ssl_key = OpenSSL::PKey::RSA.new(keypair)

            cdn_configuration.save!
          end

          org = cdn_configuration.organization
          roots = ::Katello::RootRepository.redhat.in_organization(org)
          roots.each do |root|
            full_path = if cdn_configuration.redhat_cdn?
                          root.product.repo_url(root.library_instance.generate_content_path)
                        elsif cdn_configuration.upstream_server?
                          resource.repository_url(content_label: root.content.label)
                        end
            plan_action(::Actions::Katello::Repository::Update, root, url: full_path)
          end
        end

        def humanized_name
          _("Update CDN Configuration")
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
katello-4.4.2.2 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.4.2.1 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.4.2 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.4.1 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.4.0.2 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.4.0.1 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.4.0 app/lib/actions/katello/cdn_configuration/update.rb