git repository setRule() triggers Internal Server Error following an Assert

Bug #1815431 reported by Andy Whitcroft on 2019-02-11
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
High
Colin Watson

Bug Description

When updating the rules applied to a git repository the setRules call is triggering a Internal Server Error following an Assert in launchpad:

AssertionError: setRules failed to establish requested rule order [u'refs/heads/master-next', u'refs/heads/master', u'refs/tags/Ubuntu-azure-*', u'refs/tags/v4.18*', u'*'] (got [u'refs/heads/master', u'refs/heads/master-next', u'refs/tags/Ubuntu-azure-*', u'refs/tags/v4.18*', u'*'] instead)

Full OOPS:

    https://oops.canonical.com/?oopsid=OOPS-63f0dab8ceaa592ca6b3b58789200662

We are attempting to change the rules on https://api.launchpad.net/devel/~canonical-kernel/ubuntu/+source/linux-azure/+git/cosmic from:

  - grants:
    - can_create: false
      can_force_push: true
      can_push: true
      grantee_link: https://api.launchpad.net/devel/~canonical-kernel-committers
      grantee_type: Person
    ref_pattern: refs/heads/*
  - grants:
    - can_create: true
      can_force_push: true
      can_push: false
      grantee_link: https://api.launchpad.net/devel/~canonical-kernel-committers
      grantee_type: Person
    ref_pattern: refs/tags/*
  - grants:
    - can_create: true
      can_force_push: true
      can_push: true
      grantee_link: https://api.launchpad.net/devel/~canonical-kernel-repo-admins
      grantee_type: Person
    - can_create: false
      can_force_push: false
      can_push: false
      grantee_link: null
      grantee_type: Repository owner
    ref_pattern: '*'

to:

  - grants:
    - can_create: true
      can_force_push: true
      can_push: false
      grantee_link: /~canonical-kernel-committers
      grantee_type: Person
    ref_pattern: refs/heads/master-next
  - grants:
    - can_create: true
      can_force_push: true
      can_push: false
      grantee_link: /~canonical-kernel-committers
      grantee_type: Person
    ref_pattern: refs/heads/master
  - grants: &id001
    - can_create: true
      can_force_push: false
      can_push: false
      grantee_link: /~canonical-kernel-committers
      grantee_type: Person
    ref_pattern: refs/tags/Ubuntu-azure-*
  - grants: *id001
    ref_pattern: refs/tags/v4.18*
  - grants:
    - can_create: true
      can_force_push: true
      can_push: true
      grantee_link: /~canonical-kernel-repo-admins
      grantee_type: Person
    - can_create: false
      can_force_push: false
      can_push: false
      grantee_link: null
      grantee_type: Repository owner
    ref_pattern: '*'

Related branches

Colin Watson (cjwatson) on 2019-02-11
tags: added: api git lp-code
Changed in launchpad:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Colin Watson (cjwatson)
Colin Watson (cjwatson) wrote :

It's intended that rule ordering is canonicalised: exact-match rules first in lexicographical order, followed by wildcard rules in the requested order. (The ordering of exact-match rules relative to each other can't matter, it doesn't make sense for them to follow wildcard rules, and it's helpful in some cases to have a canonical ordering.)

However, I forgot to canonicalise the expected ordering in setRules as well, so the end result is (in part) an assertion that the webservice API caller provided the rules in canonical order, which of course isn't appropriate.

Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
Changed in launchpad:
status: In Progress → Fix Committed
Colin Watson (cjwatson) on 2019-02-13
tags: added: qa-ok
removed: qa-needstesting
Colin Watson (cjwatson) on 2019-02-13
Changed in launchpad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers