forked from quentinhardy/odat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Info.py
49 lines (43 loc) · 1.26 KB
/
Info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python
# -*- coding: utf-8 -*-
from OracleDatabase import OracleDatabase
import logging
class Info (OracleDatabase):
'''
Information about the remote Oracle database
'''
def __init__(self,args):
'''
Constructor
'''
logging.debug("Info object created")
OracleDatabase.__init__(self,args)
self.version = ''
self.os = ''
def isVersion(self, version=None):
'''
return True if version 11
'''
if version in self.version : return True
else: return False
def loadInformationRemoteDatabase(self):
'''
Get the oracle versions
'''
logging.debug ("Pickup the remote verion")
self.version = self.args['dbcon'].version
logging.debug ("Getting remote Operating System")
REQ = "select rtrim(substr(replace(banner,'TNS for ',''),1,instr(replace(banner,'TNS for ',''),':')-1)) os from v$version where banner like 'TNS for %'"
response = self.__execQuery__(query=REQ,ld=['OS'])
if isinstance(response,Exception):
pass
else :
if isinstance(response,list) and isinstance(response[0],dict):
self.os = response[0]['OS']
logging.debug ("Remote Operating System")
logging.info(str(self))
def __str__(self):
'''
String representation
'''
return "Oracle Version: {0} and OS Version: {1}".format(self.version,self.os)