generated from theforeman/foreman_plugin_template
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #36207 - Setup puppet during Host Registration
- Loading branch information
1 parent
b706bfd
commit 23b7d8a
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
...ntrollers/concerns/foreman_puppet/extensions/api_v2_registration_controller_extensions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters