git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
FIT IoT-Lab shell: modified add_user category of user is required
[sfa.git]
/
sfa
/
openstack
/
client.py
diff --git
a/sfa/openstack/client.py
b/sfa/openstack/client.py
index
215d333
..
40a3f85
100644
(file)
--- a/
sfa/openstack/client.py
+++ b/
sfa/openstack/client.py
@@
-14,7
+14,7
@@
def parse_novarc(filename):
parts = line.split('=')
if len(parts) > 1:
value = parts[1].replace("\'", "")
parts = line.split('=')
if len(parts) > 1:
value = parts[1].replace("\'", "")
- value = value.replace('\"', '')
+ value = value.replace('\"', '')
opts[parts[0]] = value
except:
pass
opts[parts[0]] = value
except:
pass
@@
-23,6
+23,7
@@
def parse_novarc(filename):
class KeystoneClient:
class KeystoneClient:
+
def __init__(self, username=None, password=None, tenant=None, url=None, config=None):
if not config:
config = Config()
def __init__(self, username=None, password=None, tenant=None, url=None, config=None):
if not config:
config = Config()
@@
-35,33
+36,41
@@
class KeystoneClient:
opts['OS_TENANT_NAME'] = tenant
if url:
opts['OS_AUTH_URL'] = url
opts['OS_TENANT_NAME'] = tenant
if url:
opts['OS_AUTH_URL'] = url
- self.opts = opts
+ self.opts = opts
self.client = keystone_client.Client(username=opts.get('OS_USERNAME'),
password=opts.get('OS_PASSWORD'),
self.client = keystone_client.Client(username=opts.get('OS_USERNAME'),
password=opts.get('OS_PASSWORD'),
- tenant_name=opts.get('OS_TENANT_NAME'),
+ tenant_name=opts.get(
+ 'OS_TENANT_NAME'),
auth_url=opts.get('OS_AUTH_URL'))
def connect(self, *args, **kwds):
self.__init__(*args, **kwds)
auth_url=opts.get('OS_AUTH_URL'))
def connect(self, *args, **kwds):
self.__init__(*args, **kwds)
-
+
def __getattr__(self, name):
def __getattr__(self, name):
- return getattr(self.client, name)
+ return getattr(self.client, name)
class GlanceClient:
class GlanceClient:
+
def __init__(self, config=None):
if not config:
config = Config()
opts = parse_novarc(config.SFA_NOVA_NOVARC)
self.client = glance_client.get_client(host='0.0.0.0',
def __init__(self, config=None):
if not config:
config = Config()
opts = parse_novarc(config.SFA_NOVA_NOVARC)
self.client = glance_client.get_client(host='0.0.0.0',
- username=opts.get('OS_USERNAME'),
- password=opts.get('OS_PASSWORD'),
- tenant=opts.get('OS_TENANT_NAME'),
+ username=opts.get(
+ 'OS_USERNAME'),
+ password=opts.get(
+ 'OS_PASSWORD'),
+ tenant=opts.get(
+ 'OS_TENANT_NAME'),
auth_url=opts.get('OS_AUTH_URL'))
auth_url=opts.get('OS_AUTH_URL'))
+
def __getattr__(self, name):
return getattr(self.client, name)
def __getattr__(self, name):
return getattr(self.client, name)
+
class NovaClient:
class NovaClient:
+
def __init__(self, username=None, password=None, tenant=None, url=None, config=None):
if not config:
config = Config()
def __init__(self, username=None, password=None, tenant=None, url=None, config=None):
if not config:
config = Config()
@@
-82,11
+91,11
@@
class NovaClient:
region_name='',
extensions=[],
service_type='compute',
region_name='',
extensions=[],
service_type='compute',
- service_name='',
+ service_name='',
)
def connect(self, *args, **kwds):
self.__init__(*args, **kwds)
)
def connect(self, *args, **kwds):
self.__init__(*args, **kwds)
-
+
def __getattr__(self, name):
def __getattr__(self, name):
- return getattr(self.client, name)
+ return getattr(self.client, name)