Commit 73b2797f authored by Sigmund Augdal's avatar Sigmund Augdal

Read settings from a config file, so we don't have to have passwords in the repository

parent 471ce814
......@@ -4,20 +4,21 @@ import etcd
from nova_router import neighbors
from scvmm_client import odata
import logging
try:
from configparser import SafeConfigParser
except ImportError:
from ConfigParser import SafeConfigParser
def main():
key = "/home/sigmunda/Devel/nova/etcd_client.key"
cert = "/home/sigmunda/Devel/nova/etcd_client.crt"
cacert = "/home/sigmunda/Devel/nova/etcd_ca.crt"
vmm_baseurl = 'https://srv-spf-99.bs.unsi.no:8090/SC2012R2/VMM/Microsoft.Management.Odata.svc'
username = 'bs-unsi\spfsvc'
password = 'Laste8il'
conf = SafeConfigParser()
conf.read("nova.cfg")
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(name)s %(levelname)s %(message)s')
etcd_client = etcd.Etcd("158.38.213.2", ssl_key=key, ssl_cert=cert, verify=cacert)
vmm_client = odata.VMMClient(vmm_baseurl, username, password)
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'),
conf.get('spf', 'password'))
nics = set()
for nic in vmm_client.query_collection("VirtualNetworkAdapters"):
......
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