activerecord-jdbc-adapter icon indicating copy to clipboard operation
activerecord-jdbc-adapter copied to clipboard

require 'activerecord-jdbc-adapter' seemes like crash Puppet7 server

Open bimax opened this issue 2 years ago • 0 comments

My setup: Puppet Server 7.9.2 on JRuby (as a standard). Puppet Agent 7.20.0 sqlite3 database as a source of infrastructure for configuration data

Custom function brakes puppet server (in a way I'll describe below):

require 'activerecord-jdbc-adapter'

#Documentation
Puppet::Functions.create_function(:brakepuppet) do
  dispatch :brakepuppet do
    required_param 'String', :print_text
  end

  def brakepuppet(print_text)
    return $print_text
  end
end

if I comment require 'activerecord-jdbc-adapter' - everything works at it should be.

Puppet manifest looks like:

info("This is DEBUG")

file {
    default:
      ensure => 'file',
      owner  => 'root',
      group  => 'root',
      mode   => '0644';
    '/tmp/test.test':
       content => brakepuppet("Print this text please");

Puppet Server problem. We have puppet server running on jruby and puppetagent running as ruby client application. Step 1:

  • I manually run agent to sync first time. > puppet agent --test.
  • Agent requests the catalog first time
  • It executes brakepuppet function but
  • compile catalog and
  • returns it from the server to the agent Step 2:
  • Manually run puppet agent second time
  • puppet server "asks" (no errors in the debug log) agent to clean up local cache lib directories
  • which then brakes catalog application (in case of more complex catalog then you see above). My assumption:
  • puppetserver see changes some lib folder (cache creation)
  • puppetserver do not see library directories on the agent as there is pure ruby app
  • some difference between master and agent because of agent does not have/need this gem as we run ruby app (not jruby). and (reality)
  • activerecord-jdbc-adapter redefines some ruby env to change puppet behavior

This project is part of migration from Puppet5 to Puppet7 and Puppet5 did not use JRuby so we were good with using active-record in this custom function, but now looks like it's our only option.

bimax avatar Aug 10 '23 15:08 bimax