diff options
author | Jim Rollenhagen <jim@jimrollenhagen.com> | 2014-09-15 09:16:20 -0700 |
---|---|---|
committer | Jim Rollenhagen <jim@jimrollenhagen.com> | 2014-09-16 07:20:07 -0700 |
commit | 985eba60edc339a1444e9206552eedb0e28758b6 (patch) | |
tree | 5ab3f6f24846bd60d1a1bbc79a407508398e3169 /ironic/drivers | |
parent | 863711e6e1d3693166c15edbedbe97d0c9ac3f2f (diff) | |
download | ironic-985eba60edc339a1444e9206552eedb0e28758b6.tar.gz |
Allow clean_up with missing image ref
This change allows clean_up to continue with missing image_source
in Node.instance_info. This previouly failed in cases where:
* A node failed to deploy and so didn't have image_source
* A node was migrated from nova-baremetal
Change-Id: I03543adc74f9da83fff58e0cffe34f36a055e19a
Closes-Bug: 1368984
Diffstat (limited to 'ironic/drivers')
-rw-r--r-- | ironic/drivers/modules/pxe.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ironic/drivers/modules/pxe.py b/ironic/drivers/modules/pxe.py index 519ab7cb3..1e7f5e164 100644 --- a/ironic/drivers/modules/pxe.py +++ b/ironic/drivers/modules/pxe.py @@ -396,10 +396,17 @@ class PXEDeploy(base.DeployInterface): :param task: a TaskManager instance containing the node to act on. """ node = task.node - pxe_info = _get_image_info(node, task.context) - for label in pxe_info: - path = pxe_info[label][1] - utils.unlink_without_raise(path) + try: + pxe_info = _get_image_info(node, task.context) + except exception.MissingParameterValue as e: + LOG.warning(_LW('Could not get image info to clean up images ' + 'for node %(node)s: %(err)s'), + {'node': node.uuid, 'err': e}) + else: + for label in pxe_info: + path = pxe_info[label][1] + utils.unlink_without_raise(path) + TFTPImageCache().clean_up() pxe_utils.clean_up_pxe_config(task) |