コード例 #1
0
ファイル: tasks.py プロジェクト: baffolobill/fabric
        def inner(args, kwargs, queue, name, env):
            state.env.update(env)

            def submit(result):
                queue.put({'name': name, 'result': result})

            try:
                key = normalize_to_string(state.env.host_string)
                state.connections.pop(key, "")
                submit(task.run(*args, **kwargs))
            except NetworkError, e:
                # Backwards compat test re: whether to use an exception or
                # abort
                if not state.env.use_exceptions_for['network']:
                    func = warn if state.env.skip_bad_hosts else abort
                    from fabric.io import prefixed_output
                    with prefixed_output("[%s]: " % state.env.host_string):
                        error(e.message, func=func, exception=e.wrapped)
                else:
                    raise
コード例 #2
0
ファイル: network.py プロジェクト: baffolobill/fabric
def disconnect_all():
    """
    Disconnect from all currently connected servers.

    Used at the end of ``fab``'s main loop, and also intended for use by
    library users.
    """
    from fabric.state import connections, output
    # Explicitly disconnect from all servers
    for key in connections.keys():
        from fabric.io import prefixed_output
        with prefixed_output("[%s]: " % denormalize(key)):
            if output.status:
                # Here we can't use the py3k print(x, end=" ")
                # because 2.5 backwards compatibility
                sys.stdout.write("Disconnecting...\n")
            connections[key].close()
            del connections[key]
            if output.status:
                sys.stdout.write("done.\n")
コード例 #3
0
ファイル: network.py プロジェクト: baffolobill/fabric
def disconnect_all():
    """
    Disconnect from all currently connected servers.

    Used at the end of ``fab``'s main loop, and also intended for use by
    library users.
    """
    from fabric.state import connections, output
    # Explicitly disconnect from all servers
    for key in connections.keys():
        from fabric.io import prefixed_output
        with prefixed_output("[%s]: " % denormalize(key)):
            if output.status:
                # Here we can't use the py3k print(x, end=" ")
                # because 2.5 backwards compatibility
                sys.stdout.write("Disconnecting...\n")
            connections[key].close()
            del connections[key]
            if output.status:
                sys.stdout.write("done.\n")