mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Rename db to sdb, to avoid name conflicts
This commit is contained in:
parent
5a963c7184
commit
19daf66f0a
@ -408,11 +408,11 @@ def queues(opts):
|
||||
return load.gen_functions()
|
||||
|
||||
|
||||
def db(opts, functions=None, whitelist=None):
|
||||
def sdb(opts, functions=None, whitelist=None):
|
||||
'''
|
||||
Call out to a database
|
||||
Make a very small database call
|
||||
'''
|
||||
load = _create_loader(opts, 'db', 'db')
|
||||
load = _create_loader(opts, 'sdb', 'sdb')
|
||||
pack = {'name': '__saltdb__',
|
||||
'value': functions}
|
||||
return LazyLoader(load,
|
||||
|
@ -226,32 +226,32 @@ def get(key, default=''):
|
||||
'''
|
||||
ret = salt.utils.traverse_dict_and_list(__opts__, key, '_|-')
|
||||
if ret != '_|-':
|
||||
return db_get(ret, __opts__)
|
||||
return sdb_get(ret, __opts__)
|
||||
|
||||
ret = salt.utils.traverse_dict_and_list(__grains__, key, '_|-')
|
||||
if ret != '_|-':
|
||||
return db_get(ret, __opts__)
|
||||
return sdb_get(ret, __opts__)
|
||||
|
||||
ret = salt.utils.traverse_dict_and_list(__pillar__, key, '_|-')
|
||||
if ret != '_|-':
|
||||
return db_get(ret, __opts__)
|
||||
return sdb_get(ret, __opts__)
|
||||
|
||||
ret = salt.utils.traverse_dict_and_list(__pillar__.get('master', {}), key, '_|-')
|
||||
if ret != '_|-':
|
||||
return db_get(ret, __opts__)
|
||||
return sdb_get(ret, __opts__)
|
||||
|
||||
return default
|
||||
|
||||
|
||||
def db_get(uri):
|
||||
def sdb_get(uri):
|
||||
'''
|
||||
Get a value from a db, using a uri in the form of db://<profile>/<key>. If
|
||||
the uri provided does not start with db://, then it will be returned as-is.
|
||||
Get a value from a db, using a uri in the form of sdb://<profile>/<key>. If
|
||||
the uri provided does not start with sdb://, then it will be returned as-is.
|
||||
'''
|
||||
if not uri.startswith('db://'):
|
||||
if not uri.startswith('sdb://'):
|
||||
return uri
|
||||
|
||||
comps = uri.replace('db://', '').split('/')
|
||||
comps = uri.replace('sdb://', '').split('/')
|
||||
|
||||
if len(comps) < 2:
|
||||
return uri
|
||||
@ -268,15 +268,15 @@ def db_get(uri):
|
||||
return loaded_db[fun](query, profile=profile)
|
||||
|
||||
|
||||
def db_set(uri, value):
|
||||
def sdb_set(uri, value):
|
||||
'''
|
||||
Get a value from a db, using a uri in the form of db://<profile>/<key>. If
|
||||
the uri provided does not start with db://, then it will be returned as-is.
|
||||
Get a value from a db, using a uri in the form of sdb://<profile>/<key>. If
|
||||
the uri provided does not start with sdb://, then it will be returned as-is.
|
||||
'''
|
||||
if not uri.startswith('db://'):
|
||||
if not uri.startswith('sdb://'):
|
||||
return False
|
||||
|
||||
comps = uri.replace('db://', '').split('/')
|
||||
comps = uri.replace('sdb://', '').split('/')
|
||||
|
||||
if len(comps) < 2:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user