Skip to content

Commit

Permalink
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 86de3a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
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?
!id.nil? && !resource[:force]
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) do
desc 'Force fact upload when host already exists'
end
end
2 changes: 2 additions & 0 deletions manifests/register.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# @api private
class foreman::register (
Stdlib::Fqdn $foreman_host_name = $facts['networking']['fqdn'],
Boolean $force = false,
) {
foreman_host { "foreman-${$foreman_host_name}":
ensure => present,
Expand All @@ -12,6 +13,7 @@
effective_user => $foreman::oauth_effective_user,
ssl_ca => $foreman::server_ssl_chain,
facts => $facts,
force => $force,
}

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

0 comments on commit 86de3a6

Please sign in to comment.