Skip to content

force libdir to be part of our execution environment#383

Merged
evgeni merged 1 commit into
masterfrom
no-pluginsync-bad
Jun 3, 2025
Merged

force libdir to be part of our execution environment#383
evgeni merged 1 commit into
masterfrom
no-pluginsync-bad

Conversation

@evgeni

@evgeni evgeni commented Jun 3, 2025

Copy link
Copy Markdown
Member

When the kafo is executed on a system that itself is a client to a Puppet
server, plugins that got synced (using pluginsync) from said server into
/opt/puppetlabs/puppet/cache/lib/ are picked up instead of the ones in
the configured modules dir under certain circumstances.

For example, puppetlabs-postgresql changed the postgresql_conf provider
from "parsed" to "ruby" in 10.0. If the parsed provider is present in
/opt/puppetlabs/puppet/cache/lib/ it gets used, instead of the new ruby
one, but the calling code (being from puppetlabs-postgresql 10+) doesn't
expect that and fails to properly (yet silently!) configure PostgreSQL.

Comment thread lib/kafo/kafo_configure.rb Outdated
@evgeni

evgeni commented Jun 3, 2025

Copy link
Copy Markdown
Member Author

For those who want to reproduce this at home, but do not want to hook up to an external Puppet server:

  1. poison the cache:
# mkdir -p /opt/puppetlabs/puppet/cache/lib/puppet/provider/postgresql_conf/
# curl -o /opt/puppetlabs/puppet/cache/lib/puppet/provider/postgresql_conf/parsed.rb https://raw.githubusercontent.com/puppetlabs/puppetlabs-postgresql/refs/tags/v9.2.0/lib/puppet/provider/postgresql_conf/parsed.rb
  1. set max_connections to something silly (like "5") in /var/lib/pgsql/data/postgresql.conf
  2. run the installer
  3. verify that the value is unchanged
# grep max_con /var/lib/pgsql/data/postgresql.conf 
max_connections = 5

and the "parsed" provider was used

# grep "Prefetching parsed" /var/log/foreman-installer/*.log 
2025-06-03 11:44:02 [DEBUG ] [configure] Prefetching parsed resources for postgresql_conf
  1. apply patch
  2. run the installer again
  3. verify the value is changed
# grep max_con /var/lib/pgsql/data/postgresql.conf 
max_connections = 500

the "parsed" provider was not used

# grep "Prefetching parsed" /var/log/foreman-installer/*.log 
<empty>

the output of the new, ruby, provider is visible

# grep "parse_config Active Settings" /var/log/foreman-installer/*.log
2025-06-03 11:46:42 [DEBUG ] [configure] DEBUG: parse_config Active Settings found in PostgreSQL config file: …

 

@evgeni
evgeni force-pushed the no-pluginsync-bad branch from cb0cbee to 1fbeb78 Compare June 3, 2025 13:55
Comment thread lib/kafo/execution_environment.rb
When the kafo is executed on a system that itself is a client to a Puppet
server, plugins that got synced (using pluginsync) from said server into
/opt/puppetlabs/puppet/cache/lib/ are picked up instead of the ones in
the configured modules dir under certain circumstances.

For example, puppetlabs-postgresql changed the postgresql_conf provider
from "parsed" to "ruby" in 10.0. If the parsed provider is present in
/opt/puppetlabs/puppet/cache/lib/ it gets used, instead of the new ruby
one, but the calling code (being from puppetlabs-postgresql 10+) doesn't
expect that and fails to properly (yet silently!) configure PostgreSQL.
@evgeni
evgeni force-pushed the no-pluginsync-bad branch from 1fbeb78 to e3101e2 Compare June 3, 2025 14:05
@evgeni
evgeni merged commit 7763a2e into master Jun 3, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants