Skip to content

fix: make puppetdb_query function available in built images#160

Open
bootc wants to merge 1 commit into
OpenVoxProject:mainfrom
bootc:fix/159-puppetdb-query-function
Open

fix: make puppetdb_query function available in built images#160
bootc wants to merge 1 commit into
OpenVoxProject:mainfrom
bootc:fix/159-puppetdb-query-function

Conversation

@bootc

@bootc bootc commented Jun 26, 2026

Copy link
Copy Markdown
Member

Short description

Fixes #159: puppetdb_query fails with Unknown function: 'puppetdb_query' during catalog compilation in built images, even though the PuppetDB termini are installed.

The termini are installed in vendor_ruby (on ruby-load-path), which covers the require-loaded indirector terminus and report processor — so storeconfigs and reports work. But Puppet 4 functions load via the Pops system loader, which is rooted at puppet's own lib dir, not ruby-load-path. Since #141 the images gem-install openvox instead of installing the OS packages (whose openvoxdb-termini deb colocated the termini with the vendored puppet in vendor_ruby), so that root is now the gem's lib dir and the termini's puppet/functions/ is off the search path.

This colocates the termini puppet/ tree with the openvox gem lib, restoring the layout the OS packages relied on. The filenames don't collide with openvox's own.

See #159 for the full analysis and an alternative (shipping the termini as a module on basemodulepath).

AI use: this patch was developed with the assistance of Claude (Claude Code).

Checklist

I have:

  • read the CONTRIBUTING.md document
  • read and accepted the Developer Certificate of Origin document and added a Signed-off-by annotation to each of my commits
  • read and accepted the AI Policy document and added an attribution trailer to each AI-assisted commit
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

🤖 Generated with Claude Code

Colocate the puppetdb termini with the openvox gem lib so Puppet's Pops
system loader finds puppetdb_query during compilation. Since OpenVoxProject#141 the
images gem-install openvox instead of using the OS packages, so the
termini in vendor_ruby are no longer on the loader's root. Fixes OpenVoxProject#159.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Chris Boot <bootc@boo.tc>
@bootc bootc requested a review from a team as a code owner June 26, 2026 16:15

@cvquesty cvquesty left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM.

# rather than ruby-load-path. Since #141 gem-installs openvox instead of using
# the OS packages (whose openvoxdb-termini colocated everything in vendor_ruby),
# that root is the gem lib, so puppetdb_query would otherwise be unknown.
cp -r /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know if this is a goood idea or if we should adjust the load path. Every openvox-server I know has this in /etc/puppetlabs/puppetserver/conf.d/puppetserver.conf:

gem-path: [${jruby-puppet.gem-home}, "/opt/puppetlabs/server/data/puppetserver/vendored-jruby-gems", "/opt/puppetlabs/puppet/lib/ruby/vendor_gems"]

https://github.com/theforeman/puppet-puppet/blob/master/manifests/server/puppetserver.pp#L211

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ahhh it's /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet vs /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This one does too!

gem-path: [${jruby-puppet.gem-home}, "/opt/puppetlabs/server/data/puppetserver/vendored-jruby-gems", "/opt/puppetlabs/puppet/lib/ruby/vendor_gems"]

However as my AI worked out, Ruby functions aren't loaded from the gem path so it doesn't find them.

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Bug]: puppetdb_query function fails with "Unknown function" in built images

3 participants