]> git.apps.os.sepia.ceph.com Git - teuthology.git/commit
orchestra: add remote.sh commands analogous to misc.sh 1233/head
authorKyr Shatskyy <kyrylo.shatskyy@gmail.com>
Tue, 30 Oct 2018 13:17:05 +0000 (14:17 +0100)
committerKyr Shatskyy <kyrylo.shatskyy@gmail.com>
Tue, 30 Oct 2018 13:41:58 +0000 (14:41 +0100)
commita10a7f5dbe09c25287b0a98a0d4ca19c738cf606
tree955ef86d8c01413ace21f01721328b923adb4e60
parent93566516cf4a6635cac3a9b3325f0ce200b3a157
orchestra: add remote.sh commands analogous to misc.sh

Adds a remote.sh similar to misc.sh, in fact a shortcut for remote.run,
but return output instead of proc
Example:
    my_name = Remote('127.0.0.1').sh('whoami')

Adds a remote.sh_file run a script as file on a remote with or without sudo
Example 1: Run python script
    Remote('127.0.0.1').sh_file("#!/usr/bin/env python3\n"
                                "import sys\n"
                                "print(sys.version_info)")
Example 2: Run script as root
    Remote('user@host.domain').sh_file("whoami", sudo=True,
                                       label="who-am-i-for-the-real")
Example 3: Run script as other user
    Remote('user@host.domain').sh_file("whoami", sudo='nobody', )

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.de>
teuthology/orchestra/remote.py