Open pkaeding opened 6 years ago
Oh, I just noticed that https://github.com/sensu-plugins/sensu-plugins-postgres#pgpass-file does document this issue, so I guess it is my fault for missing that initially. I suspect that this module is not really supporting the pgpass format in general, though, as wildcards in fields other than the database (eg the host or port) would be misinterpreted?
I'm also curious why this module needs to parse the pgpass
file itself-- won't the pg
gem use that file if it finds it? https://stackoverflow.com/a/18282613/4257 says it will, but I have not verified that.
@pkaeding honestly I am not too sure as I dont really use much postgres I can try to take a closer look, @phumpal do you have any insight before I try diving in? You touched this recently in #104 so figure you might have more context.
@majormoses I don't see any mention of libpq
in either the original issue (#9) or the PR (#36) which added pgpass
support.
I'm also curious why this module needs to parse the pgpass file itself.
As am I however I suspect this is a shortcoming of the pg gem and not libpq or sensu-plugins-postgres
intentionally.
I suspect I should review the C library.
this module is not really supporting the pgpass format
The module supports a single line pgpass
file w/multiple leading comments.
wildcards in fields other than the database (eg the host or port) would be misinterpreted?
According to https://www.postgresql.org/docs/11/libpq-pgpass.html all fields except password
can be wildcards.
Coming full circle I'm not 100% certain what the issue is.
Pgpass
module and rely on libpq somehow?I'm happy to take this on but I'm not sure how to scope the work.
If I have a .pgpass file with multiple lines, it seems only the first line is used.
I think this is due to the
[0]
in https://github.com/sensu-plugins/sensu-plugins-postgres/blob/1653c8b88f4fe3f7c3844352bc0ef27814403ee0/lib/sensu-plugins-postgres/pgpass.rb#L4 (but I may be wrong there).Given the postgres docs on the pgpass file format, I expected this to work the same way.