Hi,

I am using this svn pre-commit hook to integrate reviewboard and svn. 
https://github.com/shuge/reviewboard-svn-hooks/blob/master/reviewboardsvnhooks/strict_review.py

It turns out to be permission denied  
when strict_review.py opens the reviewboard url to retrieve the xml of 
specific review request.

rsp = urllib2.urlopen(url) --->permission denied  (url : 
http://192.168.0.188/rb/api/review-requests/2/reviews/)
                                                                            
--------------------------------                              --
                                                                            
reviewboard url                                         review request #2

URLError: <urlopen error [Errno 13] Permission denied>

I can retrieve the content of this url via wget on reviewboard server.
But it fails when svn pre-commit hook execute strict_review.py.

Any idea to figure out the cause of this url error,
(The error is still permission denied if I type the wrong url, say, 
http://192.168.0.188/rb/api/review-requests/99/reviews/ )
and workaround to fix this problem?

System information:
ReviewBoard: 1.7.6
OS: Centos 6.3
Python: 2.6.6

Many thanks.

Code snippets relevant to open url

class Opener(object):
    def __init__(self, server, username, password, cookie_file = None):
        self._server = server
        if cookie_file is None:
            cookie_file = COOKIE_FILE
        self._auth = base64.b64encode(username + ':' + password)
        cookie_jar = cookielib.MozillaCookieJar(cookie_file)
        cookie_handler = urllib2.HTTPCookieProcessor(cookie_jar)
        self._opener = urllib2.build_opener(cookie_handler)

    def open(self, path, ext_headers, *a, **k):
        url = urljoin(self._server, path)
        return self.abs_open(url, ext_headers, *a, **k)

    def abs_open(self, url, ext_headers, *a, **k):
        debug('url open:%s' % url)
        r = urllib2.Request(url)
        for k, v in ext_headers:
            r.add_header(k, v)
        r.add_header('Authorization', 'Basic ' + self._auth)
        try:
            rsp = self._opener.open(r) -->permission denied
            return rsp.read()
        except urllib2.URLError, e:
            raise SvnError(str(e))





Log message:
Commit blocked by pre-commit hook (exit code 1) with output:
<urlopen error [Errno 13] Permission denied>
Traceback (most recent call last):
File 
"/usr/lib/python2.6/site-packages/reviewboard_svn_hooks-0.2.1_r20-py2.6.egg/reviewboardsvnhooks/strict_review.py",
 

line 212, in main
    _main()
File 
"/usr/lib/python2.6/site-packages/reviewboard_svn_hooks-0.2.1_r20-py2.6.egg/reviewboardsvnhooks/strict_review.py",
 

line 200, in _main
    check_rb(repos, txn)
File 
"/usr/lib/python2.6/site-packages/reviewboard_svn_hooks-0.2.1_r20-py2.6.egg/reviewboardsvnhooks/strict_review.py",
 

line 150, in check_rb
    rsp = urllib2.urlopen(url)
  File "/usr/lib64/python2.6/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib64/python2.6/urllib2.py", line 391, in open
    response = self._open(req, data)
  File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
    '_open', req)
  File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 13] Permission denied>

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to