Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
pg_gem resource needs better test for omnibus #462
that block of code is wrong.
if the distro has a pg lib then the chef_gem will succeed and will link against the distro pg libs, which will link against the distro openssl. when the distro openssl tries to get loaded into the embedded ruby linked against the embedded openssl then everything explodes and it defeats the whole purpose of this recipe.
if the user is using omnibus then all the code in the rescue block must run -- the conditional needs to not be based on the chef_gem failing or not, but needs to be based on an
referenced this issue
Oct 30, 2017
So to fix this, I think we have a few options
IMHO 1, is out of the question. Doing this would increase the complexity of the overall install process, and supportability of the cookbook.
Option 2 seems more reasonable (and I've just got it working), but requires either the user or us to install a modern Ruby on the system (aka 2.0+) and then use that gem binary to install
I'm not quite following you.
The outer block needs to be more like:
If you're omnibus, you never want to just do a
Forcing pg gem to link against the omnibus libraries all the time is, from my time looking into this, basically impossible.
You configure the pg gem and related libraries to link against a ssl library, by setting libdir in the postgresql config libdir setting.
So from the bug report:
That is only coming from the pg_gem.
So it may still work to link the pg_gem against the omnibus ruby (and the omnibus openssl) while against the system pg libs. If there's no transitive dep (like the system pg libs depending on system openssl libs) then that will still work. And that's the only way this code in this cookbook would have ever worked.
At any rate the complicated side of the codeblock here has worked for at least some people and distros in the past, and all I intended was to fix up the use case so that it tried to be correct as it could possibly be.
Right now its just fairly broken since if you're on omnibus you must always do the complicated side of the codeblock in order to link against the omnibus openssl libs. Linking to the system libs only works in the cases where the openssl libs on the system and on omnibus are accidentally the same APIs.
So was there ever (like 3+ years ago?) a client.rb recipe which did a source install of the postgres libraries linking against the omnibus libs? Because that is the missing piece here, and it may have gotten removed in some cookbook simplification and general streamlining to no longer support source compiles and only install packages from repos?
This was referenced
Dec 28, 2017
In case others run into this issue and the related #480 issue (which has a locked conversation so I can't toss this message there where these notes are likely more appropriate) and want to be able to move forward while a proper fix is found:
A temporary work around:
That got me past the uninitialized constant PGconn error and right into a
None of this is very helpful in the broader sense and I look forward to a new version of this cookbook and the pg gem that don't have this issue.