Beispiel #1
0
def dd(client, block_size, count, output_file, unit='M', input_file="/dev/zero",
       user="******", output=False, error=False):
    cmd = "dd {input} {output} {bs} {count}"\
        .format(input="if={}".format(escape_path(input_file)),
                output="of={}".format(escape_path(output_file)),
                bs="bs={0}{1}".format(block_size, unit),
                count="count={}".format(count))
    return run_cmd(user, client, cmd, output=output, error=error)
Beispiel #2
0
def dd(client, block_size, count, output_file, unit='M', input_file="/dev/zero",
       user="******", output=False, error=False):
    cmd = "dd {input} {output} {bs} {count}"\
        .format(input="if={}".format(escape_path(input_file)),
                output="of={}".format(escape_path(output_file)),
                bs="bs={0}{1}".format(block_size, unit),
                count="count={}".format(count))
    return run_cmd(user, client, cmd, output=output, error=error)
Beispiel #3
0
def replace_pattern(client, file_path, pattern, new_text, user='******',
                    output=False):
    cmd = 'sed -i \'s/{pattern}/{new_text}/g\' {file_path}'\
        .format(pattern=pattern,
                new_text=new_text,
                file_path=escape_path(file_path))
    return run_cmd(user, client, cmd, output=output)
Beispiel #4
0
def replace_pattern(client, file_path, pattern, new_text, user='******',
                    output=False):
    cmd = 'sed -i \'s/{pattern}/{new_text}/g\' {file_path}'\
        .format(pattern=pattern,
                new_text=new_text,
                file_path=escape_path(file_path))
    return run_cmd(user, client, cmd, output=output)
Beispiel #5
0
def fusermount(client, path, user='******', unmount=False, lazy=False,
               quiet=False, output=False):
    cmd = "fusermount {unmount} {lazy} {quiet} {path}"\
        .format(unmount="-u" if unmount else "",
                lazy="-z" if lazy else "",
                quiet="-q" if quiet else "",
                path=escape_path(path))
    return run_cmd(user, client, cmd, output=output)
Beispiel #6
0
def fusermount(client, path, user='******', unmount=False, lazy=False,
               quiet=False, output=False):
    cmd = "fusermount {unmount} {lazy} {quiet} {path}"\
        .format(unmount="-u" if unmount else "",
                lazy="-z" if lazy else "",
                quiet="-q" if quiet else "",
                path=escape_path(path))
    return run_cmd(user, client, cmd, output=output)