Exemplo n.º 1
0
def fetch_socat(local):
    """
    Fetches the `socat` binary from a remote host.

    :param local: Local path to copy the file to, or local file path.
    :type local: unicode
    """
    remote_file = '/usr/local/bin/socat'
    local_file = expand_path(local)
    if os.path.exists(local_file) and not os.path.isfile(local_file):
        local_file = os.path.join(local, 'socat')
    get(remote_file, local_file)
Exemplo n.º 2
0
def fetch_socat(local):
    """
    Fetches the `socat` binary from a remote host.

    :param local: Local path to copy the file to, or local file path.
    :type local: unicode
    """
    remote_file = '/usr/local/bin/socat'
    local_file = expand_path(local)
    if os.path.exists(local_file) and not os.path.isfile(local_file):
        local_file = os.path.join(local, 'socat')
    get(remote_file, local_file)
Exemplo n.º 3
0
def install_socat(src):
    """
    Places the `socat` binary on a remote host.

    :param src: Local directory that contains the source file, or path to the file itself.
    :type src: unicode
    """
    src_file = expand_path(src)
    if os.path.exists(src_file) and not os.path.isfile(src_file):
        src_file = os.path.join(src_file, 'socat')
        if not os.path.exists(src_file):
            error("Socat cannot be found in the provided path ({0} or {1}).".format(src, src_file))
    dest_file = '/usr/local/bin/socat'
    put(src_file, dest_file, use_sudo=True, mode='0755')
Exemplo n.º 4
0
def install_socat(src):
    """
    Places the `socat` binary on a remote host.

    :param src: Local directory that contains the source file, or path to the file itself.
    :type src: unicode
    """
    src_file = expand_path(src)
    if os.path.exists(src_file) and not os.path.isfile(src_file):
        src_file = os.path.join(src_file, 'socat')
        if not os.path.exists(src_file):
            error("Socat cannot be found in the provided path ({0} or {1}).".
                  format(src, src_file))
    dest_file = '/usr/local/bin/socat'
    put(src_file, dest_file, use_sudo=True, mode='0755')
Exemplo n.º 5
0
def load_image(filename, timeout=120):
    """
    Uploads an image from a local file to a Docker remote. Note that this temporarily has to extend the service timeout
    period.

    :param filename: Local file name.
    :type filename: unicode
    :param timeout: Timeout in seconds to set temporarily for the upload.
    :type timeout: int
    """
    c = docker_fabric()
    with open(expand_path(filename), 'r') as f:
        _timeout = c._timeout
        c._timeout = timeout
        try:
            c.load_image(f)
        finally:
            c._timeout = _timeout
Exemplo n.º 6
0
def load_image(filename, timeout=120):
    """
    Uploads an image from a local file to a Docker remote. Note that this temporarily has to extend the service timeout
    period.

    :param filename: Local file name.
    :type filename: unicode
    :param timeout: Timeout in seconds to set temporarily for the upload.
    :type timeout: int
    """
    c = docker_fabric()
    with open(expand_path(filename), 'r') as f:
        _timeout = c._timeout
        c._timeout = timeout
        try:
            c.load_image(f)
        finally:
            c._timeout = _timeout