Пример #1
0
def main( args ):
    argSpec =   [
                    ( 'level',     'l', 'level',      True,  True,  False, "Level to connect to" ),
                    ( 'schema',    's', 'schema',     True,  True,  False, "Schema owner name" ),
                    ( 'output',    'o', 'output',     True,  True,  False, "Output file to write to" ),
                    ( 'verbose',   'v', 'verbose',    False, False, False, "Verbose mode" )
                ]
    
    parser = commandline.Parser(args[0], argSpec)
    
    matchedArgs, unmatchedArgs = parser.parse(args[1:])
    
    level   = matchedArgs[ 'level'  ]
    schema  = matchedArgs[ 'schema' ]
    output  = matchedArgs[ 'output' ]
    
    verbose = 'verbose' in matchedArgs
    
    LogHelper.setLevel( log, verbose )
    
    conschema = get_schema_connection( level )
    
    process( conschema, schema.upper(), open( output, 'w' ) )
Пример #2
0
def main(args):
    argSpec = [
        ('level', 'l', 'level', True, True, False, "Level to connect to"),
        ('schema', 's', 'schema', True, True, False, "Schema owner name"),
        ('output', 'o', 'output', True, True, False,
         "Output file to write to"),
        ('verbose', 'v', 'verbose', False, False, False, "Verbose mode")
    ]

    parser = commandline.Parser(args[0], argSpec)

    matchedArgs, unmatchedArgs = parser.parse(args[1:])

    level = matchedArgs['level']
    schema = matchedArgs['schema']
    output = matchedArgs['output']

    verbose = 'verbose' in matchedArgs

    LogHelper.setLevel(log, verbose)

    conschema = get_schema_connection(level)

    process(conschema, schema.upper(), open(output, 'w'))
Пример #3
0
#
# $Header: /home/inqwell/cvsroot/dev/scripts/python/createDatabaseEntities.py,v 1.1 2009/05/22 22:15:43 sanderst Exp $
#
# For a given user 'x', make sure that x_app and x_reader have w synonyms to db entities x_app is r/w
# while x_reader is r/o
#
import KBC.fotech

from Util import commandline

from FotechUtils import LogHelper

from XyUtil.XyDbHelper import get_connection
from XyUtil.XyDbHelper import get_schema_connection

log = LogHelper.getLogger( __name__ )

ignorable_entities = ( 'CONSUMER GROUP', 'SCHEDULE', 'OPERATOR', 'WINDOW', 'LIBRARY', 'JOB CLASS', 'WINDOW GROUP', 'TYPE', 'EVALUATION CONTEXT', 'INDEX', 'LOB' )

def statement( ofile, text ):
    ofile.write( "%s\n/\n" % ( text ) )

def create_synonym( schema, objname, synowner ):
    return "CREATE OR REPLACE SYNONYM %s.%s FOR %s.%s" % ( synowner, objname, schema, objname )

def create_app_synonym( schema, objname ):
    return create_synonym( schema, objname, schema + "_APP" )

def create_reader_synonym( schema, objname ):
    return create_synonym( schema, objname, schema + "_READER" )
Пример #4
0
#
# $Header: /home/inqwell/cvsroot/dev/scripts/python/FotechUtils/pwHelper.py,v 1.1 2009/05/22 22:16:45 sanderst Exp $
#
import os
import KBC.fotech

from Util.getpw import GetPW

from FotechUtils import LogHelper
from FotechUtils.FotechRoot import FOTechRoot

log = LogHelper.getLogger(__name__)
"""
    The main front office password file
"""


def get_password_file():
    return FOTechRoot.make_relative_path("etc", "pwd.cfg")


class PasswordHelper:
    def __init__(self, passwordfile=None):
        if passwordfile == None:
            passwordfile = get_password_file()
        log.info("Using password file: %s" % (passwordfile))
        self.__getpw = GetPW(configFile=passwordfile)

    def get_password(self, server, user):
        """
            Standard get password for server and user
Пример #5
0
def setLevel( level ):
    LogHelper.setLevel( log, level )