CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
common_db Namespace Reference

Functions

def createDBConnection
 
def extractLogin
 
def getDBConnectionParams
 
def getLogin
 

Variables

string AUTH_FILE = "authentication.xml"
 
string AUTH_PATH = "/afs/cern.ch/cms/DB/conddb/test/"
 
string DATABASE = "cms_orcoff_prep"
 
string USERNAME = "CMS_COND_REGRESSION"
 

Function Documentation

def common_db.createDBConnection ( )

Definition at line 32 of file common_db.py.

References getDBConnectionParams().

32 
33 def createDBConnection():
34  coralConnStr, USERNAME, PASSWORD, AUTH_PATH = getDBConnectionParams()
35  conn_string = str(USERNAME+"/"+PASSWORD+"@"+DATABASE)
36  conn = cx_Oracle.connect(conn_string)
37  return conn
def getDBConnectionParams
Definition: common_db.py:38
def createDBConnection
Definition: common_db.py:32
def common_db.extractLogin (   login)

Definition at line 17 of file common_db.py.

Referenced by getLogin().

17 
18 def extractLogin(login):
19  pattern = re.compile(r'value="([^"]+)')
20  matching = pattern.search(login)
21  version = 0
22  if matching:
23  g = matching.groups()
return g[0]
def extractLogin
Definition: common_db.py:17
def common_db.getDBConnectionParams ( )

Definition at line 38 of file common_db.py.

References getLogin().

Referenced by createDBConnection(), and run_regression.SetEnv().

38 
40  os.environ['TNS_ADMIN'] = "/afs/cern.ch/project/oracle/admin"
41  coralConnStr = "oracle://"+DATABASE+"/"+USERNAME+""
42  authFilePath = os.path.join(AUTH_PATH,AUTH_FILE)
43  PASSWORD = getLogin(authFilePath, coralConnStr)
44  return (coralConnStr,USERNAME,PASSWORD,AUTH_PATH)
45 
def getLogin
Definition: common_db.py:24
def getDBConnectionParams
Definition: common_db.py:38
def common_db.getLogin (   auth,
  connStr 
)

Definition at line 24 of file common_db.py.

References extractLogin().

Referenced by getDBConnectionParams().

24 
25 def getLogin(auth, connStr):
26  pfile = open(auth, "r")
27  plist = pfile.readlines()
28  for i in range (0, len(plist)):
29  if string.find(plist[i], '<connection name="'+connStr+'">') != -1:
30  PASSWORD = extractLogin(plist[i+2])
31  return (PASSWORD)
def getLogin
Definition: common_db.py:24
def extractLogin
Definition: common_db.py:17

Variable Documentation

string common_db.AUTH_FILE = "authentication.xml"

Definition at line 14 of file common_db.py.

string common_db.AUTH_PATH = "/afs/cern.ch/cms/DB/conddb/test/"

Definition at line 13 of file common_db.py.

string common_db.DATABASE = "cms_orcoff_prep"

Definition at line 10 of file common_db.py.

string common_db.USERNAME = "CMS_COND_REGRESSION"

Definition at line 11 of file common_db.py.