Fail IPA startup if no protocol prefix in ironic api address

Add regex validation of api_url specified in configuration file.
Oslo config will raise exception if no supported protocol prefix
is included in Ironic api address in configuration file.
Supported protocols are http and https.

Closes-Bug: #1630785
Change-Id: I437b4ea0a2995921ddede03bc670087fdbbc8b83
This commit is contained in:
Joanna Taryma 2016-12-21 15:35:11 +01:00
parent 4f1669dbaf
commit 83a19a4844
2 changed files with 11 additions and 1 deletions

@ -25,8 +25,10 @@ cli_opts = [
cfg.StrOpt('api_url',
default=APARAMS.get('ipa-api-url'),
deprecated_name='api-url',
regex='^http(s?):\/\/.+',
help='URL of the Ironic API. '
'Can be supplied as "ipa-api-url" kernel parameter.'),
'Can be supplied as "ipa-api-url" kernel parameter.'
'The value must start with either http:// or https://.'),
cfg.StrOpt('listen_host',
default=APARAMS.get('ipa-listen-host', '0.0.0.0'),

@ -0,0 +1,8 @@
---
fixes:
- Accepting ``ipa-api-url`` value specified in the configuration
file that does not start with either ``https://`` or ``http://``.
Such value leads failure while contacting ironic-api.
This misconfiguration will be detected on ironic-python-agent start.
An exception will be raised and an error about the invalid value
will be logged.