Skip to content

Conversation

bastelfreak
Copy link
Member

This adds a fact that discovers if the Perforce or OpenVox agent is installed. If none are installed yet, we default to the Perforce package for backwards compatibility.

@bastelfreak
Copy link
Member Author

bastelfreak commented Mar 11, 2025

This is a resubmission of #933. I pasically added pick() to handle situations where the fact is undef.

@bastelfreak bastelfreak force-pushed the add_openvox_support branch 3 times, most recently from 76dc42e to b43a016 Compare March 11, 2025 12:57
@charlesc-profusion
Copy link

This doesn't work on Openvox 7:
image

@binford2k
Copy link

ah yeah, we didn't backport that to 7.x. We probably should. Lemme chat with the team.

@Stricken1670
Copy link

Stricken1670 commented Mar 14, 2025

EDIT: found it!

So I just installed this module and it's active, and I applied the https://github.com/theforeman/puppet-puppet/pull/935.diff for this PR and now I can install openvox with:

  if $facts['networking']['hostname'] == 'labrat' {
    class {
      'puppet':
        runmode => 'cron',
        client_package => 'openvox-agent',
        agent_server_hostname => 'theforeman.example.com',
    }
  }

Although it doesn't set up the repo yet.

@markeganfuller
Copy link

I think it's also required that terminus_package is set to openvoxdb-termini on puppetdb::master::config in puppet::server::puppetdb.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make it reflect that OpenVox introduced an implementation fact?

@sbernhard
Copy link

@bastelfreak Any plans to continue this? (looks like there are conflicts as #936 was already merged)

@sbernhard
Copy link

@bastelfreak The failling tests are not related to this change. Am I right? What do we need to merge this then? How can we help?

@bastelfreak
Copy link
Member Author

bastelfreak commented Oct 2, 2025

@sbernhard

@bastelfreak bastelfreak force-pushed the add_openvox_support branch 3 times, most recently from 3d4624e to b458215 Compare October 2, 2025 21:39
This adds a fact that discovers if the Perforce or OpenVox agent is
installed. If none are installed yet, we default to the Perforce package
for backwards compatibility.
$server_package = "puppetserver${puppet_major}"
# Add support for OpenVox. Default to puppet if nothing is installed yet
$puppet_flavor = pick($facts['implementation'], 'puppet')
$puppetserver_flavor = regsubst("${puppet_flavor}server", 'openvox', 'openvox-')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ewww. (no, I am not sure I can come with something more elegant, but wanted to express my eww here ;) )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.

$puppetserver_flavor = bool2str($puppet_flavor == 'openvox', 'openvox-server', 'puppetserver')

Yes, this "breaks" any other flavor besides puppet and openvox, but… do we care?

}
```

If you replace the Perforce packages and switch to the OpenVox implementation by hand, the module will detect this and just keep working, no changes required.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true for the terminus_package, right? So why is it here? Did you want to say "This module works with both Puppet and Openvox (agent and server), but if you want DB you need to override the package name"?

Comment on lines +270 to 274
$server_package = if ($facts['os']['family'] =~ /(FreeBSD|DragonFly)/) {
"${puppetserver_flavor}${puppet_major}"
} else {
$server_package = undef
$puppetserver_flavor
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This becomes puppet::server_package:

Optional[Variant[String, Array[String]]] $server_package = $puppet::params::server_package,

And then puppet::server::package:
Optional[Variant[String, Array[String]]] $package = $puppet::server_package,

And is then used in
$server_package = pick($puppet::server::package, 'puppetserver')

and
$puppetserver_package = pick($puppet::server::package, 'puppetserver')

The later two use pick as they assume puppet::server::package is sometimes Undef, which it isn't anymore after this change.

I think that's totally fine, but should we then get rid of the pick? Just to make it more obvious there are no more fallbacks?

👀 @ekohl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants