I have been using Review Board version 1.7.16 with great success. I had 
been using Centos 7 with RBTools 0.7.2 (package RBTools-0.7.2-1.el7.noarch).

I recently updated the Centos 7 install and RBTool was updated to version 
0.7.4 (package RBTools-0.7.4-1.el7.noarch).

I use a canned script which posts reviews to a remote server running 
reviewboard 1.7.16.

The error that I am getting is:

ERROR: Unexpected API Error: You are not logged in (HTTP 401, API Error 103)

The problem with this message is that I know that I am logged in.

This is the script that I run on 0.7.2 which has worked flawlessly. 
Unfortunately I can't share it all but this is the snippet that runs the 
rbt stuff.

# Use RBTools if available
if (system(qq(rbt --version 2>/dev/null)) == 0)
    # Posting Options:
    my $rbt_options = qq( --publish) unless ( $draft );

    # Review Board Server Options:
    $rbt_options   .= qq( --server "https://{URL Removed, sorry}");
    $rbt_options   .= qq( --username "$username");
    $rbt_options   .= qq( --password "$password");

    # Repository Options:
    $rbt_options   .= qq( --repository "$repository");

    # Review Request Field Options:
    $rbt_options   .= qq( --summary "$title");
    $rbt_options   .= qq( --description "$description") unless (-f 
    $rbt_options   .= qq( --description-file "$description") if (-f 
    $rbt_options   .= qq( --testing-done "$testing") unless (-f "$testing");
    $rbt_options   .= qq( --testing-done-file "$testing") if (-f 
    $rbt_options   .= qq( --branch "$branch");
    $rbt_options   .= qq( --target-groups "$reviewer_groups");
    $rbt_options   .= qq( --target-people "$reviewers");

    # Diff Generation Options:
    $rbt_options   .= qq( --diff-filename "$diffFile");

    # Create a new review request
    my $output = qx(rbt post $rbt_options);
    my $result = ($? >> 8);
    if ($result == 0)
        (my $url) = $output =~ /(.*\/diff\/)/;
        print "\nYou can watch your review at ".$url."\n\n";

        system("rm -f $diffFile $stdErr");

    exit $result;

If I run the rbt command manually with debug on I see the same issue so I 
know that the script isn't the problem.

~/ws/myproject/code > /usr/bin/rbt post --debug --server 
"https://review.my.server.com"; --username "jstobern" --password "<removed>" 
--repository "<removed>" --summary "Test cmdline" --branch HEAD 
--diff-filename review.diff
>>> RBTools 0.7.4
>>> Python 2.7.5 (default, Jun 24 2015, 00:41:19)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]
>>> Running on 
>>> Home = /home/jstobern
>>> Current directory = /home/jstobern/ws/myproject/code
>>> Running: git version
>>> Checking for a Subversion repository...
>>> Running: svn --non-interactive info
>>> Command exited with rc 1: ['svn', '--non-interactive', u'info']
svn: E155007: '/home/jstobern/ws/myproject/code' is not a working copy
>>> Checking for a Git repository...
>>> Running: git rev-parse --git-dir
>>> Command exited with rc 128: ['git', 'rev-parse', '--git-dir']
fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
>>> Checking for a Mercurial repository...
>>> Unable to execute "hg --help": skipping Mercurial
>>> Checking for a CVS repository...
>>> repository info: Path: cvspc.my.server.com:/swdev/cvsrep, Base path: 
None, Supports changesets: False
>>> Making HTTP GET request to https://review.my.server.com/api/
>>> Got API Error 103 (HTTP code 401): You are not logged in
>>> Error data: {u'stat': u'fail', u'err': {u'msg': u'You are not logged 
in', u'code': 103}}
Traceback (most recent call last):
  File "/usr/bin/rbt", line 9, in <module>
    load_entry_point('RBTools==0.7.4', 'console_scripts', 'rbt')()
  File "/usr/lib/python2.7/site-packages/rbtools/commands/main.py", line 
133, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "/usr/lib/python2.7/site-packages/rbtools/commands/__init__.py", 
line 612, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/usr/lib/python2.7/site-packages/rbtools/commands/post.py", line 
643, in main
    api_client, api_root = self.get_api(server_url)
  File "/usr/lib/python2.7/site-packages/rbtools/commands/__init__.py", 
line 768, in get_api
    raise CommandError('Unexpected API Error: %s' % e)
rbtools.commands.CommandError: Unexpected API Error: You are not logged in 
(HTTP 401, API Error 103)
~/ws/myproject/code >

I noticed that if I REMOVE the --username option. The rbt command (and 
hence the script) works correctly. I'm assuming that is because it falls 
back to using the data in the .rbtools-cookies. This is not how I intended 
this script to work because the username and password are derived by my 
script that then passed to rbt via --username and --password. 

Is it possible to get the functionality to the way it worked in 0.7.2? 
Passwords change often in our environment so the ability to use the script 
to derive the password from other system files was very convenient.


Supercharge your Review Board with Power Pack: 
Want us to host Review Board for you? Check out RBCommons: 
Happy user? Let us know! https://www.reviewboard.org/users/
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/d/optout.

Reply via email to