Commit a3cdb296 authored by Sigmund Augdal's avatar Sigmund Augdal

Make the clean_stale script a bit configurable through command line

parent fe9a5bce
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
import etcd
import argparse
from nova_router import neighbors
from scvmm_client import odata
import logging
......@@ -9,12 +10,29 @@ try:
except ImportError:
from ConfigParser import SafeConfigParser # pylint: disable=F0401
DESCRIPTION = "Remove ip/mac bindings for VMs that no longer exists"
def parse_args():
parser = argparse.ArgumentParser(description=DESCRIPTION)
parser.add_argument('--logfile', help="send output to logfile")
parser.add_argument('--config', default="nova.cfg", help="Use alternative config file")
return parser.parse_args()
def main():
args = parse_args()
conf = SafeConfigParser()
conf.read("nova.cfg")
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(name)s %(levelname)s %(message)s')
conf.read(args.config)
if args.logfile:
logging.basicConfig(level=logging.INFO,
filename=args.logfile,
format='%(asctime)s %(name)s %(levelname)s %(message)s')
else:
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(name)s %(levelname)s %(message)s')
etcd_client = etcd.Etcd("158.38.213.2", ssl_key=conf.get('etcd', 'key'),
ssl_cert=conf.get('etcd', 'cert'), verify=conf.get('etcd', 'cacert'))
vmm_client = odata.VMMClient(conf.get('spf', 'vmm_baseurl'), conf.get('spf', 'username'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment