From 92fed1249752ff1feb6cd0b004e9550ba666a7b0 Mon Sep 17 00:00:00 2001 From: Peter Portante Date: Mon, 29 Oct 2012 19:49:42 -0400 Subject: 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 Reviewed-on: http://review.gluster.org/4171 Reviewed-by: Pete Zaitcev Reviewed-by: Mohammed Junaid Tested-by: Kaleb KEITHLEY --- swift/1.4.8/plugins/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'swift/1.4.8') diff --git a/swift/1.4.8/plugins/utils.py b/swift/1.4.8/plugins/utils.py index bc16ff6f738..838c1bd75e9 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 -- cgit