Sha256: 3b27bffdeb5fa24e02237872be1a852104180c725385488598e095ff0814c41e

Contents?: true

Size: 904 Bytes

Versions: 9

Compression:

Stored size: 904 Bytes

Contents

module Katello
  module Concerns
    module Api::V2::RegistrationControllerExtensions
      extend ActiveSupport::Concern

      def prepare_host
        if params['uuid']
          @host = Katello::Host::SubscriptionFacet.find_by(uuid: params['uuid'])&.host
          if @host.nil?
            msg = N_("Host was not found by the subscription UUID: '%s', this can happen if the host is registered already, but not to this Foreman") % params['uuid']
            fail ActiveRecord::RecordNotFound, msg
          end
          @host.assign_attributes(host_params('host'))
          @host.save!
        else
          super
        end
      end

      def host_setup_extension
        if params['host']['lifecycle_environment_id']
          @host.update!(lifecycle_environment: KTEnvironment.readable.find(params['host']['lifecycle_environment_id']))
        end

        super
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-4.1.2.1 app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb
katello-4.1.2 app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb
katello-4.1.1 app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb
katello-4.1.0 app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb
katello-4.1.0.rc2.2 app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb
katello-4.1.0.rc2.1 app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb
katello-4.1.0.rc2 app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb
katello-4.1.0.rc1.1 app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb
katello-4.1.0.rc1 app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb