コード例 #1
0
ファイル: __main__.py プロジェクト: nuxeh/ybd
    with app.timer('CACHE-KEYS', 'cache-key calculations'):
        cache.cache_key(defs, app.config['target'])

    cache.cull(app.config['artifacts'])
    target = defs.get(app.config['target'])
    if app.config['total'] == 0 or (app.config['total'] == 1 and
                                    target.get('kind') == 'cluster'):
        app.exit('ARCH', 'ERROR: no definitions found for', app.config['arch'])

    defs.save_trees()
    if app.config.get('mode', 'normal') == 'keys-only':
        with open('./ybd.result', 'w') as f:
            f.write(target['cache'] + '\n')
        os._exit(0)

    sandbox.executor = sandboxlib.executor_for_platform()
    app.log(app.config['target'], 'Sandbox using %s' % sandbox.executor)
    if sandboxlib.chroot == sandbox.executor:
        app.log(app.config['target'], 'WARNING: using chroot is less safe ' +
                'than using linux-user-chroot')

    if app.config.get('instances'):
        app.spawn()

    while True:
        try:
            compose(defs, target)
            break
        except KeyboardInterrupt:
            app.log(target, 'Interrupted by user')
            os._exit(1)
コード例 #2
0
ファイル: test_all.py プロジェクト: gtristan/sandboxlib
def test_executor_for_platform():
    '''Simple test of backend autodetection.'''
    executor = sandboxlib.executor_for_platform()
    test_stdout(executor)
コード例 #3
0
ファイル: __main__.py プロジェクト: leeming/ybd
    cache.cull(app.config['artifacts'])
    target = defs.get(app.config['target'])
    if app.config['total'] == 0 or (app.config['total'] == 1
                                    and target.get('kind') == 'cluster'):
        app.exit('ARCH', 'ERROR: no definitions found for', app.config['arch'])

    defs.save_trees()
    if app.config.get('mode', 'normal') == 'keys-only':
        with open(app.config['result-file'], 'w') as f:
            f.write(target['cache'] + '\n')
        app.log('RESULT', 'Cache-key for target is at',
                app.config['result-file'])
        os._exit(0)

    sandbox.executor = sandboxlib.executor_for_platform()
    app.log(app.config['target'], 'Sandbox using %s' % sandbox.executor)
    if sandboxlib.chroot == sandbox.executor:
        app.log(
            app.config['target'], 'WARNING: using chroot is less safe ' +
            'than using linux-user-chroot')

    if 'instances' in app.config:
        app.spawn()

    while True:
        try:
            compose(defs, target)
            break
        except KeyboardInterrupt:
            app.log(target, 'Interrupted by user')
コード例 #4
0
ファイル: test_all.py プロジェクト: CodethinkLabs/sandboxlib
def test_sandboxlib_backend_env_var_unknown_executor():
    executor = sandboxlib.executor_for_platform()
    os.environ["SANDBOXLIB_BACKEND"] = "unknown"
    assert executor == sandboxlib.executor_for_platform()
コード例 #5
0
ファイル: test_all.py プロジェクト: CodethinkLabs/sandboxlib
def test_sandboxlib_backend_env_var(sandboxlib_executor):
    executor_name = sandboxlib_executor.__name__.split('.')[-1]
    os.environ["SANDBOXLIB_BACKEND"] = executor_name
    executor = sandboxlib.executor_for_platform()
    assert executor == sandboxlib_executor
コード例 #6
0
ファイル: test_all.py プロジェクト: CodethinkLabs/sandboxlib
def test_executor_for_platform():
    '''Simple test of backend autodetection.'''
    executor = sandboxlib.executor_for_platform()
    test_output(executor)