Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adapt Phantom to the new ceiclient interface

  • Loading branch information...
commit 8d98e7ac88ea3051e1929050971fbd31aea4d846 1 parent 8e3e293
Pierre Riteau priteau authored
9 pyhantom/system/epu/epu_client.py
View
@@ -5,7 +5,7 @@
from pyhantom.system import SystemAPI
from pyhantom.phantom_exceptions import PhantomAWSException
from ceiclient.connection import DashiCeiConnection
-from ceiclient.client import EPUMClient, DTRSDTClient, EPUMDefinitionClient
+from ceiclient.client import DTRSClient, EPUMClient
from pyhantom.util import log, LogEntryDecorator, _get_time, make_time
from dashi import DashiError
from phantomsql import phantom_get_default_key_name
@@ -107,10 +107,9 @@ def __init__(self, cfg):
log(logging.INFO, "Connecting to epu messaging fabric: %s, %s, XXXXX, %d, ssl=%s" % (self._rabbit, self._rabbituser, self._rabbit_port, str(ssl)))
self._dashi_conn = DashiCeiConnection(self._rabbit, self._rabbituser, self._rabbitpw, exchange=self._rabbitexchange, timeout=60, port=self._rabbit_port, ssl=ssl)
self._epum_client = EPUMClient(self._dashi_conn)
- self._dtrs_client = DTRSDTClient(self._dashi_conn)
- self._epum_def_client = EPUMDefinitionClient(self._dashi_conn)
-
- load_known_definitions(self._epum_def_client)
+ self._dtrs_client = DTRSClient(self._dashi_conn)
+
+ load_known_definitions(self._epum_client)
def _get_dt_details(self, name, caller):
return self._dtrs_client.describe_dt(caller, name)
10 sandbox/FG/add_users.py
View
@@ -3,7 +3,7 @@
import sys
import os
import subprocess
-from ceiclient.client import DTRSCredentialsClient
+from ceiclient.client import DTRSClient
from ceiclient.connection import DashiCeiConnection
import boto
import urlparse
@@ -59,7 +59,7 @@ def register_key_with_iaas(iaas_url, keytext, keyname, access_key, access_secret
ec2conn.import_key_pair(keyname, keytext)
-def add_one_user(authz, cred_client, access_key, access_secret, pub_key, email, username):
+def add_one_user(authz, dtrs_client, access_key, access_secret, pub_key, email, username):
phantomkey_name = phantom_get_default_key_name()
creds = {'access_key': access_key,
'secret_key': access_secret,
@@ -68,7 +68,7 @@ def add_one_user(authz, cred_client, access_key, access_secret, pub_key, email,
hosts = {"hotel": "https://svc.uc.futuregrid.org:8444", "sierra" : "https://s83r.idp.sdsc.futuregrid.org:8444", "alamo": "https://master1.futuregrid.tacc.utexas.edu:8444", "foxtrot": "https://f1r.idp.ufl.futuregrid.org:9444"}
print "public key is %s" % (pub_key)
for host in hosts:
- cred_client.add_credentials(access_key, host, creds)
+ dtrs_client.add_credentials(access_key, host, creds)
register_key_with_iaas(hosts[host], pub_key, phantomkey_name, access_key, access_secret)
#authz.add_user(username, email, access_key, access_secret)
@@ -87,12 +87,12 @@ def main():
authz = cfg.get_authz()
dashi_con = get_dashi_client(cfg._CFG)
- cred_client = DTRSCredentialsClient(dashi_con)
+ dtrs_client = DTRSClient(dashi_con)
for (name, access_key, access_secret) in user_pw_list:
print "handling user %s" % (name)
(email, ssh_key) = get_user_public_key(name)
- add_one_user(authz, cred_client, access_key, access_secret, ssh_key, email, name)
+ add_one_user(authz, dtrs_client, access_key, access_secret, ssh_key, email, name)
if __name__ == '__main__':
rc = main()
10 sandbox/FG/test_add_user.py
View
@@ -5,7 +5,7 @@
import sys
import os
import subprocess
-from ceiclient.client import DTRSCredentialsClient
+from ceiclient.client import DTRSClient
from ceiclient.connection import DashiCeiConnection
import boto
import urlparse
@@ -46,7 +46,7 @@ def register_key_with_iaas(iaas_url, keytext, keyname, access_key, access_secret
ec2conn.import_key_pair(keyname, keytext)
-def add_one_user(cred_client, access_key, access_secret, pub_key, email, username):
+def add_one_user(dtrs_client, access_key, access_secret, pub_key, email, username):
phantomkey_name = phantom_get_default_key_name()
creds = {'access_key': access_key,
'secret_key': access_secret,
@@ -55,7 +55,7 @@ def add_one_user(cred_client, access_key, access_secret, pub_key, email, usernam
hosts = {"hotel": "https://svc.uc.futuregrid.org:8444", "sierra" : "https://s83r.idp.sdsc.futuregrid.org:8444", "alamo": "https://master1.futuregrid.tacc.utexas.edu:8444", "foxtrot": "https://f1r.idp.ufl.futuregrid.org:9444"}
print "public key is %s" % (pub_key)
for host in hosts:
- cred_client.add_credentials(access_key, host, creds)
+ dtrs_client.add_credentials(access_key, host, creds)
register_key_with_iaas(hosts[host], pub_key, phantomkey_name, access_key, access_secret)
def main():
@@ -71,8 +71,8 @@ def main():
ssh_key = get_user_public_key()
dashi_con = get_dashi_client()
- cred_client = DTRSCredentialsClient(dashi_con)
- add_one_user(cred_client, access_key, access_secret, ssh_key, email, name)
+ dtrs_client = DTRSClient(dashi_con)
+ add_one_user(dtrs_client, access_key, access_secret, ssh_key, email, name)
if __name__ == '__main__':
rc = main()
Please sign in to comment.
Something went wrong with that request. Please try again.