Showing with 31 additions and 13 deletions.
  1. +12 −0 CHANGELOG.md
  2. +1 −1 lib/puppet/provider/foreman_host/rest_v3.rb
  3. +4 −0 lib/puppet/type/foreman_host.rb
  4. +10 −8 manifests/register.pp
  5. +1 −1 metadata.json
  6. +2 −2 spec/classes/foreman_cli_spec.rb
  7. +1 −1 templates/hammer_root.yml.epp
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [25.2.0](https://github.com/theforeman/puppet-foreman/tree/25.2.0) (2024-08-14)

[Full Changelog](https://github.com/theforeman/puppet-foreman/compare/25.1.0...25.2.0)

**Implemented enhancements:**

- Allow forcing fact upload when host already exists [\#1175](https://github.com/theforeman/puppet-foreman/pull/1175) ([evgeni](https://github.com/evgeni))

**Fixed bugs:**

- Fix a typo in hammer\_root.yml.epp [\#1173](https://github.com/theforeman/puppet-foreman/pull/1173) ([asteflova](https://github.com/asteflova))

## [25.1.0](https://github.com/theforeman/puppet-foreman/tree/25.1.0) (2024-08-12)

[Full Changelog](https://github.com/theforeman/puppet-foreman/compare/25.0.0...25.1.0)
Expand Down
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
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{

Check warning on line 1 in metadata.json

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Skipping EOL operating system CentOS 8
"name": "theforeman-foreman",
"version": "25.1.0",
"version": "25.2.0",
"author": "theforeman",
"summary": "Foreman server configuration",
"license": "GPL-3.0+",
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/foreman_cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
.with_content(
<<~CONFIG
:foreman:
# Credentials. You'll be asked for the interactively if you leave them blank here
# Credentials. You'll be asked for them interactively if you leave them blank here
:username: 'joe'
:password: 'secret'
CONFIG
Expand Down Expand Up @@ -161,7 +161,7 @@ class { 'foreman':
.with_content(
<<~CONFIG
:foreman:
# Credentials. You'll be asked for the interactively if you leave them blank here
# Credentials. You'll be asked for them interactively if you leave them blank here
:username: 'jane'
:password: 'supersecret'
CONFIG
Expand Down
2 changes: 1 addition & 1 deletion templates/hammer_root.yml.epp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
Optional[String] $password,
| -%>
:foreman:
# Credentials. You'll be asked for the interactively if you leave them blank here
# Credentials. You'll be asked for them interactively if you leave them blank here
:username: '<%= $username %>'
:password: '<%= $password %>'