1 from sfa.util.sfalogging import logger
2 from glance import client as glance_client
3 from sfa.util.config import Config
6 def parse_novarc(filename):
8 f = open(filename, 'r')
11 line = line.replace('export', '').strip()
12 parts = line.split('=')
14 value = parts[1].replace("\'", "")
15 value = value.replace('\"', '')
16 opts[parts[0]] = value
24 def __init__(self, config):
27 opts = parse_novarc(config.SFA_NOVA_NOVARC)
29 self.client = glance_client.get_client(host='0.0.0.0',
30 username=opts.get('OS_USERNAME'),
31 password=opts.get('OS_PASSWORD'),
32 tenant=opts.get('OS_TENANT_NAME'),
33 auth_url=opts.get('OS_AUTH_URL'))
35 def __getattr__(self, name):
36 return getattr(self.client, name)