adding processable flag and fix unicode thing

This commit is contained in:
David Goetz 2011-05-11 17:01:24 -07:00
parent 84bd0f7120
commit 84981953b2
5 changed files with 8 additions and 4 deletions

View File

@ -143,6 +143,7 @@ Running the stats system on SAIO
container_name = container_stats
log_dir = /var/log/swift/stats/
class_path = swift.stats.stats_processor.StatsLogProcessor
processable = false
devices = /srv/1/node
mount_check = false
user = <your-user-name>

View File

@ -50,6 +50,7 @@ container_name = container_stats
# new_log_cutoff = 7200
# unlink_log = True
class_path = swift.stats.stats_processor.StatsLogProcessor
processable = false
# devices = /srv/node
# mount_check = true
# user = swift

View File

@ -143,8 +143,7 @@ class ContainerStatsCollector(DatabaseStatsCollector):
broker = ContainerBroker(db_path)
if not broker.is_deleted():
info = broker.get_info()
encoded_container_name = urllib.quote(
unicode(info['container'], 'utf-8').encode('utf-8'))
encoded_container_name = urllib.quote(info['container'])
line_data = '"%s","%s",%d,%d\n' % (
info['account'],
encoded_container_name,

View File

@ -27,7 +27,7 @@ import hashlib
from swift.common.internal_proxy import InternalProxy
from swift.common.exceptions import ChunkReadTimeout
from swift.common.utils import get_logger, readconf
from swift.common.utils import get_logger, readconf, TRUE_VALUES
from swift.common.daemon import Daemon
now = datetime.datetime.now
@ -56,6 +56,8 @@ class LogProcessor(object):
for section in (x for x in conf if x.startswith(plugin_prefix)):
plugin_name = section[len(plugin_prefix):]
plugin_conf = conf.get(section, {})
if plugin_conf.get('processable', 'true').lower() not in TRUE_VALUES:
continue
self.plugins[plugin_name] = plugin_conf
class_path = self.plugins[plugin_name]['class_path']
import_target, class_name = class_path.rsplit('.', 1)

View File

@ -128,9 +128,10 @@ class LogUploader(Daemon):
all_files = self.get_relpath_to_files_under_log_dir()
filename2match = self.filter_files(all_files)
if not filename2match:
sys.exit(_('No files in %(log_dir)s match %(pattern)s') %
self.logger.error(_('No files in %(log_dir)s match %(pattern)s') %
{'log_dir': self.log_dir,
'pattern': self.filename_pattern})
sys.exit(1)
if not self.internal_proxy.create_container(self.swift_account,
self.container_name):
self.logger.error(_('Unable to create container for '