Formatters ConfigParser NoSectionError
Added logic to fetch the log configuration file from conf path. Closes-bug: #1566567 Change-Id: I0af8d7a77a73e7865976bfb17dddddbc65eab432
This commit is contained in:
parent
8f1e028b53
commit
cf78251b8b
|
@ -12,6 +12,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
''' Provide a global configuration for the TOSCA translator'''
|
''' Provide a global configuration for the TOSCA translator'''
|
||||||
|
import os
|
||||||
|
|
||||||
from six.moves import configparser
|
from six.moves import configparser
|
||||||
|
|
||||||
|
@ -65,3 +66,11 @@ class ConfigProvider(object):
|
||||||
raise exception.ConfSectionNotDefined(section=section)
|
raise exception.ConfSectionNotDefined(section=section)
|
||||||
|
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_translator_logging_file(cls):
|
||||||
|
conf_file = ''
|
||||||
|
CONF_FILENAME = 'heat_translator_logging.conf'
|
||||||
|
conf_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
conf_file = os.path.join(conf_path, CONF_FILENAME)
|
||||||
|
return conf_file
|
||||||
|
|
|
@ -22,11 +22,12 @@ from cliff import command
|
||||||
from toscaparser.tosca_template import ToscaTemplate
|
from toscaparser.tosca_template import ToscaTemplate
|
||||||
from toscaparser.utils.gettextutils import _
|
from toscaparser.utils.gettextutils import _
|
||||||
from translator.common.utils import UrlUtils
|
from translator.common.utils import UrlUtils
|
||||||
|
from translator.conf.config import ConfigProvider
|
||||||
from translator.hot.tosca_translator import TOSCATranslator
|
from translator.hot.tosca_translator import TOSCATranslator
|
||||||
from translator.osc import utils
|
from translator.osc import utils
|
||||||
|
|
||||||
|
conf_file = ConfigProvider.get_translator_logging_file()
|
||||||
logging.config.fileConfig('heat_translator_logging.conf')
|
logging.config.fileConfig(conf_file)
|
||||||
log = logging.getLogger('heat-translator')
|
log = logging.getLogger('heat-translator')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ from toscaparser.tosca_template import ToscaTemplate
|
||||||
from toscaparser.utils.gettextutils import _
|
from toscaparser.utils.gettextutils import _
|
||||||
from toscaparser.utils.urlutils import UrlUtils
|
from toscaparser.utils.urlutils import UrlUtils
|
||||||
from translator.common import utils
|
from translator.common import utils
|
||||||
|
from translator.conf.config import ConfigProvider
|
||||||
from translator.hot.tosca_translator import TOSCATranslator
|
from translator.hot.tosca_translator import TOSCATranslator
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -44,8 +45,8 @@ without actual translation, pass --validate-only=true along with
|
||||||
other required arguments.
|
other required arguments.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
conf_file = ConfigProvider.get_translator_logging_file()
|
||||||
logging.config.fileConfig('heat_translator_logging.conf')
|
logging.config.fileConfig(conf_file)
|
||||||
log = logging.getLogger("heat-translator")
|
log = logging.getLogger("heat-translator")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue