Exemplo n.º 1
0
    def delete(self, request, reponame):
        if '/' in reponame:
            return self._bad_request('slashes are not allowed within the repository name')
        if '.' == reponame or '..' == reponame:
            return self._bad_request('bad repository name')
        
        repo_path = self.repoConfigService.getStaticRepoDir(reponame)
        if not os.path.exists(repo_path):
            return rc.NOT_FOUND

        if reponame in get_non_deletable_repositories():
            return self._bad_request('repository can not be deleted')
        
        self.audit.log_action("deleted static repository %s"%reponame,request)
        shutil.rmtree(repo_path)
        return rc.DELETED
Exemplo n.º 2
0
    def delete(self, request, reponame):
        if '/' in reponame:
            return self._bad_request('slashes are not allowed within the repository name')
        if '.' == reponame or '..' == reponame:
            return self._bad_request('bad repository name')
        
        repo_path = self.repoConfigService.getStaticRepoDir(reponame)
        if not os.path.exists(repo_path):
            return rc.NOT_FOUND

        if reponame in get_non_deletable_repositories():
            return self._bad_request('repository can not be deleted')
        
        self.audit.log_action("deleted static repository %s"%reponame,request)
        shutil.rmtree(repo_path)
        return rc.DELETED
Exemplo n.º 3
0
 def test_get_deletable_repositories_ignores_invalid_entries(self):
     self.assertEquals(2, len(get_non_deletable_repositories('src/test/resources/non-deletable-repositories-with-invalid-entries')))
Exemplo n.º 4
0
 def test_get_deletable_repositories(self):
     self.assertEquals(3, len(get_non_deletable_repositories('src/test/resources/non-deletable-repositories')))