2014-04-09 14:31:31 -07:00
|
|
|
# Copyright 2013 Rackspace, Inc.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2013-09-23 23:29:55 -07:00
|
|
|
|
2015-08-20 10:54:55 -07:00
|
|
|
import sys
|
|
|
|
|
2015-02-07 14:08:23 +08:00
|
|
|
from oslo_config import cfg
|
2015-03-09 23:48:47 +01:00
|
|
|
from oslo_log import log
|
2020-11-11 13:49:02 +01:00
|
|
|
from oslo_service import sslutils
|
2016-02-25 13:54:15 +01:00
|
|
|
from oslo_utils import strutils
|
2014-01-06 12:56:27 -08:00
|
|
|
|
2014-03-19 16:19:52 -07:00
|
|
|
from ironic_python_agent import agent
|
2016-05-25 10:38:45 +01:00
|
|
|
from ironic_python_agent import config
|
2020-11-18 16:48:27 +01:00
|
|
|
from ironic_python_agent import utils
|
2014-03-31 15:02:13 -07:00
|
|
|
|
2014-05-28 23:11:47 -07:00
|
|
|
CONF = cfg.CONF
|
2014-03-31 15:02:13 -07:00
|
|
|
|
|
|
|
|
2013-12-16 15:38:02 -08:00
|
|
|
def run():
|
2015-09-03 16:15:54 -07:00
|
|
|
"""Entrypoint for IronicPythonAgent."""
|
2020-11-18 16:48:27 +01:00
|
|
|
# NOTE(dtantsur): this must happen very early of the files from
|
|
|
|
# /etc/ironic-python-agent.d won't be loaded
|
2023-11-30 10:33:29 +00:00
|
|
|
utils.copy_config_from_vmedia()
|
|
|
|
|
2015-03-09 23:48:47 +01:00
|
|
|
log.register_options(CONF)
|
2015-08-20 10:54:55 -07:00
|
|
|
CONF(args=sys.argv[1:])
|
2016-02-25 13:54:15 +01:00
|
|
|
# Debug option comes from oslo.log, allow overriding it via kernel cmdline
|
2016-05-25 10:38:45 +01:00
|
|
|
ipa_debug = config.APARAMS.get('ipa-debug')
|
2016-02-25 13:54:15 +01:00
|
|
|
if ipa_debug is not None:
|
|
|
|
ipa_debug = strutils.bool_from_string(ipa_debug)
|
|
|
|
CONF.set_override('debug', ipa_debug)
|
2015-03-09 23:48:47 +01:00
|
|
|
log.setup(CONF, 'ironic-python-agent')
|
2020-11-11 13:49:02 +01:00
|
|
|
# Used for TLS configuration
|
|
|
|
sslutils.register_opts(CONF)
|
|
|
|
|
|
|
|
logger = log.getLogger(__name__)
|
|
|
|
logger.debug("Configuration:")
|
|
|
|
CONF.log_opt_values(logger, log.DEBUG)
|
2021-03-30 07:58:34 -07:00
|
|
|
utils.log_early_log_to_logger()
|
2023-12-13 16:44:49 +01:00
|
|
|
agent.IronicPythonAgent.from_config(CONF).run()
|