openstack-ansible/osa_toolkit
Ryan Drew d2657174ce
Fix KeyError raised when max hostname length exceeded
The function osa_toolkit.generate._add_container_hosts contains a bug in
the code used to check if provided hostnames have exceeded their max
allowed length. The logic used to perform this check depends on the
`is_metal` flag within each container's properties. Unfortunately the
`is_metal` flag is accessed within the `properties` dictionary using
bracket notation rather than the safer `dict.get` method, causing a
`KeyError` to be raised when a host's properties dictionary does not
contain the `is_metal` flag.

It is not expected that a `KeyError` would be raised in the function if
hostnames have exceeded their max length. It is instead expected that a
`SystemExit` exception would be raised warning the user of their invalid
hostname(s).

This bug will impacts deployments where hostnames actually do exceed the
max allowed length due to the short circuit logic used in the if-elif
tree.

Closes-Bug: #1886905

Change-Id: Ic1acfea71f27f94e277aa443f0a53ef16b4eb417
2020-07-09 12:01:00 -06:00
..
__init__.py Restructure lib directory to install via pip 2017-03-30 10:19:01 -04:00
dictutils.py Improve compatibiliity with Python 3 2017-06-06 10:44:13 -04:00
filesystem.py Update hacking for Python3 2020-04-29 06:20:40 +00:00
generate.py Fix KeyError raised when max hostname length exceeded 2020-07-09 12:01:00 -06:00
ip.py Improve compatibiliity with Python 3 2017-06-06 10:44:13 -04:00
manage.py Fix inventory_manage when the component for a host is not defined 2020-05-26 17:10:12 +01:00
tools.py Restructure lib directory to install via pip 2017-03-30 10:19:01 -04:00