Skip to content

Commit a2739f7

Browse files
committed
Vendor own option for tls cert file and key file
... instead of using oslo.service. Current usage of oslo.service is too limited to add the dependency, because - oslo.service registers multiple options but only two of these are used - the wrap implementation from oslo.service is not actually used Change-Id: I4e8f18951d73e329a54cf6546344c5704fe4aa90 Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
1 parent 883e3cf commit a2739f7

6 files changed

Lines changed: 23 additions & 17 deletions

File tree

ironic_python_agent/api/app.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,8 @@ def __call__(self, environ, start_response):
131131
def start(self, tls_cert_file=None, tls_key_file=None):
132132
"""Start the API service in the background."""
133133

134-
ssl_group = getattr(self._conf, 'ssl', {})
135-
136-
self.tls_cert_file = tls_cert_file or getattr(
137-
ssl_group, 'cert_file', None)
138-
self.tls_key_file = tls_key_file or getattr(
139-
ssl_group, 'key_file', None)
134+
self.tls_cert_file = tls_cert_file or self._conf.tls_cert_file
135+
self.tls_key_file = tls_key_file or self._conf.tls_key_file
140136

141137
bind_addr = (self.agent.listen_address.hostname,
142138
self.agent.listen_address.port)

ironic_python_agent/cmd/agent.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
from oslo_config import cfg
1818
from oslo_log import log
19-
from oslo_service import sslutils
2019
from oslo_utils import strutils
2120

2221
from ironic_python_agent import agent
@@ -40,8 +39,6 @@ def run():
4039
ipa_debug = strutils.bool_from_string(ipa_debug)
4140
CONF.set_override('debug', ipa_debug)
4241
log.setup(CONF, 'ironic-python-agent')
43-
# Used for TLS configuration
44-
sslutils.register_opts(CONF)
4542

4643
logger = log.getLogger(__name__)
4744
logger.debug("Configuration:")

ironic_python_agent/config.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,26 @@
6060
'Can be supplied as "ipa-listen-port" kernel parameter.'),
6161

6262
# This is intentionally not settable via kernel command line, as it
63-
# requires configuration parameters from oslo_service which are not
64-
# configurable over the command line and require files-on-disk.
63+
# requires configuration parameters which are not configurable over
64+
# the command line and require files-on-disk.
6565
# Operators who want to use this support should configure it statically
6666
# as part of a ramdisk build.
6767
cfg.BoolOpt('listen_tls',
6868
default=False,
6969
help='When true, IPA will host API behind TLS. You will also '
70-
'need to configure [ssl] group options for cert_file, '
71-
'key_file, and, if desired, ca_file to validate client '
72-
'certificates.'),
70+
'need to configure tls_cert_file option and tls_key_file '
71+
'option.'),
72+
73+
cfg.StrOpt('tls_cert_file',
74+
help="Certificate file to use when starting "
75+
"the server securely.",
76+
deprecated_group='ssl',
77+
deprecated_name='cert_file'),
78+
cfg.StrOpt('tls_key_file',
79+
help="Private key file to use when starting "
80+
"the server securely.",
81+
deprecated_group='ssl',
82+
deprecated_name='key_file'),
7383

7484
cfg.BoolOpt('enable_auto_tls',
7585
default=True,

ironic_python_agent/tests/unit/base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from oslo_config import cfg
2222
from oslo_config import fixture as config_fixture
2323
from oslo_log import log
24-
from oslo_service import sslutils
2524
from oslotest import base as test_base
2625

2726
from ironic_python_agent import config
@@ -70,7 +69,6 @@ def _set_config(self):
7069
self.cfg_fixture = self.useFixture(config_fixture.Config(CONF))
7170
# Register options from libraries that are explicitly used in the code
7271
log.register_options(CONF)
73-
sslutils.register_opts(CONF)
7472

7573
def config(self, **kw):
7674
"""Override config options for a test."""
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
deprecations:
3+
- |
4+
The ``[ssl] key_file`` option and the ``[ssl] cert_file`` option are
5+
deprecated. Use the ``[DEFAULT] tls_key_file`` option and
6+
the ``[DEFAULT] tls_cert_file`` option instead.

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ pbr>=6.0.0 # Apache-2.0
22
oslo.config>=9.7.1 # Apache-2.0
33
oslo.concurrency>=7.1.0 # Apache-2.0
44
oslo.log>=7.1.0 # Apache-2.0
5-
oslo.service>=4.1.1 # Apache-2.0
65
oslo.utils>=8.2.0 # Apache-2.0
76
Pint>=0.5 # BSD
87
psutil>=3.2.2 # BSD

0 commit comments

Comments
 (0)