I need to run a query on a postgresql database in a module I'm writing for Salt. It won't do much, just query a table for a value to determine what version of the software is installed.
The docs have a psql_query
function but you can't specify the database, so I'm guessing the query is run against the maintenance db.
To confound things, the postgresql module docs say I have to specify connection params in the minion config, which means having to manually create the postgresql user or duplicating configuration unless the minion config can read from pillar data (pretty sure it can't).
Now, the mysql module for salt does have the exact interface I need in the query
function.
The inability to query a psql db seems like such an egregious oversight that its probably me misunderstanding something. Ordinarily I would dive into the code and figure out what is going, but there is so much magic I don't know where to begin. Any help?
Found the code (Google wasn't revealing it) and it simply doesn't exist. I've raised this as a feature request here and am inspecting the code to see if I can contribute.
Salt is amazing but it still has lots of these little gaps.
UPDATE: after going through the code you can specify the database with the parameter
maintenance_db
, which is misleading because that has a specific meaning. An example usage might be: