- Timestamp:
- May 22, 2013, 12:45:35 PM (12 years ago)
- Location:
- baculafs/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
baculafs/trunk/README.txt
r788 r1148 3 3 a python-fuse based virtual filesystem for recovery 4 4 5 current lstatus: prototype/proof of concept5 current status: prototype/proof of concept 6 6 7 7 to demonstrate access to backuped files information … … 13 13 - only readdir and stat. No reading or opening of files 14 14 - currently, only most recent backup for a client is implemented. 15 Change t oselection nummers in the source code to change this15 Change the selection nummers in the source code to change this 16 16 - relies on cached information. Cached is filled by readdir. 17 17 If you want to access a subdirectory, make sure, you have read the upper directories before -
baculafs/trunk/baculafs.py
r789 r1148 43 43 class Bconsole: 44 44 45 def __init__(self ):45 def __init__(self, timeout = 300): 46 46 #logging.debug('BC init') 47 47 48 self.timeout = timeout 48 49 self.cwd = "/" 49 50 self.state = BconsoleState.UNKNOWN 50 51 self.last_items_dict = {} 51 52 52 self.bconsole = pexpect.spawn( BACULA_CMD, logfile=file(LOG_BCONSOLE_DUMP, 'w'), timeout= 10)53 self.bconsole = pexpect.spawn( BACULA_CMD, logfile=file(LOG_BCONSOLE_DUMP, 'w'), timeout=timeout ) 53 54 self.bconsole.setecho( False ) 54 55 self.bconsole.expect( BCONSOLE_CMD_PROMPT ) … … 101 102 logging.error( "EOF bconsole" ) 102 103 except pexpect.TIMEOUT: 103 logging.error( "TIMEOUT bconsole" ) 104 logging.error( "TIMEOUT bconsole" ) 105 raise 104 106 105 107 return self.state … … 149 151 150 152 def cd_restore(self, path): 153 154 result = False 155 151 156 logging.debug( "(" + path + ")" ) 152 157 … … 155 160 #self.bconsole.sendline( 'pwd' ) 156 161 157 index = self.bconsole.expect( ["cwd is: " + path + "[/]?", BCONSOLE_RESTORE_PROMPT, pexpect.EOF, pexpect.TIMEOUT ] ) 158 logging.debug( "cd result: " + str(index) ) 159 160 if index == 0: 161 # path ok, now wait for prompt 162 self.bconsole.expect( BCONSOLE_RESTORE_PROMPT ) 163 return True 164 elif index == 1: 165 #print "wrong path" 166 return False 167 elif index == 2: 162 try: 163 index = self.bconsole.expect( ["cwd is: " + path + "[/]?", BCONSOLE_RESTORE_PROMPT ] ) 164 logging.debug( "cd result: " + str(index) ) 165 166 if index == 0: 167 # path ok, now wait for prompt 168 self.bconsole.expect( BCONSOLE_RESTORE_PROMPT ) 169 result = True 170 elif index == 1: 171 # TODO: this is even returned, if path is correct. fix this. 172 logging.warning( "wrong path" ) 173 else: 174 logging.error( "unexpected result" ) 175 176 except pexpect.EOF: 168 177 logging.error( "EOF bconsole" ) 169 #raise? 170 return False 171 elif index == 3: 172 logging.error( "TIMEOUT bconsole" ) 173 return False 178 except pexpect.TIMEOUT: 179 logging.error( "TIMEOUT bconsole" ) 180 #raise 181 182 return result 183 174 184 175 185 def ls(self, path): … … 296 306 self.files[path + "/" + i] = { 'type': self.TYPE_FILE } 297 307 308 except pexpect.TIMEOUT: 309 logging.error( "failed to access path " + path + " (TIMEOUT)" ) 298 310 except Exception as e: 299 311 logging.exception(e)
Note:
See TracChangeset
for help on using the changeset viewer.