Module shellutils :: Class UnixShell
[hide private]

Class UnixShell

source code

Shell --+
        |
       UnixShell

Unix Shell base class

Instance Methods [hide private]
 
__init__(self, client) source code
 
isWinOs(self) source code
 
isSudoConfigured(self)
Returns true if there is a valid sudo path at the remote destination '@types: -> bool'
source code
 
_getOsLanguageDiscoverer(self) source code
 
_getOsVersion(self)
Get OS version
source code
 
_getOsType(self)
Get OS type
source code
 
setSessionLocale(self) source code
 
getShell(self)
Try to retrieve a shell path from Unix machines (like /bin/sh or /sbin/sh)
source code
 
getShellStatusVar(self)
Returns the shell command exit status code
source code
 
getAvailableEngLocale(self) source code
 
__getCommandExitStatus(self, statusVar) source code
 
__isLimitedCommandLength(self)
Specific for Sun OS where shell 'sh' has command length limitation
source code
 
__executeCommand(self, command) source code
 
__executeCommandWithSu(self, command) source code
 
__canUseSudo(self, originalCommand) source code
 
__shouldRunAsSuperUser(self, originalCommand, checkDestinationConfiguration=None) source code
 
__isCommandConfiguredOnDestination(self, command) source code
 
__shouldAllCommandsRunAsSuperUser(self) source code
 
__shouldCommandElemRunAsSuperUser(self, command) source code
 
__canUseSu(self, originalCommand) source code
 
__getProtocolManager(self) source code
 
__getSudoSuPolicy(self) source code
 
_execute(self, command)
Template method for derived shells for exact command execution
source code
 
__retrieveSudoDetails(self)
Get information about sudo paths and sudo enabled commands
source code
 
__prepareCmdForSudo(self, cmd, preserveSudoContext=0) source code
 
__parseSudoConfiguredCommands(self, output) source code
 
__getSudoConfiguredCommands(self) source code
 
__getSudoWithCmd(self, sudoPath, originalCommand, preserveSudoContext=0) source code
 
__getSudoPath(self) source code
 
fsObjectExists(self, path)
Indicates whether object by specified path exists on remote file system
source code
 
safecat(self, path, forceSudo=0)
Get content of file by specified path
source code
 
rebuildPath(self, folder)
Normalize path to one used in OS client connected to
source code

Inherited from Shell: canCopyFile, closeClient, createOutputHandler, determineOsLanguage, execAlternateCmds, execAlternateCmdsList, execCmd, execCmdAsBytes, executeCommandAndDecode, executeCommandAndDecodeByMatcher, getCharsetName, getClientType, getCommandSeparator, getCredentialId, getDefaultCommandTimeout, getLastCmdReturnCode, getOsLanguage, getOsType, getOsVersion, getPort, getShellCmdSeperator, getXML, isWindowsWithCygwin, resolveHost, resolveIp, useCharset

Class Variables [hide private]
  ONLY_SUDO_POLICY = 'sudo'
  ONLY_SU_POLICY = 'su'
  SUDO_SU_POLICY = 'sudo or su'
  ERROR_CODE_PREFIX = 'ERROR_CODE:'

Inherited from Shell: NO_CMD_RETURN_CODE_ERR_NUMBER

Method Details [hide private]

__init__(self, client)
(Constructor)

source code 
Overrides: Shell.__init__
(inherited documentation)

isWinOs(self)

source code 
Overrides: Shell.isWinOs

_getOsLanguageDiscoverer(self)

source code 
Overrides: Shell._getOsLanguageDiscoverer

_getOsVersion(self)

source code 

Get OS version

Raises:
  • Exception - Failed getting OS version
Overrides: Shell._getOsVersion

_getOsType(self)

source code 

Get OS type

Raises:
  • Exception - Failed getting machine OS type.
Overrides: Shell._getOsType

setSessionLocale(self)

source code 
Overrides: Shell.setSessionLocale

Deprecated: will be removed from the public access

getShellStatusVar(self)

source code 

Returns the shell command exit status code

Overrides: Shell.getShellStatusVar

_execute(self, command)

source code 

Template method for derived shells for exact command execution

Overrides: Shell._execute

fsObjectExists(self, path)

source code 

Indicates whether object by specified path exists on remote file system

Overrides: Shell.fsObjectExists

Deprecated: Use methods from file system module instead

safecat(self, path, forceSudo=0)

source code 

Get content of file by specified path

Parameters:
  • forceSudo - if true, always uses sudo, if false first tries to run command without sudo
Raises:
  • ValueError - Illegal cat command, contains redirect
  • EnvironmentError - sudo for cat is not available on server
  • Exception - Failed getting contents of file
Overrides: Shell.safecat

rebuildPath(self, folder)

source code 

Normalize path to one used in OS client connected to

Overrides: Shell.rebuildPath

Deprecated: Use file system module for such purposes