Line | |
---|
1 | #!/usr/bin/python26
|
---|
2 | ###
|
---|
3 | ### backmon.commands.db.test
|
---|
4 | ###
|
---|
5 |
|
---|
6 | import sys
|
---|
7 | import os
|
---|
8 | import os.path
|
---|
9 | import glob
|
---|
10 | import re
|
---|
11 |
|
---|
12 | from optparse import OptionParser
|
---|
13 | from guppy import hpy
|
---|
14 |
|
---|
15 | from ....lib import *
|
---|
16 |
|
---|
17 | from backup_monitoring.debug import *
|
---|
18 | from backup_monitoring.math import *
|
---|
19 |
|
---|
20 | from backup_monitoring.parsing.parsers import bpstulist
|
---|
21 | from backup_monitoring.parsing.parsers import df
|
---|
22 | from backup_monitoring.parsing.parsers import dsu_ls_l
|
---|
23 | from backup_monitoring.parsing.parsers import nbstlutil
|
---|
24 | from backup_monitoring.parsing.parsers import nbdevquery
|
---|
25 | from backup_monitoring.parsing.parsers import bpdbjobs
|
---|
26 |
|
---|
27 | usage = 'usage: %prog db test'
|
---|
28 | parser = OptionParser(usage=usage)
|
---|
29 |
|
---|
30 | def run(args, kwargs):
|
---|
31 |
|
---|
32 | #
|
---|
33 | # add kwargs to local namespace
|
---|
34 | #
|
---|
35 | for key in kwargs.keys():
|
---|
36 |
|
---|
37 | if re.compile('^[A-Z][A-Z_]+$').match(key):
|
---|
38 | exec(key + ' = kwargs[\'' + key + '\']')
|
---|
39 |
|
---|
40 | (options, args) = parser.parse_args(args)
|
---|
41 |
|
---|
42 |
|
---|
43 | #
|
---|
44 | # Test Database Connection
|
---|
45 | #
|
---|
46 | conn = CONN
|
---|
47 | curs = conn.cursor()
|
---|
48 | curs.execute ("SELECT VERSION()")
|
---|
49 | row = curs.fetchone ()
|
---|
50 | print "server version:", row[0]
|
---|
51 | curs.close ()
|
---|
52 | conn.close ()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.