Handle roles w/o deprecated_nic_config_name during template cleanup

Don't assume the role dict has a deprecated_nic_config_name key during
cleanup of the process templates. This isn't a required field, so we
can't assume it exists, otherwise the script will traceback with a
KeyError.

Change-Id: I50eb4831c2b413e2253cb0c3dc9aba4c719f0f14
This commit is contained in:
James Slagle 2018-06-20 15:27:17 -04:00
parent 37ef25cd34
commit fdeabe06e7

View File

@ -325,9 +325,10 @@ def clean_templates(base_path, role_data_path, network_data_path):
delete(os.path.join(
nic_config_dir, sample_nic_config_dir,
'%s.yaml' % role['name'].lower()))
delete(os.path.join(
nic_config_dir, sample_nic_config_dir,
role['deprecated_nic_config_name']))
if 'deprecated_nic_config_name' in role:
delete(os.path.join(
nic_config_dir, sample_nic_config_dir,
role['deprecated_nic_config_name']))
opts = parse_opts(sys.argv)