Merge lp:~soren/nova/logdir-flag into lp:~hudson-openstack/nova/trunk

Proposed by Soren Hansen
Status: Merged
Approved by: Soren Hansen
Approved revision: 413
Merged at revision: 415
Proposed branch: lp:~soren/nova/logdir-flag
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 43 lines (+8/-0)
2 files modified
nova/server.py (+4/-0)
nova/twistd.py (+4/-0)
To merge this branch: bzr merge lp:~soren/nova/logdir-flag
Reviewer Review Type Date Requested Status
Jay Pipes (community) Approve
Eric Day (community) Approve
Review via email: mp+41590@code.launchpad.net

Description of the change

Add a --logdir flag that will be prepended to the logfile setting. This makes it easier to share a flagfile between multiple workers while still having separate log files.

To post a comment you must log in.
Revision history for this message
Eric Day (eday) wrote :

lgtm!

review: Approve
Revision history for this message
Jay Pipes (jaypipes) wrote :

yup, lgtm. one more thing that should be going into openstack.common :)

review: Approve
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

The attempt to merge lp:~soren/nova/logdir-flag into lp:nova failed. Below is the output from the failed tests.

nova/server.py:45:80: E501 line too long (102 characters)
flags.DEFINE_string('logdir', None, 'directory to keep log files in (will be prepended to $logfile)')
                                                                               ^
    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to have
    several windows side-by-side. The default wrapping on such devices looks
    ugly. Therefore, please limit all lines to a maximum of 79 characters.
    For flowing long blocks of text (docstrings or comments), limiting the
    length to 72 characters is recommended.
nova/twistd.py:46:80: E501 line too long (102 characters)
flags.DEFINE_string('logdir', None, 'directory to keep log files in (will be prepended to $logfile)')
                                                                               ^
    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to have
    several windows side-by-side. The default wrapping on such devices looks
    ugly. Therefore, please limit all lines to a maximum of 79 characters.
    For flowing long blocks of text (docstrings or comments), limiting the
    length to 72 characters is recommended.
nova/twistd.py:48:1: E302 expected 2 blank lines, found 1
class TwistdServerOptions(ServerOptions):
^
    Separate top-level function and class definitions with two blank lines.

    Method definitions inside a class are separated by a single blank line.

    Extra blank lines may be used (sparingly) to separate groups of related
    functions. Blank lines may be omitted between a bunch of related
    one-liners (e.g. a set of dummy implementations).

    Use blank lines in functions, sparingly, to indicate logical sections.

    Okay: def a():\n pass\n\n\ndef b():\n pass
    Okay: def a():\n pass\n\n\n# Foo\n# Bar\n\ndef b():\n pass

    E301: class Foo:\n b = 0\n def bar():\n pass
    E302: def a():\n pass\n\ndef b(n):\n pass
    E303: def a():\n pass\n\n\n\ndef b(n):\n pass
    E303: def a():\n\n\n\n pass
    E304: @decorator\n\ndef a():\n pass

lp:~soren/nova/logdir-flag updated
413. By Soren Hansen

Address PEP8 complaints.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nova/server.py'
--- nova/server.py 2010-10-21 18:49:51 +0000
+++ nova/server.py 2010-11-23 20:54:09 +0000
@@ -42,6 +42,8 @@
42# clutter.42# clutter.
43flags.DEFINE_bool('use_syslog', True, 'output to syslog when daemonizing')43flags.DEFINE_bool('use_syslog', True, 'output to syslog when daemonizing')
44flags.DEFINE_string('logfile', None, 'log file to output to')44flags.DEFINE_string('logfile', None, 'log file to output to')
45flags.DEFINE_string('logdir', None, 'directory to keep log files in '
46 '(will be prepended to $logfile)')
45flags.DEFINE_string('pidfile', None, 'pid file to output to')47flags.DEFINE_string('pidfile', None, 'pid file to output to')
46flags.DEFINE_string('working_directory', './', 'working directory...')48flags.DEFINE_string('working_directory', './', 'working directory...')
47flags.DEFINE_integer('uid', os.getuid(), 'uid under which to run')49flags.DEFINE_integer('uid', os.getuid(), 'uid under which to run')
@@ -119,6 +121,8 @@
119 else:121 else:
120 if not FLAGS.logfile:122 if not FLAGS.logfile:
121 FLAGS.logfile = '%s.log' % name123 FLAGS.logfile = '%s.log' % name
124 if FLAGS.logdir:
125 FLAGS.logfile = os.path.join(FLAGS.logdir, FLAGS.logfile)
122 logfile = logging.FileHandler(FLAGS.logfile)126 logfile = logging.FileHandler(FLAGS.logfile)
123 logfile.setFormatter(formatter)127 logfile.setFormatter(formatter)
124 logger.addHandler(logfile)128 logger.addHandler(logfile)
125129
=== modified file 'nova/twistd.py'
--- nova/twistd.py 2010-10-21 18:49:51 +0000
+++ nova/twistd.py 2010-11-23 20:54:09 +0000
@@ -43,6 +43,8 @@
4343
4444
45FLAGS = flags.FLAGS45FLAGS = flags.FLAGS
46flags.DEFINE_string('logdir', None, 'directory to keep log files in '
47 '(will be prepended to $logfile)')
4648
4749
48class TwistdServerOptions(ServerOptions):50class TwistdServerOptions(ServerOptions):
@@ -246,6 +248,8 @@
246 FLAGS.logfile = '%s.log' % name248 FLAGS.logfile = '%s.log' % name
247 elif FLAGS.logfile.endswith('twistd.log'):249 elif FLAGS.logfile.endswith('twistd.log'):
248 FLAGS.logfile = FLAGS.logfile.replace('twistd.log', '%s.log' % name)250 FLAGS.logfile = FLAGS.logfile.replace('twistd.log', '%s.log' % name)
251 if FLAGS.logdir:
252 FLAGS.logfile = os.path.join(FLAGS.logdir, FLAGS.logfile)
249 if not FLAGS.prefix:253 if not FLAGS.prefix:
250 FLAGS.prefix = name254 FLAGS.prefix = name
251 elif FLAGS.prefix.endswith('twisted'):255 elif FLAGS.prefix.endswith('twisted'):