Updated the bins_dir to default to pg_bin #37935

The config looking for initdb wasn't consistent with documentation so this updates that. It might be best to add a default but I need to look into the code a bit more first.
This commit is contained in:
Scott Walton 2016-11-29 14:00:12 +00:00
parent e539a94a56
commit a96789353f

View file

@ -26,6 +26,9 @@ Module to provide Postgres compatibility to salt.
of the postgres bin's path to the relevant minion for this module::
postgres.pg_bin: '/usr/pgsql-9.5/bin/'
:note: Older versions of Salt had a bug where postgres.bins_dir was used
instead of postgres.pg_bin. You should upgrade this as soon as possible.
'''
# This pylint error is popping up where there are no colons?
@ -112,7 +115,7 @@ def __virtual__():
'''
Only load this module if the psql and initdb bin exist
'''
utils = ['psql', 'initdb']
utils = ['psql']
if not HAS_CSV:
return False
for util in utils:
@ -128,7 +131,15 @@ def _find_pg_binary(util):
Helper function to locate various psql related binaries
'''
pg_bin_dir = __salt__['config.option']('postgres.bins_dir')
pg_bin_dir = __salt__['config.option']('postgres.pg_bin')
if not pg_bin_dir: # Fallback to incorrectly-documented setting
pg_bin_dir = __salt__['config.option']('postgres.bins_dir')
if pg_bin_dir:
log.warning(
'Using postgres.bins_dir is not supported. '
'Replace this with postgres.pg_bin')
util_bin = salt.utils.which(util)
if not util_bin:
if pg_bin_dir: