mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #38023 from gtmanfred/2016.11
Expand error message for postgres states
This commit is contained in:
commit
141b5c5656
11 changed files with 33 additions and 26 deletions
|
@ -25,10 +25,7 @@ Module to provide Postgres compatibility to salt.
|
|||
automatically placed on the path. Add a configuration to the location
|
||||
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.
|
||||
postgres.bins_dir: '/usr/pgsql-9.5/bin/'
|
||||
'''
|
||||
|
||||
# This pylint error is popping up where there are no colons?
|
||||
|
@ -116,7 +113,7 @@ def __virtual__():
|
|||
Only load this module if the psql bin exist.
|
||||
initdb bin might also be used, but its presence will be detected on runtime.
|
||||
'''
|
||||
utils = ['psql']
|
||||
utils = ['psql', 'initdb']
|
||||
if not HAS_CSV:
|
||||
return False
|
||||
for util in utils:
|
||||
|
@ -132,17 +129,7 @@ def _find_pg_binary(util):
|
|||
|
||||
Helper function to locate various psql related binaries
|
||||
'''
|
||||
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:
|
||||
salt.utils.warn_until(
|
||||
'Oxygen',
|
||||
'Using \'postgres.bins_dir\' is not officially supported and '
|
||||
'only exists as a workaround. Please replace this in your '
|
||||
'configuration with \'postgres.pg_bin\'.')
|
||||
|
||||
pg_bin_dir = __salt__['config.option']('postgres.bins_dir')
|
||||
util_bin = salt.utils.which(util)
|
||||
if not util_bin:
|
||||
if pg_bin_dir:
|
||||
|
|
|
@ -20,7 +20,9 @@ def __virtual__():
|
|||
'''
|
||||
Only load if the deb_postgres module is present
|
||||
'''
|
||||
return 'postgres.cluster_exists' in __salt__
|
||||
if 'postgres.cluster_exists' not in __salt__:
|
||||
return (False, 'Unable to load postgres module. Make sure `postgres.bins_dir` is set.')
|
||||
return True
|
||||
|
||||
|
||||
def present(version,
|
||||
|
|
|
@ -18,7 +18,9 @@ def __virtual__():
|
|||
'''
|
||||
Only load if the postgres module is present
|
||||
'''
|
||||
return 'postgres.user_exists' in __salt__
|
||||
if 'postgres.user_exists' not in __salt__:
|
||||
return (False, 'Unable to load postgres module. Make sure `postgres.bins_dir` is set.')
|
||||
return True
|
||||
|
||||
|
||||
def present(name,
|
||||
|
|
|
@ -28,7 +28,9 @@ def __virtual__():
|
|||
'''
|
||||
Only load if the postgres module is present
|
||||
'''
|
||||
return 'postgres.create_extension' in __salt__
|
||||
if 'postgres.create_extension' not in __salt__:
|
||||
return (False, 'Unable to load postgres module. Make sure `postgres.bins_dir` is set.')
|
||||
return True
|
||||
|
||||
|
||||
def present(name,
|
||||
|
|
|
@ -28,7 +28,9 @@ def __virtual__():
|
|||
'''
|
||||
Only load if the postgres module is present
|
||||
'''
|
||||
return 'postgres.group_create' in __salt__
|
||||
if 'postgres.group_create' not in __salt__:
|
||||
return (False, 'Unable to load postgres module. Make sure `postgres.bins_dir` is set.')
|
||||
return True
|
||||
|
||||
|
||||
def present(name,
|
||||
|
|
|
@ -28,7 +28,9 @@ def __virtual__():
|
|||
'''
|
||||
Only load if the postgres module is present
|
||||
'''
|
||||
return 'postgres.datadir_init' in __salt__
|
||||
if 'postgres.datadir_init' not in __salt__:
|
||||
return (False, 'Unable to load postgres module. Make sure `postgres.bins_dir` is set.')
|
||||
return True
|
||||
|
||||
|
||||
def present(name,
|
||||
|
|
|
@ -28,7 +28,9 @@ def __virtual__():
|
|||
'''
|
||||
Only load if the postgres module is present
|
||||
'''
|
||||
return 'postgres.language_create' in __salt__
|
||||
if 'postgres.language_create' not in __salt__:
|
||||
return (False, 'Unable to load postgres module. Make sure `postgres.bins_dir` is set.')
|
||||
return True
|
||||
|
||||
|
||||
def present(name,
|
||||
|
|
|
@ -71,7 +71,9 @@ def __virtual__():
|
|||
'''
|
||||
Only load if the postgres module is present
|
||||
'''
|
||||
return 'postgres.privileges_grant' in __salt__
|
||||
if 'postgres.privileges_grant' not in __salt__:
|
||||
return (False, 'Unable to load postgres module. Make sure `postgres.bins_dir` is set.')
|
||||
return True
|
||||
|
||||
|
||||
def present(name,
|
||||
|
|
|
@ -23,7 +23,9 @@ def __virtual__():
|
|||
'''
|
||||
Only load if the postgres module is present
|
||||
'''
|
||||
return 'postgres.schema_exists' in __salt__
|
||||
if 'postgres.schema_exists' not in __salt__:
|
||||
return (False, 'Unable to load postgres module. Make sure `postgres.bins_dir` is set.')
|
||||
return True
|
||||
|
||||
|
||||
def present(dbname, name,
|
||||
|
|
|
@ -30,7 +30,9 @@ def __virtual__():
|
|||
'''
|
||||
Only load if the postgres module is present and is new enough (has ts funcs)
|
||||
'''
|
||||
return 'postgres.tablespace_exists' in __salt__
|
||||
if 'postgres.tablespace_exists' not in __salt__:
|
||||
return (False, 'Unable to load postgres module. Make sure `postgres.bins_dir` is set.')
|
||||
return True
|
||||
|
||||
|
||||
def present(name,
|
||||
|
|
|
@ -28,7 +28,9 @@ def __virtual__():
|
|||
'''
|
||||
Only load if the postgres module is present
|
||||
'''
|
||||
return 'postgres.user_exists' in __salt__
|
||||
if 'postgres.user_exists' not in __salt__:
|
||||
return (False, 'Unable to load postgres module. Make sure `postgres.bins_dir` is set.')
|
||||
return True
|
||||
|
||||
|
||||
def present(name,
|
||||
|
|
Loading…
Add table
Reference in a new issue