mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-07-30 08:55:00 +02:00
@@ -1,8 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import ConfigParser
|
import configparser
|
||||||
import MySQLdb as dbapi
|
import MySQLdb as dbapi
|
||||||
import StringIO
|
|
||||||
import argparse
|
import argparse
|
||||||
import getpass
|
import getpass
|
||||||
import os
|
import os
|
||||||
@@ -22,9 +21,8 @@ opts = {}
|
|||||||
|
|
||||||
def read_options(filename="", opts={}):
|
def read_options(filename="", opts={}):
|
||||||
s = "[piler]\n" + open(filename, 'r').read()
|
s = "[piler]\n" + open(filename, 'r').read()
|
||||||
fp = StringIO.StringIO(s)
|
config = configparser.ConfigParser()
|
||||||
config = ConfigParser.RawConfigParser()
|
config.read_string(s)
|
||||||
config.readfp(fp)
|
|
||||||
|
|
||||||
opts['username'] = config.get('piler', 'mysqluser')
|
opts['username'] = config.get('piler', 'mysqluser')
|
||||||
opts['password'] = config.get('piler', 'mysqlpwd')
|
opts['password'] = config.get('piler', 'mysqlpwd')
|
||||||
@@ -229,7 +227,7 @@ def main():
|
|||||||
str(opts['purged_stored_size'])))
|
str(opts['purged_stored_size'])))
|
||||||
opts['db'].commit()
|
opts['db'].commit()
|
||||||
|
|
||||||
except dbapi.DatabaseError, e:
|
except dbapi.DatabaseError as e:
|
||||||
print("Error %s" % e)
|
print("Error %s" % e)
|
||||||
|
|
||||||
if opts['db']:
|
if opts['db']:
|
||||||
|
Reference in New Issue
Block a user