SAFplus Runtime Director API
3.0.5
|
This class encapsulates a lot of functionality available from the shell. More...
Public Member Functions | |
def | __init__ |
def | ifconfig |
def | ls |
Output format is a list of strings. More... | |
def | dir |
Output format is a list of tuples containing: ("filename", datetime, int(size), "owner", "group", "permissions", int(directory or link count)) More... | |
def | cd |
change directory More... | |
def | rm |
remove files More... | |
def | rmtree |
remove recursively (rm -rf) More... | |
def | cp |
copy More... | |
def | mv |
move More... | |
def | pwd |
return the current directory More... | |
def | which |
return the full path for an executable, by searching through your path More... | |
def | mkdirs |
Make all directories necessary to make the passed path exist. More... | |
def | chown |
change file owner More... | |
def | chmod |
change file permissions More... | |
def | chattr |
change file attributes More... | |
def | cat |
dump a file More... | |
def | date |
def | pidof |
return the process id More... | |
def | kill |
Send a signal (default is the kill signal) to a process. More... | |
def | killall |
Send a signal to all processes matching a name. More... | |
def | scp |
remote copy More... | |
def | rsync |
def | wget |
Gets a bunch of files given a URL. More... | |
def | run |
Wrapper for run_raw that raises an exception if the return code is not 0. More... | |
def | get_return_code |
def | tail |
FIXME add description. More... | |
Public Member Functions inherited from pcli.Pcli | |
def | __init__ |
Optional parameter specifies the return code on success for use in detecting if a command succeeded or not. More... | |
def | underlying_expect |
Return the raw expect object so you can do your own expecting. More... | |
def | set_prompt |
def | get_return_code |
Override this function to implement the logic that gets a result code from the execution of the prior command. More... | |
def | prompt |
This matches the shell prompt. More... | |
def | run |
Wrapper for run_raw that raises an exception if the return code is not 0. More... | |
def | run_raw |
Run an arbitrary command, with timeout. More... | |
Public Attributes | |
exp | |
default_timeout | |
psh | |
path | |
lines | |
lines_read | |
Public Attributes inherited from pcli.Pcli | |
success_return_code | |
exp | |
promptText | |
rePROMPT | |
default_timeout | |
This class encapsulates a lot of functionality available from the shell.
It contains command-equivalents like 'ls' and 'cp', and the generic functions 'run' and 'run_raw'.
The command-equivalents are preferred over 'run' because they may do error checking and output parsing for you.
If no command-equivalent exists, use the 'run' function to execute an arbitrary string at the shell prompt.
def psh.Psh.__init__ | ( | self, | |
exp, | |||
prompt = None |
|||
) |
def psh.Psh.cat | ( | self, | |
path | |||
) |
dump a file
def psh.Psh.cd | ( | self, | |
path = '-' |
|||
) |
change directory
def psh.Psh.chattr | ( | self, | |
path, | |||
attrs = '' , |
|||
recurse = False |
|||
) |
change file attributes
def psh.Psh.chmod | ( | self, | |
path, | |||
perms, | |||
recurse = False |
|||
) |
change file permissions
def psh.Psh.chown | ( | self, | |
path, | |||
user, | |||
group = None , |
|||
recurse = False |
|||
) |
change file owner
def psh.Psh.cp | ( | self, | |
path_from, | |||
path_to, | |||
timeout = None |
|||
) |
copy
def psh.Psh.date | ( | self, | |
set_to = None |
|||
) |
def psh.Psh.dir | ( | self, | |
path = '' |
|||
) |
Output format is a list of tuples containing: ("filename", datetime, int(size), "owner", "group", "permissions", int(directory or link count))
def psh.Psh.get_return_code | ( | self, | |
output | |||
) |
def psh.Psh.ifconfig | ( | self, | |
interface | |||
) |
def psh.Psh.kill | ( | self, | |
pid, | |||
signal = None |
|||
) |
Send a signal (default is the kill signal) to a process.
def psh.Psh.killall | ( | self, | |
exe_name, | |||
signal = None |
|||
) |
Send a signal to all processes matching a name.
def psh.Psh.ls | ( | self, | |
path = '' |
|||
) |
Output format is a list of strings.
def psh.Psh.mkdirs | ( | self, | |
dirtree | |||
) |
Make all directories necessary to make the passed path exist.
dirtree | the path to create |
def psh.Psh.mv | ( | self, | |
path_from, | |||
path_to | |||
) |
move
def psh.Psh.pidof | ( | self, | |
exe_name | |||
) |
return the process id
def psh.Psh.pwd | ( | self | ) |
return the current directory
def psh.Psh.rm | ( | self, | |
path | |||
) |
remove files
def psh.Psh.rmtree | ( | self, | |
path | |||
) |
remove recursively (rm -rf)
def psh.Psh.rsync | ( | self, | |
frm, | |||
to, | |||
password, | |||
timeout = None |
|||
) |
def psh.Psh.run | ( | self, | |
cmd, | |||
stim_resp_spec = {} , |
|||
timeout = None |
|||
) |
Wrapper for run_raw that raises an exception if the return code is not 0.
def psh.Psh.scp | ( | self, | |
frm, | |||
to, | |||
password, | |||
timeout = None |
|||
) |
remote copy
def psh.Psh.tail | ( | self, | |
path, | |||
last_lines = None |
|||
) |
FIXME add description.
Read the latest addition to the file
def psh.Psh.wget | ( | self, | |
base, | |||
filelst, | |||
destdir, | |||
timeout = None , |
|||
user = None , |
|||
password = None |
|||
) |
Gets a bunch of files given a URL.
def psh.Psh.which | ( | self, | |
exe_name | |||
) |
return the full path for an executable, by searching through your path
psh.Psh.default_timeout |
psh.Psh.exp |
psh.Psh.lines |
psh.Psh.lines_read |
psh.Psh.path |
psh.Psh.psh |