From fdeabe06e72d2b8eda6773100975addd75225a50 Mon Sep 17 00:00:00 2001
From: James Slagle <jslagle@redhat.com>
Date: Wed, 20 Jun 2018 15:27:17 -0400
Subject: [PATCH] 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
---
 tools/process-templates.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/process-templates.py b/tools/process-templates.py
index 5f586c4782..964ea319dc 100755
--- a/tools/process-templates.py
+++ b/tools/process-templates.py
@@ -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)