summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Portante <peter.portante@redhat.com>2012-10-29 19:49:42 -0400
committerPeter Portante <peter.portante@redhat.com>2013-04-29 16:35:56 -0400
commit446a55d280b2bc1409ab54dc4644e9b082ca01dc (patch)
tree2ab1f130349b4215677638074e264219ab0024ac
parenta1ab2432344b633ae821ecb7f68418e7d254b260 (diff)
object-storage: fix bad refs to check_acct_exists
Fix bad references to check_account_exists: this is a module local method, not provided by Glusterfs. Not sure how we missed this. More unit tests would help. Also added the ability to run the Swift tree unit tests with gluster artificially enabled to test as many code paths as possible ahead of full functional tests. Change-Id: Iaf696d34db8f841c887f03569e65321fca8894d1 Signed-off-by: Peter Portante <peter.portante@redhat.com> Reviewed-on: http://review.gluster.org/4171 Reviewed-by: Pete Zaitcev <zaitcev@redhat.com> Reviewed-by: Mohammed Junaid <junaid@redhat.com> Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
-rw-r--r--swift/1.4.8/plugins/utils.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/swift/1.4.8/plugins/utils.py b/swift/1.4.8/plugins/utils.py
index bc16ff6..838c1bd 100644
--- a/swift/1.4.8/plugins/utils.py
+++ b/swift/1.4.8/plugins/utils.py
@@ -163,7 +163,7 @@ def _check_valid_account(account):
if os.path.ismount(full_mount_path):
return True
- if not Glusterfs.check_account_exists(Glusterfs.get_export_from_account_id(account)):
+ if not _check_account_exists(Glusterfs.get_export_from_account_id(account)):
logging.error('Account not present %s', account)
return False
@@ -481,7 +481,7 @@ def create_account_metadata(acc_path, memcache=None):
metadata = get_account_metadata(acc_path, memcache)
return restore_metadata(acc_path, metadata)
-def check_account_exists(account):
+def _check_account_exists(account):
if account not in get_account_list():
logging.warn('Account %s does not exist' % account)
return False
@@ -495,13 +495,15 @@ def get_account_id(account):
return RESELLER_PREFIX + md5(account + HASH_PATH_SUFFIX).hexdigest()
+_DEFAULT_GLUSTER_ENABLED = os.getenv('GLUSTER_UNIT_TEST_ENABLED', 'no')
__swift_conf = ConfigParser()
__swift_conf.read(os.path.join('/etc/swift', 'swift.conf'))
try:
- _gluster_enabled = __swift_conf.get('DEFAULT', 'Enable_plugin', 'no') in TRUE_VALUES
+ _gluster_enabled_val = __swift_conf.get('DEFAULT', 'Enable_plugin', _DEFAULT_GLUSTER_ENABLED)
except NoOptionError, NoSectionError:
- _gluster_enabled = False
+ _gluster_enabled_val = _DEFAULT_GLUSTER_ENABLED
del __swift_conf
+_gluster_enabled = _gluster_enabled_val in TRUE_VALUES
def Gluster_enabled():
return _gluster_enabled