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
|
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
|
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."""
|
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')
|
2014-05-28 23:11:47 -07:00
|
|
|
agent.IronicPythonAgent(CONF.api_url,
|
2016-08-28 18:39:52 -07:00
|
|
|
agent.Host(hostname=CONF.advertise_host,
|
|
|
|
port=CONF.advertise_port),
|
|
|
|
agent.Host(hostname=CONF.listen_host,
|
|
|
|
port=CONF.listen_port),
|
2014-05-30 23:55:34 +00:00
|
|
|
CONF.ip_lookup_attempts,
|
|
|
|
CONF.ip_lookup_sleep,
|
|
|
|
CONF.network_interface,
|
2014-05-28 23:11:47 -07:00
|
|
|
CONF.lookup_timeout,
|
|
|
|
CONF.lookup_interval,
|
2016-05-19 17:21:28 +02:00
|
|
|
CONF.standalone,
|
|
|
|
CONF.hardware_initialization_delay).run()
|