Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

QUESTION: Using the puppet_metrics_dashboard::profile::master::postgres_access class #72

Open
albatrossflavour opened this issue Jul 24, 2019 · 9 comments

Comments

@albatrossflavour
Copy link

albatrossflavour commented Jul 24, 2019

Apologies for raising and "issue" on this, but I've been battling with this all day and can't get my head around what is happening.

if I declare puppet_metrics_dashboard::profile::master::postgres_access via the ENC (PE console), everything works as expected. If I declare it using include puppet_metrics_dashboard::profile::master::postgres_access via a profile, I get :

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, 'versioncmp' parameter 'a' expects a String value, got Undef (file: /opt/puppetlabs/puppet/modules/pe_postgresql/manifests/server/role.pp, line: 66, column: 6) (file: /etc/puppetlabs/code/environments/production/modules/puppet_metrics_dashboard/manifests/profile/master/postgres_access.pp, line: 42) on node master.xxxx

I can't figure out why declaring via the ENC would mean this works. I've gone through the code and it seems to be borking on $version being undef, but why that would happen using a profile rather than the ENC is what is frustrating me.

The issue was the same on on 2.2.1 as on 1.1.5 (discounting the change in class name).

I'm sure I'm missing something obvious. I'm going to keep looking but thought someone might have an idea as to what's going on.

@suckatrash
Copy link
Contributor

Hi @albatrossflavour,

Thanks for reporting this! I've actually seen this before, and wrote it off as something environmental. I can point you to the workaround that was used in that case (this doesn't run idempotently though). I don't know enough about the magic of the ENC to know why this happens, but it's clear that the resources are ordered differently when using the ENC.

The error comes from the pe_postgresql::server::role defined type. What's happening is that outside of the ENC, that type is called before the default parameters in the main pe_postgresql class are realized, and the type doesn't offer a way to pass them in. A fix for this would either involve an upstream fix in that module, or it might be possible to enforce the correct ordering by requiring the main pe_postgresql class somewhere.

In any case, this is a real issue and I'd love to see it fixed.

@npwalker
Copy link
Contributor

Why does this module rely on pe_postgresql instead of just regular postgresql?

@suckatrash
Copy link
Contributor

pe_postgresql is already managing resources via the puppet_enterprise classes. Won't also using regular postgresql cause conflicts with those resources?

@npwalker
Copy link
Contributor

You should be able to use regular postgres you'll just have to set parameters on the defined types to match what is done in PE.

@albatrossflavour
Copy link
Author

albatrossflavour commented Jul 25, 2019 via email

@albatrossflavour
Copy link
Author

Just talking to @boltKrank about this, we think it might be a 2019.1.0 issue. Just testing it now, but worth considering.

@vchepkov
Copy link
Contributor

I just tried to install module on 2019.7 and I think I stumbled on related problem:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Unknown variable: 'pe_postgresql::server::default_database'. (file: /opt/puppetlabs/puppet/modules/pe_postgresql/manifests/server/role.pp, line: 6, column: 23) (file: /etc/puppetlabs/code/environments/dashboard/modules/puppet_metrics_dashboard/manifests/profile/master/postgres_access.pp, line: 47) on node puppet.chepkov.lan

@jarretlavallee
Copy link
Contributor

The fix for this will be to convert the profile to use https://forge.puppet.com/puppetlabs/postgresql.

@sandrajiang
Copy link

sandrajiang commented Sep 2, 2021

I tried to use https://forge.puppet.com/modules/puppetlabs/postgresql for the workaround, after added class postgresql::server for Primary server, the following error thrown out.

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Exec[postgresql_reload] is already declared at (file: /etc/puppetlabs/code/environments/production/modules/postgresql/manifests/server/reload.pp, line: 7); cannot redeclare (file: /opt/puppetlabs/puppet/modules/pe_postgresql/manifests/server/reload.pp, line: 8) (file: /opt/puppetlabs/puppet/modules/pe_postgresql/manifests/server/reload.pp, line: 8, column: 5) on node mom.platform9.puppet.net
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run.

So we need to go back to the original issue and fix it from there.

Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants