예제 #1
0
def shell_execv_iter(env=None, command=None, argv=[]):
    """ A helper routine to execute a shell command.

    This command will usually yield its results. Often the result will be a dict.
    """
    if not command: raise RuntimeError("No command provided")
    if not env: env = environment()

    ## This ensures the registry was initialised
    Registry.Init()
    try:
        command = Registry.SHELL_COMMANDS[command]
    except:
        raise RuntimeError("Command %s not found in registry" % command)

    command = command(argv, env=env)

    return command.execute()
예제 #2
0
파일: LiveCom.py 프로젝트: ntvis/pyflag
            ])  ## List of Scanners

        dbh = DB.DBO(self.test_case)
        dbh.execute("select count(*) as c from webmail_messages")
        row = dbh.fetch()
        self.assert_(row['c'] > 0, "No hotmail messages were found")


if __name__ == '__main__':
    import sys
    import pyflag.conf
    config = pyflag.conf.ConfObject()

    config.parse_options()

    Registry.Init()

    ## Update the current webmail_messages to include message ids
    dbh = DB.DBO(sys.argv[1])
    dbh1 = dbh.clone()
    dbh.execute(
        "select inode_id, parent_inode_id, message_id from webmail_messages")
    for row in dbh:
        if not row['message_id']:
            data = ''
            m = ''
            dbh1.execute(
                "select `key`,value from http_parameters where inode_id=%r and `key`='kr' limit 1",
                row['parent_inode_id'])
            row1 = dbh1.fetch()
            if row1:
예제 #3
0
파일: Tester.py 프로젝트: johnmccabe/pyflag
    'list',
    short_option='L',
    default=None,
    action='store_true',
    dest='list',
    help='Just list all the available test classes without running them')

config.add_option('pause',
                  short_option='p',
                  default=False,
                  action='store_true',
                  help='Pause after each test')

config.add_option('log', default=None, help="Log file for resuming tests")

Registry.Init()
config.parse_options()

test_registry = Registry.InitTests()
if config.match:
    classes = [ x for x in test_registry.classes if \
                re.search(config.match,"%s" % x.__doc__)]
elif config.file:
    classes = [ x for x in test_registry.classes if \
                re.search(config.file,  \
                          test_registry.filename(test_registry.get_name(x))) ]
else:
    classes = test_registry.classes

if config.log:
    try: