Merge lp:~joetalbott/adt-cloud-worker/add_log_rotation into lp:adt-cloud-worker

Proposed by Joe Talbott
Status: Merged
Approved by: Joe Talbott
Approved revision: 36
Merged at revision: 34
Proposed branch: lp:~joetalbott/adt-cloud-worker/add_log_rotation
Merge into: lp:adt-cloud-worker
Diff against target: 83 lines (+16/-5)
5 files modified
adt_cloud_worker/__init__.py (+7/-2)
adt_cloud_worker/tests/test_cloud_worker.py (+2/-1)
called-by-tarmac.py (+5/-0)
setup.py (+1/-2)
test_requirements.txt (+1/-0)
To merge this branch: bzr merge lp:~joetalbott/adt-cloud-worker/add_log_rotation
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+256245@code.launchpad.net

Commit message

Add log rotation and flake8 checking. Fix flake8 issues as well.

Description of the change

Add log rotation and flake8 checking. Fix flake8 issues as well.

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'adt_cloud_worker/__init__.py'
2--- adt_cloud_worker/__init__.py 2015-03-24 01:55:25 +0000
3+++ adt_cloud_worker/__init__.py 2015-04-14 22:36:38 +0000
4@@ -138,7 +138,8 @@
5
6
7 def _create_run_metadata_file(directory, request):
8- """Create a metadata file in 'directory' with some of the data from 'request'
9+ """Create a metadata file in 'directory' with some of the data from
10+ 'request'.
11
12 We want to make sure that, as (potentially confidential) items are added to
13 the request that we don't blindly add them to the metadata file, so we
14@@ -273,7 +274,11 @@
15 os.path.join(__file__, '../../logs/adt-cloud-worker.log'))
16 log_dir = os.path.dirname(log_path)
17 if os.path.exists(log_dir):
18- handler = logging.FileHandler(log_path)
19+ handler = logging.handlers.TimedRotatingFileHandler(
20+ log_path,
21+ when='D',
22+ interval=1
23+ )
24 else:
25 print("'logs' directory '{}' does not exist, using stderr "
26 "for app log.".format(log_dir))
27
28=== modified file 'adt_cloud_worker/tests/test_cloud_worker.py'
29--- adt_cloud_worker/tests/test_cloud_worker.py 2015-03-19 03:08:53 +0000
30+++ adt_cloud_worker/tests/test_cloud_worker.py 2015-04-14 22:36:38 +0000
31@@ -147,7 +147,8 @@
32 class TarballCreationTests(testtools.TestCase):
33
34 def create_tarball_with_cleanup(self, directory_to_tar, tarball_root):
35- tarball_path = _create_tarball_from_directory(directory_to_tar, tarball_root)
36+ tarball_path = _create_tarball_from_directory(directory_to_tar,
37+ tarball_root)
38 self.addCleanup(os.remove, tarball_path)
39 return tarball_path
40
41
42=== modified file 'called-by-tarmac.py'
43--- called-by-tarmac.py 2015-03-17 15:07:36 +0000
44+++ called-by-tarmac.py 2015-04-14 22:36:38 +0000
45@@ -89,6 +89,11 @@
46 'setup.py',
47 'test',
48 ],
49+ [
50+ os.path.join(ve_dir, 'bin', 'python3'),
51+ 'setup.py',
52+ 'flake8',
53+ ],
54 )
55 for cmd in all_cmds:
56 ret = _run_command(cmd)
57
58=== modified file 'setup.py'
59--- setup.py 2015-03-04 04:21:56 +0000
60+++ setup.py 2015-04-14 22:36:38 +0000
61@@ -21,13 +21,12 @@
62 import sys
63 assert sys.version_info >= (3,), 'Python 3 is required'
64
65-from setuptools import find_packages, setup, Extension
66+from setuptools import find_packages, setup
67
68
69 VERSION = '1.0.0'
70
71
72-
73 setup(
74 name='adt-cloud-worker',
75 version=VERSION,
76
77=== modified file 'test_requirements.txt'
78--- test_requirements.txt 2015-03-04 21:44:54 +0000
79+++ test_requirements.txt 2015-04-14 22:36:38 +0000
80@@ -1,3 +1,4 @@
81 testtools
82 fixtures
83+flake8==2.4.0
84

Subscribers

People subscribed via source and target branches