Merge lp:~thomir-deactivatedaccount/core-image-publisher/trunk-use-uservice-utils into lp:core-image-publisher

Proposed by Thomi Richards
Status: Merged
Approved by: Thomi Richards
Approved revision: 23
Merged at revision: 22
Proposed branch: lp:~thomir-deactivatedaccount/core-image-publisher/trunk-use-uservice-utils
Merge into: lp:core-image-publisher
Diff against target: 81 lines (+9/-43)
2 files modified
core_image_publisher/__init__.py (+8/-43)
requirements.txt (+1/-0)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/core-image-publisher/trunk-use-uservice-utils
Reviewer Review Type Date Requested Status
Joe Talbott (community) Approve
Review via email: mp+254994@code.launchpad.net

Commit message

Use the new logging functions in uservice_utils.

Description of the change

Use the new logging functions in uservice_utils.

To post a comment you must log in.
Revision history for this message
Joe Talbott (joetalbott) wrote :

One in-line nit. Otherwise looks good.

review: Approve
Revision history for this message
Ubuntu CI Bot (uci-bot) wrote :
Download full text (23.4 KiB)

The attempt to merge lp:~thomir/core-image-publisher/trunk-use-uservice-utils into lp:core-image-publisher failed. Below is the output from the failed tests.

Using base prefix '/usr'
New python executable in /tmp/venv-core-image-publisher58vqgpxc/bin/python3
Also creating executable in /tmp/venv-core-image-publisher58vqgpxc/bin/python
Installing setuptools, pip...done.
Running virtualenv with interpreter /usr/bin/python3
Ignoring indexes: https://pypi.python.org/simple/
Downloading/unpacking cffi (from -r requirements.txt (line 5))
  Running setup.py (path:/tmp/venv-core-image-publisher58vqgpxc/build/cffi/setup.py) egg_info for package cffi

Downloading/unpacking pyasn1 (from -r requirements.txt (line 6))
  Running setup.py (path:/tmp/venv-core-image-publisher58vqgpxc/build/pyasn1/setup.py) egg_info for package pyasn1

Downloading/unpacking kombu==3.0.24 (from -r requirements.txt (line 7))
Downloading/unpacking python-logstash==0.4.2 (from -r requirements.txt (line 8))
  Running setup.py (path:/tmp/venv-core-image-publisher58vqgpxc/build/python-logstash/setup.py) egg_info for package python-logstash

Downloading/unpacking python-glanceclient==0.17.0 (from -r requirements.txt (line 9))
Downloading/unpacking uservice-utils==1.0.0 (from -r requirements.txt (line 10))
Downloading/unpacking pycparser (from cffi->-r requirements.txt (line 5))
  Running setup.py (path:/tmp/venv-core-image-publisher58vqgpxc/build/pycparser/setup.py) egg_info for package pycparser

Downloading/unpacking amqp>=1.4.5,<2.0 (from kombu==3.0.24->-r requirements.txt (line 7))
  Running setup.py (path:/tmp/venv-core-image-publisher58vqgpxc/build/amqp/setup.py) egg_info for package amqp

Downloading/unpacking anyjson>=0.3.3 (from kombu==3.0.24->-r requirements.txt (line 7))
  Running setup.py (path:/tmp/venv-core-image-publisher58vqgpxc/build/anyjson/setup.py) egg_info for package anyjson

Downloading/unpacking six>=1.7.0 (from python-glanceclient==0.17.0->-r requirements.txt (line 9))
Downloading/unpacking oslo.i18n>=1.3.0 (from python-glanceclient==0.17.0->-r requirements.txt (line 9))
Downloading/unpacking argparse (from python-glanceclient==0.17.0->-r requirements.txt (line 9))
Downloading/unpacking pyOpenSSL>=0.11 (from python-glanceclient==0.17.0->-r requirements.txt (line 9))
  Running setup.py (path:/tmp/venv-core-image-publisher58vqgpxc/build/pyOpenSSL/setup.py) egg_info for package pyOpenSSL

    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    no previously-included directories found matching 'doc/_build'
Downloading/unpacking requests>=2.2.0,!=2.4.0 (from python-glanceclient==0.17.0->-r requirements.txt (line 9))
Downloading/unpacking PrettyTable>=0.7,<0.8 (from python-glanceclient==0.17.0->-r requirements.txt (line 9))
  Running setup.py (path:/tmp/venv-core-image-publisher58vqgpxc/build/PrettyTable/setup.py) egg_info for package PrettyTable

Downloading/unpacking pbr>=0.6,!=0.7,<1.0 (from python-glanceclient==0.17.0->-r requirements.txt (line 9))
Downloading/unpacking Babel>=1.3 (from python-glanceclient==0.17.0->-r requirements.txt (line 9))
  Running setup.py (path:/tmp/venv-core-image-p...

23. By Thomi Richards

Fix flake8 errors.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'core_image_publisher/__init__.py'
2--- core_image_publisher/__init__.py 2015-03-31 16:45:10 +0000
3+++ core_image_publisher/__init__.py 2015-04-01 21:15:31 +0000
4@@ -17,11 +17,9 @@
5
6 import argparse
7 import configparser
8-import logging
9-import logging.handlers
10 import os
11
12-import logstash
13+from uservice_utils.logging import configure_service_logging
14
15 from core_image_publisher.queue import (
16 create_connection_from_config,
17@@ -47,48 +45,15 @@
18 return config
19
20
21-def configure_logging(config):
22- root_logger = logging.getLogger()
23- root_logger.setLevel(logging.INFO)
24-
25- # glanceclient & keystoneclient use requests, which logs for every
26- # new HTTP connection, so let's make it a little less chatty:
27- logging.getLogger('requests').setLevel(logging.WARNING)
28-
29- # If there is no ./logs directory, fallback to stderr.
30- log_path = os.path.abspath(
31- os.path.join(__file__, '../../logs/core-image-publisher.log'))
32- log_dir = os.path.dirname(log_path)
33- if os.path.exists(log_dir):
34- handler = logging.handlers.TimedRotatingFileHandler(
35- log_path,
36- when='D',
37- interval=1
38- )
39- else:
40- print("'logs' directory '{}' does not exist, using stderr "
41- "for app log.".format(log_dir))
42- handler = logging.StreamHandler()
43-
44- handler.setFormatter(
45- logging.Formatter(
46- '%(asctime)s %(name)s %(levelname)s: %(message)s'
47- )
48- )
49- root_logger.addHandler(handler)
50- if 'logstash' in config:
51- root_logger.addHandler(
52- logstash.LogstashHandler(
53- config['logstash']['host'],
54- int(config['logstash']['port']),
55- int(config['logstash']['version'])
56- )
57- )
58-
59-
60 def main():
61 config = read_config()
62- configure_logging(config)
63+ log_path = os.path.abspath(
64+ os.path.join(__file__, '../../logs/core-image-publisher.log')
65+ )
66+ configure_service_logging(
67+ log_path,
68+ config['logstash'] if 'logstash' in config else None
69+ )
70 connection = create_connection_from_config(config)
71 try:
72 with connection:
73
74=== modified file 'requirements.txt'
75--- requirements.txt 2015-03-30 22:11:38 +0000
76+++ requirements.txt 2015-04-01 21:15:31 +0000
77@@ -7,3 +7,4 @@
78 kombu==3.0.24
79 python-logstash==0.4.2
80 python-glanceclient==0.17.0
81+uservice-utils==1.0.0

Subscribers

People subscribed via source and target branches

to all changes: