def isDir(self, remotePath): try: data = self.verifySendCMD(['isdir ' + remotePath]) except(DMError): # normally there should be no error here; a nonexistent file/directory will # return the string "<filename>: No such file or directory". # However, I've seen AGENT-WARNING returned before. return False retVal = self.stripPrompt(data).strip() if not retVal: raise FileError('isdir returned null') return retVal == 'TRUE'
def isDir(self, remotePath): try: data = self.runCmds([{ 'cmd': 'isdir ' + remotePath }]) except AgentError: # normally there should be no error here; a nonexistent file/directory will # return the string "<filename>: No such file or directory". # However, I've seen AGENT-WARNING returned before. return False retVal = data.strip() if not retVal: raise FileError('isdir returned null') return retVal == 'TRUE'
def isDir(self, remotePath): """ external function returns: success: True failure: False Throws a FileError exception when null (invalid dir/filename) """ try: data = self.runCmds([{'cmd': 'isdir ' + remotePath}]) except AgentError: # normally there should be no error here; a nonexistent file/directory will # return the string "<filename>: No such file or directory". # However, I've seen AGENT-WARNING returned before. return False retVal = data.strip() if not retVal: raise FileError('isdir returned null') return retVal == 'TRUE'
def err(error_msg): err_str = 'DeviceManager: pull unsuccessful: %s' % error_msg print err_str self._sock = None raise FileError(err_str)
def err(error_msg): err_str = 'error returned from pull: %s' % error_msg print err_str self._sock = None raise FileError(err_str)