[autoscaler] Fix bad reference error when specifying IamInstanceProfile by name in config. (#14083)

This commit is contained in:
Patrick Ames 2021-02-15 16:29:36 -08:00 committed by GitHub
parent ebb6e552d2
commit da0c2c99a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -155,11 +155,11 @@ def log_to_cli(config):
_tags=workers_tags)
tags = {"default": _log_info["head_instance_profile_src"] == "default"}
cli_logger.labeled_value(
"IAM Profile",
"{}",
_arn_to_name(config["head_node"]["IamInstanceProfile"]["Arn"]),
_tags=tags)
profile_arn = config["head_node"]["IamInstanceProfile"].get("Arn")
profile_name = _arn_to_name(profile_arn) \
if profile_arn \
else config["head_node"]["IamInstanceProfile"]["Name"]
cli_logger.labeled_value("IAM Profile", "{}", profile_name, _tags=tags)
if ("KeyName" in config["head_node"]
and "KeyName" in config["worker_nodes"]):