Пример #1
0
def run(prog, args):
    """Run the specified program."""
    load_plugins('init', globals())
    args = list(args)
    initializers(prog, args)
    logging.debug('%r', {'prog': prog, 'args': args})
    logging.debug('cmd: %s', ' '.join([prog] + args))
    os.execvp(prog, (prog,) + tuple(args))
Пример #2
0
    def test_load(self, plugin_dir):
        create_plugin('init', 'test', 'BAR = FOO\nFOO = 2\n')

        ctx = {'FOO': 1}
        plugin.load_plugins('init', ctx)

        assert ctx['FOO'] == 2
        assert 'BAR' in ctx and ctx['BAR'] == 1
Пример #3
0
def run(prog, args):
    """Run the specified program."""
    load_plugins('init', globals())
    args = list(args)
    initializers(prog, args)
    logging.debug('%r', {'prog': prog, 'args': args})
    logging.debug('cmd: %s', ' '.join([prog] + args))
    os.execvp(prog, (prog, ) + tuple(args))
Пример #4
0
    def test_load(self, plugin_dir):
        create_plugin("init", "test", "BAR = FOO\nFOO = 2\n")

        ctx = {"FOO": 1}
        plugin.load_plugins("init", ctx)

        assert ctx["FOO"] == 2
        assert "BAR" in ctx and ctx["BAR"] == 1
Пример #5
0
                        help='pass specified long-style option to docker run')
    parser.set_defaults(docker_opt=[])

@docker_run_builder
def docker_run_base(args, docker_run):
    docker_run.docker_args.extend('-i -t --rm'.split())
    if args.debug:
        docker_run.docker_args.extend(('-e', 'DEVOPS_UTILS_DEBUG=true'))

@docker_run_builder
def docker_run_opts(args, docker_run):
    docker_run.docker_args.extend(['--%s' % opt for opt in args.docker_opt])

from devops_utils.plugin import load_plugins  ##INIT:SUPPRESS##
BASEDIR=os.path.dirname(__file__)  ##INIT:SUPPRESS##
load_plugins('runner', globals(), basedir=BASEDIR)  ##INIT:PLUGINS:runner##

def main(args=sys.argv[1:]):
    """Run a program in a devops-utils container.

    To see install options run `%(prog)s install --help`.
    """
    logging.basicConfig(
        format='(%(module)s:%(funcName)s:%(lineno)s) %(message)s',
        level=logging.INFO)

    parser = argparse.ArgumentParser(description=main.__doc__,
                                     prefix_chars='+')
    argparse_builders(parser)
    args, prog_args = parser.parse_known_args(args)
Пример #6
0
def dm_env():
    ctx = {'initfunc': init.initfunc}
    plugin.load_plugins('init', ctx, pattern='docker_machine')
    return ctx['dm_env']