← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1781976] [NEW] Issues with oslo.policy 1.38.0

 

Public bug reported:

There was recently a few changes to oslo.policy that allow for more
flexibility when enforcing policy [0]. These changes were included in
the 1.38.0 release of oslo.policy, which is cause glance unit tests to
fail when updating the requirements for oslo.policy [1]

I was able to recreate this locally by:

1.) running glance unit tests
2.) installing oslo.policy 1.38.0 ($ .tox/py27/bin/pip install oslo.policy===1.38.0)
3.) Rerunning unit tests with the new version of oslo.policy

The following is a trace from a failing unit test in glance:

      File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 247, in run
        for _state in self.run_iter(timeout=timeout):
      File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 328, in run_iter
        self._change_state(states.FAILURE)
      File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
        self.force_reraise()
      File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
        six.reraise(self.type_, self.value, self.tb)
      File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 300, in run_iter
        failure.Failure.reraise_if_any(memory.failures)
      File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/types/failure.py", line 339, in reraise_if_any
        failures[0].reraise()
      File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/types/failure.py", line 346, in reraise
        six.reraise(*self._exc_info)
      File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/engines/action_engine/executor.py", line 72, in _revert_task
        result = task.revert(**arguments)
      File "glance/async/flows/base_import.py", line 82, in revert
        image.delete()
      File "glance/domain/proxy.py", line 186, in delete
        self.base.delete()
      File "glance/domain/proxy.py", line 186, in delete
        self.base.delete()
      File "glance/api/policy.py", line 171, in delete
        self.policy.enforce(self.context, 'delete_image', dict(self.target))
      File "glance/api/policy.py", line 68, in enforce
        action=action)
      File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/oslo_policy/policy.py", line 835, in enforce
        raise InvalidContextObject(msg)
    oslo_policy.policy.InvalidContextObject: Invalid context object: Expected type oslo_context.context.RequestContext, dict, or  the output of oslo_context.context.RequestContext.to_policy_values but got <class 'mock.mock.MagicMock'> instead.
    

[0] https://review.openstack.org/#/c/578995/
[1] https://review.openstack.org/#/c/582418/

** Affects: glance
     Importance: Undecided
         Status: New

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

Title:
  Issues with oslo.policy 1.38.0

Status in Glance:
  New

Bug description:
  There was recently a few changes to oslo.policy that allow for more
  flexibility when enforcing policy [0]. These changes were included in
  the 1.38.0 release of oslo.policy, which is cause glance unit tests to
  fail when updating the requirements for oslo.policy [1]

  I was able to recreate this locally by:

  1.) running glance unit tests
  2.) installing oslo.policy 1.38.0 ($ .tox/py27/bin/pip install oslo.policy===1.38.0)
  3.) Rerunning unit tests with the new version of oslo.policy

  The following is a trace from a failing unit test in glance:

        File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 247, in run
          for _state in self.run_iter(timeout=timeout):
        File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 328, in run_iter
          self._change_state(states.FAILURE)
        File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
          self.force_reraise()
        File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
          six.reraise(self.type_, self.value, self.tb)
        File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 300, in run_iter
          failure.Failure.reraise_if_any(memory.failures)
        File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/types/failure.py", line 339, in reraise_if_any
          failures[0].reraise()
        File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/types/failure.py", line 346, in reraise
          six.reraise(*self._exc_info)
        File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/taskflow/engines/action_engine/executor.py", line 72, in _revert_task
          result = task.revert(**arguments)
        File "glance/async/flows/base_import.py", line 82, in revert
          image.delete()
        File "glance/domain/proxy.py", line 186, in delete
          self.base.delete()
        File "glance/domain/proxy.py", line 186, in delete
          self.base.delete()
        File "glance/api/policy.py", line 171, in delete
          self.policy.enforce(self.context, 'delete_image', dict(self.target))
        File "glance/api/policy.py", line 68, in enforce
          action=action)
        File "/opt/stack/glance/.tox/py27/local/lib/python2.7/site-packages/oslo_policy/policy.py", line 835, in enforce
          raise InvalidContextObject(msg)
      oslo_policy.policy.InvalidContextObject: Invalid context object: Expected type oslo_context.context.RequestContext, dict, or  the output of oslo_context.context.RequestContext.to_policy_values but got <class 'mock.mock.MagicMock'> instead.
      

  [0] https://review.openstack.org/#/c/578995/
  [1] https://review.openstack.org/#/c/582418/

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


Follow ups