Permission denied: '/etc/glance/policy.json' when running tests

Bug #1098687 reported by Dan Prince
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Mark Washenberger
Grizzly
Fix Released
Medium
Mark Washenberger

Bug Description

I'm seeing the following error when running Glance's unit tests on my laptop:

======================================================================
ERROR: Missing default policy file should result in a default ruleset
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dprince/projects/glance/glance/tests/unit/test_policy.py", line 134, in test_policy_file_default_not_found
    enforcer.enforce(context, 'get_image', {})
  File "/home/dprince/projects/glance/glance/api/policy.py", line 132, in enforce
    exception.Forbidden, action=action)
  File "/home/dprince/projects/glance/glance/api/policy.py", line 112, in _check
    self.load_rules()
  File "/home/dprince/projects/glance/glance/api/policy.py", line 64, in load_rules
    rules = self._read_policy_file()
  File "/home/dprince/projects/glance/glance/api/policy.py", line 94, in _read_policy_file
    with open(self.policy_path) as fap:
IOError: [Errno 13] Permission denied: '/etc/glance/policy.json'

-----------

The issue appears to be due to the fact that I *also* have the openstack-glance RPM installed (which creates an /etc/glance/policy.json file that I can read).

Dan Prince (dan-prince)
Changed in glance:
assignee: nobody → Dan Prince (dan-prince)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/19475

Changed in glance:
assignee: Dan Prince (dan-prince) → Mark Washenberger (markwash)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/19475
Committed: http://github.com/openstack/glance/commit/8726801d89dbaa116810318ea226a4693a68a8ca
Submitter: Jenkins
Branch: master

commit 8726801d89dbaa116810318ea226a4693a68a8ca
Author: Dan Prince <email address hidden>
Date: Fri Jan 11 14:18:30 2013 -0500

    Stub out find_file... fix policy.json test issue.

    Updates test_policy.py so that we stub out find_file
    which is used to find the *default* policy file. This
    fixes an issue in the test_policy_file_default_not_found
    test where it *may* fail when executed on a machine with
    Glance package(s) installed (thus created a file in /etc/glance/
    that isn't readable by the test user).

    Fixes LP Bug #1098687.

    Change-Id: If2912d40608ffb07f457454fdc6ebc56c62f6eaf

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → grizzly-3
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.