diff options
author | Jim Rollenhagen <jim@jimrollenhagen.com> | 2015-04-10 06:22:28 -0700 |
---|---|---|
committer | Jim Rollenhagen <jim@jimrollenhagen.com> | 2015-04-15 15:08:20 -0700 |
commit | 904bbcde88d9db0cd60719e771ea168cb52948e1 (patch) | |
tree | 88e09c0c6820586bda470843ac2240a6a42db1d0 | |
parent | 1a227d71ed8b5dd5920b05b703b2c296515358f1 (diff) | |
download | ironic-904bbcde88d9db0cd60719e771ea168cb52948e1.tar.gz |
Fix heartbeat when clean step in progress
The agent returns command_result of None when a command is in progress.
The code assumed it would return an empty dict. Fix the access of
command_result to never return None, and fix the tests to reflect
reality.
Closes-Bug: #1444715
Change-Id: Iae6cd90517cb7b268ce2c089c92f64b09a606a42
(cherry picked from commit 2e2fb8c4997b1cac7dc18e67e43a0d8ba65a79d5)
-rw-r--r-- | ironic/drivers/modules/agent_base_vendor.py | 3 | ||||
-rw-r--r-- | ironic/tests/drivers/test_agent_base_vendor.py | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/ironic/drivers/modules/agent_base_vendor.py b/ironic/drivers/modules/agent_base_vendor.py index f09aa4aff..5f4478b9f 100644 --- a/ironic/drivers/modules/agent_base_vendor.py +++ b/ironic/drivers/modules/agent_base_vendor.py @@ -318,7 +318,8 @@ class BaseAgentVendor(base.VendorInterface): # processing so the command hasn't started yet return - last_step = last_command['command_result'].get('clean_step') + last_result = last_command.get('command_result') or {} + last_step = last_result.get('clean_step') if last_command['command_status'] == 'RUNNING': return elif (last_command['command_status'] == 'SUCCEEDED' and diff --git a/ironic/tests/drivers/test_agent_base_vendor.py b/ironic/tests/drivers/test_agent_base_vendor.py index e672df85b..851e124d5 100644 --- a/ironic/tests/drivers/test_agent_base_vendor.py +++ b/ironic/tests/drivers/test_agent_base_vendor.py @@ -513,7 +513,7 @@ class TestBaseAgentVendor(db_base.DbTestCase): status_mock.return_value = [{ 'command_status': 'RUNNING', 'command_name': 'execute_clean_step', - 'command_result': {} + 'command_result': None }] with task_manager.acquire(self.context, self.node['uuid'], shared=False) as task: |