def _testCdsls(self, repository, clusterinfo, results):
        self.cwd.pushd(os.path.join(repository.root, repository.getMountpoint()))
#        setupCDSLRepository._createCDSLFiles(".")
        _dirs=results.keys()
        _dirs.sort()
        repository.buildInfrastructure(clusterinfo)
        for _path in _dirs:
            _cdsl=None
            try:
                _cdsl=repository.getCdsl(_path)
            except CdslNotFoundException:
                if results[_path][1] == True:
                    _cdsl=getCdsl(_path, CDSL_HOSTDEPENDENT_TYPE, repository, clusterinfo)
                elif results[_path][1] == False:
                    _cdsl=getCdsl(_path, CDSL_SHARED_TYPE, repository, clusterinfo)
            
            if _cdsl:
                self.assert_(repository.commit(_cdsl))
        ComLog.setLevel(logging.DEBUG, "comoonics.cdsl")
        repository.refresh()
        ComLog.setLevel(logging.INFO, "comoonics.cdsl")
        for cdsl in repository.getCdsls():
            self.assert_(repository.delete(cdsl))
        repository.removeInfrastructure(clusterinfo)       
#        setupCDSLRepository._removeCDSLFiles(".")
        self.cwd.popd()
    def _testExpand(self, repository, clusterinfo, results):
        """
        Test without clusterinfo
        """
        self.cwd.pushd(os.path.join(repository.root, repository.getMountpoint()))
#        setupCDSLRepository._createCDSLFiles(".")
        _dirs=results.keys()
        _dirs.sort()
        repository.buildInfrastructure(clusterinfo)
        for _path in _dirs:
            _cdsl=None
            try:
                _cdsl=repository.getCdsl(_path)
            except CdslNotFoundException:
                if results[_path][1] == True:
                    _cdsl=getCdsl(_path, CDSL_HOSTDEPENDENT_TYPE, repository, clusterinfo)
                elif results[_path][1] == False:
                    _cdsl=getCdsl(_path, CDSL_SHARED_TYPE, repository, clusterinfo)
            
            if _cdsl:
                repository.commit(_cdsl)
                _expanded=repository.expandCdsl(_cdsl)
                _isexpanded=repository.isExpandedDir(_expanded)
                _shouldnotbeexpanded=_expanded==_cdsl.src
                self.assertEquals(_expanded, results[_path][0], "Expansion of cdsl \"%s\" => \"%s\" != \"%s\"" %(_cdsl.src, _expanded, results[_path][0]))
                self.assertTrue(_isexpanded or _shouldnotbeexpanded, "Path %s=>%s should be detected as expanded but is not %s!!!" %(_cdsl.src, _expanded, _isexpanded))

        repository.removeInfrastructure(clusterinfo)
#        setupCDSLRepository._removeCDSLFiles(".")
        self.cwd.popd()
 def isNested(self, _path=None):
     """
     Checks if this cdsl is a nested one if path given the path is taken into account.
     @param _path: if given this path is taken else the cdsl itself.
     @type _path: string|None  
     @return: True if the cdsl is e.g. a hostdependent shared one. Otherwise False
     @rtype: Boolean
     """
     from comoonics.cdsl import guessType
     from comoonics.cdsl import CdslNotFoundException
     stripsource=self.isStripped()
     if not _path:
         _path=self.src
         stripsource=False
     _subpath=os.path.dirname(_path)
     if _subpath=="":
         return False
     # check if in repository
     try:
         self.cdslRepository.getCdsl(_subpath, stripsource=stripsource)
         return True
     except CdslNotFoundException:
         # not in repository so try to build one and check then
         self.logger.debug("isNested: cdsl %s is not in cdsl repo guessing." %_subpath)
         _tmp=getCdsl(_subpath, guessType(_subpath, self.cdslRepository), self.cdslRepository, None, self.nodes, stripsource=stripsource)
         if _tmp and _tmp.exists():
             return True
     
         return self.isNested(_subpath)
 def _createRepository(self, clusterinfo):
     from comoonics.cdsl import getCdsl, CdslNotFoundException, CDSL_HOSTDEPENDENT_TYPE, CDSL_SHARED_TYPE
     _dirs=self.results.keys()
     _dirs.sort()
     for _path in _dirs:
         _cdsl=None
         try:
             _cdsl=self.repository.getCdsl(_path)
         except CdslNotFoundException:
             if self.results[_path][1] == True:
                 _cdsl=getCdsl(_path, CDSL_HOSTDEPENDENT_TYPE, self.repository, clusterinfo)
             elif self.results[_path][1] == False:
                 _cdsl=getCdsl(_path, CDSL_SHARED_TYPE, self.repository, clusterinfo)
         
         if _cdsl:
             self.repository.commit(_cdsl)