My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 3188: Gerrit rules.pl issue with LDAP users
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by cam.sp...@solidfire.com, Feb 18, 2015
*****************************************************************
*****                                                       *****
***** !!!! THIS BUG TRACKER IS FOR GERRIT CODE REVIEW !!!!  *****
*****                                                       *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, CYANOGENMOD,  *****
***** INTERNAL ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.*****
*****                                                       *****
*****   THOSE ISSUES BELONG IN DIFFERENT ISSUE TRACKERS     *****
*****                                                       *****
*****************************************************************

Affected Version: gerrit version 2.10

What steps will reproduce the problem?
1. Register an LDAP user on gerrit server
2. Have user review a change
3. Attempt to use custom submit rules.pl script

What is the expected output? What do you see instead?

I'm not 100% sure that this is related to LDAP users, but I do notice that my Jenkins user (which I created via the ssh api) does not seem to have this issue. From what I can tell, the problem is that my cam.sparr user is interpreted as _6A4FE915 in the prolog script, the jenkins user is interpreted properly as user(1000001).

This prolog script was taken directly from https://gerrit-review.googlesource.com/Documentation/prolog-cookbook.html#_example_13_1_1_2_code_review

Here is my rules.pl:

submit_rule(submit(CR, V)) :-
    sum(1, 'Code-Review', CR),
    gerrit:max_with_block(-1, 1, 'Verified', V).

% Sum the votes in a category. Uses a helper function score/2
% to select out only the score values the given category.
sum(VotesNeeded, Category, label(Category, ok(_))) :-
    findall(Score, score(Category, Score), All),
    sum_list(All, Sum),
    Sum >= VotesNeeded,
    !.
sum(VotesNeeded, Category, label(Category, need(VotesNeeded))).

score(Category, Score) :-
    gerrit:commit_label(label(Category, Score), User).

% Simple Prolog routine to sum a list of integers.
sum_list(List, Sum)   :- sum_list(List, 0, Sum).
sum_list([X|T], Y, S) :- Z is X + Y, sum_list(T, Z, S).
sum_list([], S, S).



When I run the submit test api I get an error:

$ cat rules.pl | ssh -p 29418 cam.sparr@gerrit.eng.solidfire.net gerrit test-submit rule I36fe5a2906371803e7a465e4669c4064e7e8dfa3 -s
[
  {
    "status": "RULE_ERROR",
    "error_message": "Error evaluating project rules, check server log"
  }
]



And this is the server-side error:
[2015-02-18 23:07:15,089] ERROR com.google.gerrit.server.project.ChangeControl : Submit rule :(user,submit_rule) for change 1 of sf-pyvmomi output invalid result: submit(label(Code-Review,ok(_6A4FE915)),label(Verified,ok(user(1000001)))). Reason: A label with the status Code-Review: OK must contain a user.


Please provide any additional information below.

Feb 18, 2015
#1 cam.sp...@solidfire.com
I also notice this user: https://code.google.com/p/gerrit/issues/detail?id=2469 having the same problem with LDAP accounts.

He posted a workaround to make the prolog script work, which worked for me, but I believe that the root cause is still not fixed, which is that the user information is not filled properly for LDAP users.
Jun 14, 2015
#2 jnasl...@gmail.com
I think this might just be a documentation issue. See this: https://groups.google.com/forum/#!topic/repo-discuss/JvvDvZ0q7jk.
Sign in to add a comment

Powered by Google Project Hosting