Module: ForemanPuppet::Extensions::ApiV2RegistrationControllerExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/foreman_puppet/extensions/api_v2_registration_controller_extensions.rb

Instance Method Summary collapse

Instance Method Details

#host_setup_extensionObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/concerns/foreman_puppet/extensions/api_v2_registration_controller_extensions.rb', line 6

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