cup.shell package¶
- description:
shell related module
Submodules¶
cup.shell.expect module¶
- description:
made a wraper out of paramiko.** The original copyright belongs to the author of paramiko module. See it at http://docs.paramiko.org/en/stable/
- cup.shell.expect.checkssh(hostname, username, passwd)[source]¶
check if we can ssh to hostname. :return:a dict with keys (‘exitstatus’, ‘result’) exitstatus 0 success -1 others
- cup.shell.expect.dscp(hostname, username, passwd, src, dst, timeout=9000)[source]¶
copy [hostname]:[src] to [localhost]:[dst].
- Returns:
a dict with keys (‘exitstatus’, ‘result’) exitstatus 0 success -1 others
- cup.shell.expect.go_ex(hostname, username, passwd, command='', timeout=600, b_print_stdout=True)[source]¶
execute command at remote. :return:a dict with keys (‘exitstatus’, ‘result’) exitstatus 0 success -1 others
- cup.shell.expect.go_with_scp(hostname, username, passwd, command='', host_tmp='/tmp/', remote_tmp='/tmp/', timeout=800)[source]¶
Recommand using this function to remotely execute cmds.
go_witch_scp will write a temp script file and scp to hostname:[host_tmp]. Then execute it and get the result back.
- Parameters:
host_tmp – temp folder for keeping the temporary script file (contains the cmd)
remote_tmp – remote temp folder for keeping the temporary script file
timeout – timeout
- Returns:
a dict with keys (‘exitstatus’, ‘result’)
cup.shell.oper module¶
- description:
shell operations related module