Skip to content

Commit

Permalink
Adds release note for console feature + misc fixes
Browse files Browse the repository at this point in the history
* A release note for the console feature was added.
* Removal of some code handling a case that will never occur.
* Test fix because of ^
* Small flake8 fixes I saw when running tests locally

closes #2548
https://pulp.plan.io/issues/2548
  • Loading branch information
Brian Bouterse committed Mar 17, 2017
1 parent ff1d652 commit 305e2f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 5 additions & 0 deletions docs/user-guide/release-notes/2.13.x.rst
Expand Up @@ -19,6 +19,11 @@ New Features
* serial_number_path is removed from server.conf. Pulp now generates the serial number
randomly and does not use the sn.dat file. This is a part of the fix for :redmine:`1839`

* Console logging added in addition the the syslog default. Choose the logger using the `log_type`
option added to the `[server]` section of `server.conf`. This is especially useful for running
Pulp in container environments which usually do no have syslog. See :redmine:`2548` for more
details.

Bug Fixes
---------

Expand Down
5 changes: 1 addition & 4 deletions server/pulp/server/logs.py
Expand Up @@ -54,11 +54,8 @@ def start_logging(*args, **kwargs):
log_level = DEFAULT_LOG_LEVEL
root_logger = logging.getLogger()
root_logger.setLevel(log_level)
try:
log_type = config.config.get('server', 'log_type')
except (ConfigParser.NoOptionError, AttributeError):
log_type = 'syslog'

log_type = config.config.get('server', 'log_type')
if log_type not in VALID_LOGGERS:
print >> sys.stderr, "log_type not properly set. Defaulting to syslog."
log_type = 'syslog'
Expand Down
5 changes: 1 addition & 4 deletions server/test/unit/server/test_logs.py
Expand Up @@ -3,7 +3,6 @@
This module contains tests for the pulp.server.logs module.
"""
from cStringIO import StringIO
import ConfigParser
import logging
import os
import Queue
Expand Down Expand Up @@ -678,7 +677,6 @@ def console_logging_side_effect(section, key):
return 'INFO'
elif key == 'log_type':
return 'console'
return DEFAULT


class TestStartLogging(unittest.TestCase):
Expand Down Expand Up @@ -765,8 +763,7 @@ def fake_getLogger(name=None):
# We should have used the user's setting
root_logger.setLevel.assert_called_once_with(logging.ERROR)

@mock.patch('pulp.server.logs.config.config.get',
side_effect=ConfigParser.NoOptionError('server', 'log_level'))
@mock.patch('pulp.server.logs.config.config.get', return_value='INFO')
@mock.patch('pulp.server.logs.logging.getLogger')
def test_log_level_unset(self, getLogger, get):
"""
Expand Down

0 comments on commit 305e2f5

Please sign in to comment.