| |
- __builtin__.object
-
- ScpCommand
- SshCommand
- SshParameters
- exceptions.Exception(exceptions.BaseException)
-
- SshCommandException
-
- ScpCommandException
class ScpCommand(__builtin__.object) |
|
Copy a file or files via scp. |
|
Methods defined here:
- __init__(self, fromPath, toPath, fromSshParameters=None, toSshParameters=None, recurseDirectories=False, preserveTimes=True)
- Create new ScpCommand instance.
Will wait until completed.
Captures returncode, and output.
Either fromPath or toPath is expected to be local, i.e. without user and without IP address.
Correspondingly either fromSshParameters or toSshParameters must NOT be assigned an SshParameters
instance and remain default None.
fromPath
one path or a list of paths.
Absolute paths strongly recommended.
toPath
one path.
Absolute path strongly recommended.
Must be directory if more than one fromPath.
fromSshParameters
an SshParameters instance.
toSshParameters
an SshParameters instance.
recurseDirectories
a hint for when fromSshParameters.
Class methods defined here:
- commandsUsedInImplementation(cls) from __builtin__.type
- Return a list to be passed to SystemRequirements.commandsRequired().
This class can be passed to SystemRequirements.commandsRequiredByImplementations().
- get(cls, fromSshParameters, fromRemotePath, toLocalPath, recurseDirectories=False, preserveTimes=True) from __builtin__.type
- Return an ScpCommand instance.
Will wait until completed.
fromSshParameters
an SshParameters instance for remote.
fromRemotePath
one path or a list of paths.
Absolute paths strongly recommended.
- put(cls, fromLocalPath, toSshParameters, toRemotePath, preserveTimes=True) from __builtin__.type
- Return an ScpCommand instance.
Will wait until completed.
fromLocalPath
one path or a list of paths.
Absolute paths strongly recommended.
toSshParameters
an SshParameters instance for remote.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- output
- Collected output string of scp command.
May contain extraneous leading or trailing newlines and whitespace.
- returncode
- Returncode of command or 255 if an scp error occurred.
Could be None.
|
class SshCommand(__builtin__.object) |
|
Send a command over ssh. |
|
Methods defined here:
- __init__(self, sshParameters, argv, exceptionIfNotZero=True, connectTimeoutSeconds=None, maxConnectionRetries=10, tickerForRetry=True, checkForPermissionDenied=False)
- Create new SshCommand instance.
Will wait until completed.
Captures returncode, and output.
Output may contain extraneous leading or trailing newlines and whitespace.
Example use::
example = SshCommand(exampleSshParameters, ["ls", "-al"])
print "returncode=" + str(example.returncode)
print "output=" + example.output
sshParameters
an SshParameters instance.
argv
list of command and arguments passed to ssh.
If given a string instead of a list then fixed by argv=argv.split() making a list.
That may only work as expected for some commands on some platforms.
It should work for a command without arguments.
Hence if you don't want a string split, pass it in wrapped as sole item of a list.
Class methods defined here:
- acceptKnownHostKey(cls, sshParameters, connectTimeoutSeconds=None) from __builtin__.type
- Accept host's key.
Will wait until completed.
ipaddress
IP address or domain name.
- commandsUsedInImplementation(cls) from __builtin__.type
- Return a list to be passed to SystemRequirements.commandsRequired().
This class can be passed to SystemRequirements.commandsRequiredByImplementations().
- hasAcceptedKnownHostKey(cls, sshParameters) from __builtin__.type
- Return whether an attempt to acceptKnownHostKey() succeeds.
Will wait until completed with success or failure.
sshParameters
an SshParameters instance to use in the attempt.
return
whether success.
- isAvailable(cls, sshParameters, probingCommand='hostname') from __builtin__.type
- Return whether probingCommand succeeds.
Will wait until completed.
- removeKnownHostKey(cls, ipaddress) from __builtin__.type
- Remove line from ~/.ssh/known_hosts file.
- sleepUntilHasAcceptedKnownHostKey(cls, sshParameters, checkIntervalSeconds=3.0, ticker=False, extraSleepSeconds=5.0) from __builtin__.type
- If available return, else loop sleeping for checkIntervalSeconds.
sshParameters
an SshParameters instance to use in the attempts.
- sleepUntilIsAvailable(cls, sshParameters, checkIntervalSeconds=5.0, ticker=False, probingCommand='hostname') from __builtin__.type
- If available return, else loop sleeping for checkIntervalSeconds.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- output
- Collected output string of command.
May contain extraneous leading or trailing newlines and whitespace.
- returncode
- Returncode of command or 255 if an ssh error occurred.
Could be None.
|
class SshParameters(__builtin__.object) |
|
Parameters needed to connect to an ssh host.
Implemented to avoid verbosity and complexity of passing same information
many times across several uses each time in separate arguments. |
|
Methods defined here:
- __init__(self, ipaddress, user, pwd)
- Create new SshParameters instance.
Example use::
exampleSshParameters = SshParameters("10.123.45.67", "joe", "redwood")
ipaddress
IP address or domain name.
user
a string.
pwd
a string or None.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |