Amend pg_path logic in postgres recipe for clarity
The following discussion from !5458 (merged) should be addressed:
-
@rmarshall started a discussion: (+3 comments) This override led to some discoveries:
This is a strange logical comparison, looks like
String && String
over at https://gitlab.com/gitlab-org/omnibus-gitlab/-/blob/251447a4b143970f3a60a4c6b2d6da356453ed5c/files/gitlab-cookbooks/postgresql/recipes/bin.rb#L27.Maybe I'm misreading it, but noting it down so I don't forget to look at it again with fresh eyes.
Because
db_path
was failing, I had to make this override to satisfy the check over in https://gitlab.com/gitlab-org/omnibus-gitlab/-/blob/251447a4b143970f3a60a4c6b2d6da356453ed5c/files/gitlab-cookbooks/postgresql/recipes/bin.rb#L51Not sure if this is good, bad, or otherwise - just noting it down so it's not lost or forgotten by Monday.
from @twk3
For the logic comparison, it's basically making sure that
db_path
isnil
ifdb_version
isnil
(which is the case there if you on a node without a database, and without an explicit version.It likely should have been written
db_path = Dir.glob("#{postgresql_install_dir}/#{db_version}*").min if db_version
to be more clear.