'mozreview create-repo' returns AuthorizationError during dev environment setup

RESOLVED FIXED

Status

MozReview
Testing / Development Environment
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: mars, Unassigned)

Tracking

Details

(Reporter)

Description

2 years ago
When setting up a new development environment, the 'mozreview create-repo ../test-repo' step fails with a 401 AuthenticationError.

Later, when running tests, the tests fail with messages about the missing repo:

$ ./run-tests hgext/reviewboard/tests/test-fetchreviews.t
...
remote: abort: repository /repo/hg/mozilla/test-repo not found!


I have set up environments on Ubuntu 14.04, 16.04, and Debian 8.4, all show this error.


Full traceback:

+ ./mozreview create-repo test-repo
Error running mach:

['create-repo', 'test-repo']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

AuthorizationError: The username or password was not correct (HTTP 401, API Error 104)

File "/home/vagrant/mozreview/testing/vcttesting/mozreview_mach_commands.py", line 159, in create_repo
http_url, ssh_url, rbid = mr.create_repository(path)
File "/home/vagrant/mozreview/testing/vcttesting/mozreview.py", line 425, in create_repository
bugzilla_url=self.bugzilla_url)
File "/home/vagrant/mozreview/testing/vcttesting/reviewboard/__init__.py", line 52, in add_repository
root = c.get_root()
File "/home/vagrant/mozreview/venv/local/lib/python2.7/site-packages/rbtools/api/client.py", line 21, in get_root
return self._transport.get_root(*args, **kwargs)
File "/home/vagrant/mozreview/venv/local/lib/python2.7/site-packages/rbtools/api/transport/sync.py", line 47, in get_root
return self._execute_request(HttpRequest(self.server.url))
File "/home/vagrant/mozreview/venv/local/lib/python2.7/site-packages/rbtools/api/transport/sync.py", line 84, in _execute_request
rsp = self.server.make_request(request)
File "/home/vagrant/mozreview/venv/local/lib/python2.7/site-packages/rbtools/api/request.py", line 587, in make_request
self.process_error(e.code, e.read())
File "/home/vagrant/mozreview/venv/local/lib/python2.7/site-packages/rbtools/api/request.py", line 560, in process_error
rsp['err']['msg'])
(Reporter)

Comment 1

2 years ago
I also verified that the username, password, and API endpoint are all correct when running this step of the setup:

debug> reviewboard endpoint: http://127.0.0.1:55556/
debug> connecting to reviewboard as user admin@example.com, pass: password
(Reporter)

Comment 2

2 years ago
This error was being caused by the rbweb container back-end not being able to reach the bmoweb container.

When building a new test environment, the DOCKER_HOST environment variable's value is used as the base URL for the service endpoints.  I had this set to tcp://127.0.0.1.  The bmoweb container was then assigned http://127.0.0.1:someport/ as the base URL, which was then baked into the rbweb container as the rbweb endpoint.  However, the http://127.0.0.1:someport/ address was unreachable from within the rbweb container.  This prevented the rbweb back-end from being able to make an xmlrpc call to bmoweb to validate the admin login credentials, causing create-repo to fail.

I resolved the issue by telling my vagrant guest to use the private_network setting with a static IP, 192.168.33.33.  All container endpoints can now be reached from within every other container via 192.168.33.33.  I then configured the Docker HTTP API and DOCKER_HOST settings to use the static IP and re-built the test environment.  start-local-mozreview works without error and tests are passing.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.