Use oslo.log for osc plugin

If we do not use oslo.log for logging in the openstackclient plugin, all
the errors and messages that are generated by other parts of the client
(cliff, openstackclient) may be lost.

Change-Id: Ie9aec900e477f3f319ee34873018c15e10dafb4a
This commit is contained in:
Alvaro Lopez Garcia 2018-09-24 08:21:32 +02:00
parent be7d6617c3
commit ef32ac6991
3 changed files with 7 additions and 8 deletions

View File

@ -41,6 +41,7 @@ os-client-config==1.28.0
os-service-types==1.2.0
osc-lib==1.8.0
oslo.i18n==3.15.3
oslo.log==3.36.0
oslo.serialization==2.18.0
oslo.utils==3.33.0
oslosphinx==4.7.0

View File

@ -13,3 +13,5 @@ python-novaclient>=9.1.0 # Apache-2.0
python-heatclient>=1.10.0 # Apache-2.0
python-glanceclient>=2.8.0 # Apache-2.0
requests>=2.14.2 # Apache-2.0
oslo.log>=3.36.0 # Apache-2.0

View File

@ -12,25 +12,21 @@
"""Translate action implementations"""
import logging
import logging.config
import os
import sys
from cliff import command
from oslo_log import log as logging
from toscaparser.tosca_template import ToscaTemplate
from toscaparser.utils.gettextutils import _
from translator.common import flavors
from translator.common import images
from translator.common.utils import UrlUtils
from translator.conf.config import ConfigProvider
from translator.hot.tosca_translator import TOSCATranslator
from translator.osc import utils
conf_file = ConfigProvider.get_translator_logging_file()
logging.config.fileConfig(conf_file)
log = logging.getLogger('heat-translator')
LOG = logging.getLogger('heat-translator')
class TranslateTemplate(command.Command):
@ -71,7 +67,7 @@ class TranslateTemplate(command.Command):
return parser
def take_action(self, parsed_args):
log.debug(_('Translating the template with input parameters'
LOG.debug(_('Translating the template with input parameters'
'(%s).'), parsed_args)
output = None
@ -101,7 +97,7 @@ class TranslateTemplate(command.Command):
output = translator.translate()
else:
msg = _('Could not find template file.\n')
log.error(msg)
LOG.error(msg)
sys.stdout.write(msg)
raise SystemExit