removed: required config file
This commit is contained in:
parent
0892f3920e
commit
417c78a15d
@ -32,7 +32,7 @@ def main(argv=None):
|
|||||||
parser = argparse.ArgumentParser(description=('Parallel remote command'
|
parser = argparse.ArgumentParser(description=('Parallel remote command'
|
||||||
' execution and file'
|
' execution and file'
|
||||||
' collection tool'))
|
' collection tool'))
|
||||||
parser.add_argument('--config', default='config.yaml',
|
parser.add_argument('--config',
|
||||||
help='config file')
|
help='config file')
|
||||||
parser.add_argument('-o', '--dest-file',
|
parser.add_argument('-o', '--dest-file',
|
||||||
help='output archive file')
|
help='output archive file')
|
||||||
@ -60,6 +60,8 @@ def main(argv=None):
|
|||||||
loglevel = logging.INFO
|
loglevel = logging.INFO
|
||||||
logging.basicConfig(level=loglevel,
|
logging.basicConfig(level=loglevel,
|
||||||
format='%(asctime)s %(levelname)s %(message)s')
|
format='%(asctime)s %(levelname)s %(message)s')
|
||||||
|
config = Conf()
|
||||||
|
if args.config:
|
||||||
config = Conf.load_conf(args.config)
|
config = Conf.load_conf(args.config)
|
||||||
main_arc = os.path.join(config.archives, 'general.tar.bz2')
|
main_arc = os.path.join(config.archives, 'general.tar.bz2')
|
||||||
if args.dest_file:
|
if args.dest_file:
|
||||||
|
@ -36,6 +36,7 @@ class Conf(object):
|
|||||||
try:
|
try:
|
||||||
with open(filename, 'r') as f:
|
with open(filename, 'r') as f:
|
||||||
conf = yaml.load(f)
|
conf = yaml.load(f)
|
||||||
|
return Conf(**conf)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logging.error("load_conf: I/O error(%s): %s" % (e.errno, e.strerror))
|
logging.error("load_conf: I/O error(%s): %s" % (e.errno, e.strerror))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -48,8 +49,9 @@ class Conf(object):
|
|||||||
except:
|
except:
|
||||||
logging.error("load_conf: Unexpected error: %s" % sys.exc_info()[0])
|
logging.error("load_conf: Unexpected error: %s" % sys.exc_info()[0])
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
logging.info(conf)
|
finally:
|
||||||
return Conf(**conf)
|
logging.error("load_conf: exiting...")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user