From 19daf66f0a13fced5a3e791d39dcea48d0460002 Mon Sep 17 00:00:00 2001 From: Joseph Hall Date: Fri, 13 Jun 2014 09:12:54 -0600 Subject: [PATCH] Rename db to sdb, to avoid name conflicts --- salt/loader.py | 6 +++--- salt/modules/config.py | 28 ++++++++++++++-------------- salt/{db => sdb}/__init__.py | 0 salt/{db => sdb}/keyring_db.py | 0 4 files changed, 17 insertions(+), 17 deletions(-) rename salt/{db => sdb}/__init__.py (100%) rename salt/{db => sdb}/keyring_db.py (100%) diff --git a/salt/loader.py b/salt/loader.py index 4177a78c0d..3d89005031 100644 --- a/salt/loader.py +++ b/salt/loader.py @@ -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, diff --git a/salt/modules/config.py b/salt/modules/config.py index 76b9ffd553..d23e882a0a 100644 --- a/salt/modules/config.py +++ b/salt/modules/config.py @@ -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:///. 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:///. 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:///. 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:///. 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 diff --git a/salt/db/__init__.py b/salt/sdb/__init__.py similarity index 100% rename from salt/db/__init__.py rename to salt/sdb/__init__.py diff --git a/salt/db/keyring_db.py b/salt/sdb/keyring_db.py similarity index 100% rename from salt/db/keyring_db.py rename to salt/sdb/keyring_db.py