Sha256: c247ad1e1498f6c3510d5a4fdf672a14b7fc890be070a941d88d8c80d2961576

Contents?: true

Size: 760 Bytes

Versions: 4

Compression:

Stored size: 760 Bytes

Contents

module ForemanPuppet
  module Extensions
    module ApiV2RegistrationControllerExtensions
      extend ActiveSupport::Concern

      def host_setup_extension
        if @host.hostgroup.present?
          @host.puppet_proxy_id = @host.hostgroup.puppet_proxy_id if @host.puppet_proxy_id.nil? && @host.hostgroup.puppet_proxy_id.present?
          @host.puppet_ca_proxy_id = @host.hostgroup.puppet_ca_proxy_id if @host.puppet_ca_proxy_id.nil? && @host.hostgroup.puppet_ca_proxy_id.present?

          if @host.puppet.nil? && @host.hostgroup.puppet&.environment.present?
            puppet = @host.puppet || @host.build_puppet
            puppet.environment = @host.hostgroup.puppet&.environment
          end
        end

        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_puppet-8.1.0 app/controllers/concerns/foreman_puppet/extensions/api_v2_registration_controller_extensions.rb
foreman_puppet-8.0.0 app/controllers/concerns/foreman_puppet/extensions/api_v2_registration_controller_extensions.rb
foreman_puppet-6.4.0 app/controllers/concerns/foreman_puppet/extensions/api_v2_registration_controller_extensions.rb
foreman_puppet-7.0.0 app/controllers/concerns/foreman_puppet/extensions/api_v2_registration_controller_extensions.rb