Skip to content

Commit

Permalink
Refs #37726 - Allow forcing fact upload when host already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Aug 13, 2024
1 parent 0bd28c1 commit 9c73834
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/foreman_host/rest_v3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
confine :feature => [:json, :oauth]

def exists?
!id.nil?
!resource[:force_fact_upload] && !id.nil?
end

def create
Expand Down
4 changes: 4 additions & 0 deletions lib/puppet/type/foreman_host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@

defaultto { $facts }
end

newparam(:force_fact_upload) do
desc 'Force fact upload when host already exists'
end
end
18 changes: 10 additions & 8 deletions manifests/register.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
# @api private
class foreman::register (
Stdlib::Fqdn $foreman_host_name = $facts['networking']['fqdn'],
Boolean $force_fact_upload = false,
) {
foreman_host { "foreman-${$foreman_host_name}":
ensure => present,
hostname => $foreman_host_name,
base_url => $foreman::foreman_url,
consumer_key => $foreman::oauth_consumer_key,
consumer_secret => $foreman::oauth_consumer_secret,
effective_user => $foreman::oauth_effective_user,
ssl_ca => $foreman::server_ssl_chain,
facts => $facts,
ensure => present,
hostname => $foreman_host_name,
base_url => $foreman::foreman_url,
consumer_key => $foreman::oauth_consumer_key,
consumer_secret => $foreman::oauth_consumer_secret,
effective_user => $foreman::oauth_effective_user,
ssl_ca => $foreman::server_ssl_chain,
facts => $facts,
force_fact_upload => $force_fact_upload,
}

foreman_instance_host { "foreman-${$foreman_host_name}":
Expand Down

0 comments on commit 9c73834

Please sign in to comment.