Make reviewday.json world readable.

Because we were using a python tempfile the reviewday.json
file was readable/writable only by the user that runs
bin/reviewday. Ideally this file would be world readable so
that Apache can host it properly.

In this commit we drop the use of python tempfile in
favor of just plain old open() which respects the
normal file permission settings.

This should fix a Forbidden access error I get when
trying to access http://status.openstack.org/reviews/reviewday.json
today.

Closes-bug: #1273833

Change-Id: I9e9a76e29f5c71f2496eef96a6dbf2496c42d973
This commit is contained in:
Dan Prince 2014-02-11 10:34:35 -05:00
parent ad588336ac
commit 80b63eced6
1 changed files with 1 additions and 2 deletions

View File

@ -1,6 +1,5 @@
import json
import os
import tempfile
import html_helper
from Cheetah.Template import Template
from distutils.dir_util import copy_tree
@ -32,7 +31,7 @@ def _create_json(out_dir, name_space={}):
'feedback': {'lowest': mp.lowest_feedback,
'highest': mp.highest_feedback, }, }
with tempfile.NamedTemporaryFile(dir=out_dir, delete=False) as f:
with open(os.path.join(out_dir, 'reviewday.json.tmp'), "w") as f:
json.dump(data, f, indent=2)
os.rename(f.name, os.path.join(out_dir, 'reviewday.json'))