def DeleteGRRTempFile(path):
 if (not os.path.isabs(path)):
  raise ErrorBadPath('Path must be absolute')
 prefix = config_lib.CONFIG['Client.tempfile_prefix']
 directories = [GetTempDirForRoot(root) for root in config_lib.CONFIG['Client.tempdir_roots']]
 if (not _CheckIfPathIsValidForDeletion(path, prefix=prefix, directories=directories)):
  msg = "Can't delete temp file %s. Filename must start with %s or lie within any of %s."
  raise ErrorNotTempFile((msg % (path, prefix, directories)))
 if os.path.exists(path):
  files.FILE_HANDLE_CACHE.Flush()
  os.remove(path)
 else:
  raise ErrorNotAFile(('%s does not exist.' % path))

def DeleteGRRTempFile ( path ) : if ( not os . path . isabs ( path ) ) : raise ErrorBadPath ( 'Path must be absolute' ) prefix = config_lib . CONFIG [ 'Client.tempfile_prefix' ] directories = [ GetTempDirForRoot ( root ) for root in config_lib . CONFIG [ 'Client.tempdir_roots' ] ] if ( not _CheckIfPathIsValidForDeletion ( path , prefix = prefix , directories = directories ) ) : msg = "Can't delete temp file %s. Filename must start with %s or lie within any of %s." raise ErrorNotTempFile ( ( msg % ( path , prefix , directories ) ) ) if os . path . exists ( path ) : files . FILE_HANDLE_CACHE . Flush ( ) os . remove ( path ) else : raise ErrorNotAFile ( ( '%s does not exist.' % path ) )
delete a grr temp file .