Skip to content

Add a puppetdb_version fact with PuppetDB version #404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 3, 2024

Conversation

rwaffen
Copy link
Contributor

@rwaffen rwaffen commented May 3, 2024

The code changes add a new Facter fact called puppetdb_version that retrieves the version of PuppetDB installed on the system. It uses the puppetdb --version command to fetch the version and returns it as a fact value.

The code changes add a new Facter fact called `puppetdb_version` that retrieves the version of PuppetDB installed on the system. It uses the `puppetdb --version` command to fetch the version and returns it as a fact value.
@smortex smortex changed the title feat: Add Facter fact for PuppetDB version Add a puppetdb_version fact with PuppetDB version May 3, 2024
@smortex smortex merged commit 3afd693 into puppetlabs:main May 3, 2024
26 checks passed
@rwaffen rwaffen deleted the add_version_fact branch May 6, 2024 09:42
@Geod24
Copy link

Geod24 commented Jun 10, 2024

Release v8.1.0 is broken for some people because of this.
See issues #412 and #413 . @rwaffen I needed the following to work around the problem on Debian:

diff --git a/puppet/3rd-party-modules/puppetdb/lib/facter/puppetdb_version.rb b/puppet/3rd-party-modules/puppetdb/lib/facter/puppetdb_version.rb
index b04fb26ce..f75847652 100644
--- a/puppet/3rd-party-modules/puppetdb/lib/facter/puppetdb_version.rb
+++ b/puppet/3rd-party-modules/puppetdb/lib/facter/puppetdb_version.rb
@@ -2,7 +2,7 @@ Facter.add(:puppetdb_version) do
   confine { Facter::Util::Resolution.which('puppetdb') }

   setcode do
-    output = Facter::Core::Execution.execute('puppetdb --version')
-    output.split(':').last.strip
+    output = Facter::Core::Execution.execute('puppetdb version')
+    output.split('=').last.strip
   end
 end

@smortex
Copy link
Collaborator

smortex commented Jun 10, 2024

puppetdb version

On Debian (AIO packages) and FreeBSD (packages built from Puppetlabs tarballs), I get:

% puppetdb version
puppetdb: 'version' is not a puppetdb command. See 'puppetdb --help'.
% puppetdb --version
puppetdb version: 8.5.1

What did you install?

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.

5 participants