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
..
2020-04-29 06:20:40 +00:00
2017-06-06 10:44:13 -04:00