Sha256: 97e54c2db494638f174683754efc2fc5426342ca6408f439a4dfe1788f8c97ed

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

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

          if cdn_configuration.redhat?
            cdn_configuration.ssl_cert = nil
            cdn_configuration.ssl_key = nil
          else
            resource = ::Katello::Resources::CDN::CdnResource.create(cdn_configuration: cdn_configuration)
            keypair = resource.debug_certificate
            cdn_configuration.ssl_cert = OpenSSL::X509::Certificate.new(keypair)
            cdn_configuration.ssl_key = OpenSSL::PKey::RSA.new(keypair)
          end

          cdn_configuration.save!

          org = cdn_configuration.organization
          roots = ::Katello::RootRepository.redhat.in_organization(org)
          roots.each do |root|
            full_path = if cdn_configuration.redhat?
                          root.product.repo_url(root.library_instance.generate_content_path)
                        else
                          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.3.1 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.3.0 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.3.0.rc4 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.3.0.rc3 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.3.0.rc2.1 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.3.0.rc2 app/lib/actions/katello/cdn_configuration/update.rb
katello-4.3.0.rc1 app/lib/actions/katello/cdn_configuration/update.rb