Catch KeyError if thrown while removing data from remote hosts

This keyerror happens if an exception is thrown in a plugin before
data is copied remotly, so no action needs to be taken

Change-Id: I7e0cffaa20da437b0f3b130e267f39a9fa5eddb9
This commit is contained in:
Derek Higgins
2013-02-14 15:16:21 -05:00
parent f0d2596b99
commit e0b418b688

View File

@@ -612,7 +612,11 @@ def remove_remote_var_dirs():
doesn't remove data on localhost
"""
for host in gethostlist(controller.CONF):
host_dir = controller.temp_map[host]
try:
host_dir = controller.temp_map[host]
except KeyError:
# Nothing was added to this host yet, so we have nothing to delete
continue
logging.info(output_messages.INFO_REMOVE_REMOTE_VAR % (host_dir, host))
server = utils.ScriptRunner(host)
server.append('rm -rf %s' % host_dir)