git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7491c3a
)
added KeystoneClient
author
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Fri, 29 Jun 2012 15:37:36 +0000
(11:37 -0400)
committer
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Fri, 29 Jun 2012 15:38:27 +0000
(11:38 -0400)
sfa/openstack/client.py
patch
|
blob
|
history
diff --git
a/sfa/openstack/client.py
b/sfa/openstack/client.py
index
11d9221
..
f0d717e
100644
(file)
--- a/
sfa/openstack/client.py
+++ b/
sfa/openstack/client.py
@@
-1,6
+1,7
@@
from sfa.util.sfalogging import logger
from sfa.util.sfalogging import logger
+from keystoneclient.v2_0 import client as keystone_client
from glance import client as glance_client
from glance import client as glance_client
-from novaclient.v1_1
.client import C
lient
+from novaclient.v1_1
import client as nova_c
lient
from sfa.util.config import Config
from sfa.util.config import Config
@@
-21,40
+22,47
@@
def parse_novarc(filename):
return opts
return opts
-class
Glanc
eClient:
+class
Keyston
eClient:
def __init__(self, config=None):
if not config:
config = Config()
opts = parse_novarc(config.SFA_NOVA_NOVARC)
def __init__(self, config=None):
if not config:
config = Config()
opts = parse_novarc(config.SFA_NOVA_NOVARC)
+ self.client = keystone_client.Client(username=opts.get('OS_USERNAME'),
+ password=opts.get('OS_PASSWORD'),
+ tenant_name=opts.get('OS_TENANT_NAME'),
+ auth_url=opts.get('OS_AUTH_URL'))
+
+ def __getattr__(self, name):
+ return getattr(self.client, name)
+
+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',
username=opts.get('OS_USERNAME'),
password=opts.get('OS_PASSWORD'),
tenant=opts.get('OS_TENANT_NAME'),
auth_url=opts.get('OS_AUTH_URL'))
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'),
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:
def __init__(self, config=None):
if not config:
config = Config()
opts = parse_novarc(config.SFA_NOVA_NOVARC)
class NovaClient:
def __init__(self, config=None):
if not config:
config = Config()
opts = parse_novarc(config.SFA_NOVA_NOVARC)
-
- self.client = Client(username=opts.get('OS_USERNAME'),
- api_key=opts.get('OS_PASSWORD'),
- project_id=opts.get('OS_TENANT_NAME'),
- auth_url=opts.get('OS_AUTH_URL'),
- region_name='',
- extensions=[],
- service_type='compute',
- service_name='',
- )
+ self.client = nova_client.Client(username=opts.get('OS_USERNAME'),
+ api_key=opts.get('OS_PASSWORD'),
+ project_id=opts.get('OS_TENANT_NAME'),
+ auth_url=opts.get('OS_AUTH_URL'),
+ region_name='',
+ extensions=[],
+ service_type='compute',
+ service_name='',
+ )
-
def __getattr__(self, name):
def __getattr__(self, name):
- return getattr(self.client, name)
-
-
+ return getattr(self.client, name)