def inject_file(id, source, to, move = False, permissions = "rwx",
               unpack = False):
    """
    Injects a given file (source) from the host system into the filesystem of
    the container with id id at location to (to is an absolute filepath as
    seen by the container's filesystem.

    If source is a directory, all of the files inside of that directory will be
    injected, the directory itself will not be injected.

    If move is True, then the file will be moved, otherwise it will be
    copied.

    If unpack is True and source is a .tar or .tar.gz,
    the file source will be unpacked with the tar command into to, otherwise
    this option will be ignored. Iff move is True the package will be deleted
    after extracting.

    """

    # Figure out the fully qualified destination path as seen by the host
    # system
    ztoReal = container_to_host_path(id, to)

    # Use the system commands rather than python's filesystem functions for
    # efficiency and simplicity (we certainly know what system this code is
    # running on since OpenVZ only supports *nix).
    if unpack and source.endswith((".tar", ".tar.gz")):
        check_call(["tar", "-xzf", source, "-C", ztoReal],
                   stdout = nullFile, stderr = nullFile)
        if move:
            check_call(["rm", source], stdout = nullFile, stderr = nullFile)
    else:
        if os.path.isdir(source):
            files = [os.path.join(source, i) for i in os.listdir(source)]
        else:
            files = [source]

        if move:
            check_call(["mv", "-rf"] + files + [ztoReal],
                       stdout = nullFile, stderr = nullFile)
        else:
            check_call(["cp", "-rf"] + files + [ztoReal],
                       stdout = nullFile, stderr = nullFile)

    # Ensure that the permissions and owner are correct
    check_call(["chown", "-R", "0:0", ztoReal], stdout = nullFile, stderr = nullFile)
    check_call(["chmod", "-R", (permissions) % "a=%s", ztoReal],
               stdout = nullFile, stderr = nullFile)
dataset/ETHPy150Open ucrcsedept/galah/galah/sheep/virtualsuites/vz/pyvz.py/inject_file/swapped operands of `%`