Log configuration options on start-up

This is very convenient for debugging and is something ironic and
ironic-inspector already do.

Register SSL options earlier so that they're accounted for.

Change-Id: I56aca8eec1dfeb065ac657452a7076a9e3d17cc3
This commit is contained in:
Dmitry Tantsur 2020-11-11 13:49:02 +01:00
parent 1f590ea382
commit c585603ee6
3 changed files with 10 additions and 2 deletions

View File

@ -16,7 +16,6 @@ import json
from ironic_lib import metrics_utils
from oslo_log import log
from oslo_service import sslutils
from oslo_service import wsgi
import werkzeug
from werkzeug import exceptions as http_exc
@ -130,7 +129,6 @@ class Application(object):
def start(self, tls_cert_file=None, tls_key_file=None):
"""Start the API service in the background."""
if tls_cert_file and tls_key_file:
sslutils.register_opts(self._conf)
self._conf.set_override('cert_file', tls_cert_file, group='ssl')
self._conf.set_override('key_file', tls_key_file, group='ssl')
use_tls = True

View File

@ -16,6 +16,7 @@ import sys
from oslo_config import cfg
from oslo_log import log
from oslo_service import sslutils
from oslo_utils import strutils
from ironic_python_agent import agent
@ -34,6 +35,13 @@ def run():
ipa_debug = strutils.bool_from_string(ipa_debug)
CONF.set_override('debug', ipa_debug)
log.setup(CONF, 'ironic-python-agent')
# Used for TLS configuration
sslutils.register_opts(CONF)
logger = log.getLogger(__name__)
logger.debug("Configuration:")
CONF.log_opt_values(logger, log.DEBUG)
agent.IronicPythonAgent(CONF.api_url,
agent.Host(hostname=CONF.advertise_host,
port=CONF.advertise_port),

View File

@ -20,6 +20,7 @@ from ironic_lib import exception as lib_exc
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_serialization import jsonutils
from oslo_service import sslutils
import pkg_resources
from stevedore import extension
@ -837,6 +838,7 @@ class TestAgentStandalone(ironic_agent_base.IronicAgentTest):
def setUp(self):
super(TestAgentStandalone, self).setUp()
sslutils.register_opts(CONF)
self.agent = agent.IronicPythonAgent('https://fake_api.example.'
'org:8081/',
agent.Host(hostname='203.0.113.1',