← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2092659] Re: NoneType' object has no attribute 'registered_rules'

 

Reviewed:  https://review.opendev.org/c/openstack/neutron/+/938640
Committed: https://opendev.org/openstack/neutron/commit/08afd36e549892e35be7356547fd7b525cae0bb3
Submitter: "Zuul (22348)"
Branch:    master

commit 08afd36e549892e35be7356547fd7b525cae0bb3
Author: Slawek Kaplonski <skaplons@xxxxxxxxxx>
Date:   Wed Jan 8 11:05:29 2025 +0100

    Make sure that policy enforcer is initialized before use
    
    In some cases policy.enforce() or policy.check() functions were called
    without calling policy.init() before and that could lead to errors like
    mentioned in the related bug.
    To avoid that and to make it less error prone in future, this patch
    moves call of the policy.init() method directly to the enforce() and
    check() methods and removes it from all other places. Other modules
    should not need to carry about policy initialization at all.
    
    Closes-Bug: #2092659
    Change-Id: Ic11992ba3ed91980189efbacdc2a54fba64fcf7c


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/2092659

Title:
  NoneType' object has no attribute 'registered_rules'

Status in neutron:
  Fix Released

Bug description:
  While opening Admin -> Networks section in Horizon, there are some
  errors in neutron serverlogs:

  2024-12-29 14:30:46.258 1988956 INFO neutron.api.wsgi [None req-228c8948-38de-4786-a90c-0c8f685b515e 39ef1840d2d14de49ba16ac7e11ec2c4 b6f178e22d304f99a905c31f0e374587 - - default default] 10.0.0.2 "GET /v2.0/networks/992fc508-4215-4318-86f8-1bb38cb4e502/dhcp-agents HTTP/1.1" status: 500  len: 368 time: 0.0028458
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource [None req-a3e36258-171d-4b7b-b94f-3681270774b4 39ef1840d2d14de49ba16ac7e11ec2c4 b6f178e22d304f99a905c31f0e374587 - - default default] index failed: No details.: AttributeError: 'NoneType' object has no attribute 'registered_rules'
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource Traceback (most recent call last):
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource   File "/usr/lib/python3.9/site-packages/neutron/api/v2/resource.py", line 97, in resource
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource     result = method(request=request, **args)
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource   File "/usr/lib/python3.9/site-packages/neutron/extensions/dhcpagentscheduler.py", line 72, in index
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource     policy.enforce(request.context,
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource   File "/usr/lib/python3.9/site-packages/neutron/policy.py", line 521, in enforce
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource     rule, target, context = _prepare_check(context, action, target, pluralized)
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource   File "/usr/lib/python3.9/site-packages/neutron/policy.py", line 448, in _prepare_check
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource     match_rule = _build_match_rule(action, target, pluralized)
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource   File "/usr/lib/python3.9/site-packages/neutron/policy.py", line 210, in _build_match_rule
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource     registered_rule = _ENFORCER.registered_rules.get(action)
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource AttributeError: 'NoneType' object has no attribute 'registered_rules'
  2024-12-29 14:30:46.266 1988956 ERROR neutron.api.v2.resource

  OpenStack version: 2024.2 Dalmatian
  OS: AlmaLinux 9.5

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2092659/+subscriptions



References