Skip to content

Add a puppetdb_version fact with PuppetDB version#404

Merged
smortex merged 3 commits into
puppetlabs:mainfrom
rwaffen:add_version_fact
May 3, 2024
Merged

Add a puppetdb_version fact with PuppetDB version#404
smortex merged 3 commits into
puppetlabs:mainfrom
rwaffen:add_version_fact

Conversation

@rwaffen

@rwaffen rwaffen commented May 3, 2024

Copy link
Copy Markdown
Contributor

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.
Comment thread lib/facter/puppetdb_version.rb Outdated
@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
@rwaffen rwaffen deleted the add_version_fact branch May 6, 2024 09:42
@Geod24

Geod24 commented Jun 10, 2024

Copy link
Copy Markdown

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

smortex commented Jun 10, 2024

Copy link
Copy Markdown
Collaborator
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