Start rewriting options and config as common.py globals

This commit is contained in:
Daniel Martí 2013-11-01 12:10:57 +01:00
parent 1d88ba5450
commit c3be06fb1d
12 changed files with 129 additions and 99 deletions

View file

@ -36,12 +36,12 @@ def carbon_send(key, value):
s.sendall(msg)
s.close()
config = {}
options = None
config = None
def main():
# Read configuration...
common.read_config(config)
global options, config
if not config['update_stats']:
print "Stats are disabled - check your configuration"
@ -55,6 +55,8 @@ def main():
help="Download logs we don't have")
(options, args) = parser.parse_args()
config = common.read_config(options)
# Get all metadata-defined apps...
metaapps = common.read_metadata(options.verbose)
@ -114,7 +116,6 @@ def main():
for logfile in glob.glob(os.path.join(logsdir,'access-*.log.gz')):
if options.verbose:
print '...' + logfile
logdate = logfile[len(logsdir) + 1 + len('access-'):-7]
p = subprocess.Popen(["zcat", logfile], stdout = subprocess.PIPE)
matches = (logsearch(line) for line in p.stdout)
for match in matches: