summaryrefslogtreecommitdiff
path: root/ironic/api/controllers/v1/ramdisk.py
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2020-03-30 11:37:02 +0200
committerDmitry Tantsur <dtantsur@protonmail.com>2020-03-31 13:40:00 +0000
commit1faa3397a6ae1c9d82d8f4ba90134148bc022e61 (patch)
tree24de6242cc44bf2b8d108cc7342932d41a4a0669 /ironic/api/controllers/v1/ramdisk.py
parenta3d7d73a69f85b396aad30610294d5ea246a0df7 (diff)
downloadironic-1faa3397a6ae1c9d82d8f4ba90134148bc022e61.tar.gz
Fix the remaining hacking issues
Fixes W504 and E117, resulting in some indentation changes. Also fixes code that exceeds the complexity requirement, that is bumped to 20 (mostly to avoid refactoring the agent heartbeat call, resulting in conflicts for the deploy steps work). Change-Id: I8e49f2c039b0ddfca9138f8e148708b7e8b5df7e
Diffstat (limited to 'ironic/api/controllers/v1/ramdisk.py')
-rw-r--r--ironic/api/controllers/v1/ramdisk.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/ironic/api/controllers/v1/ramdisk.py b/ironic/api/controllers/v1/ramdisk.py
index 0f22501b4..8d68032b7 100644
--- a/ironic/api/controllers/v1/ramdisk.py
+++ b/ironic/api/controllers/v1/ramdisk.py
@@ -205,15 +205,14 @@ class HeartbeatController(rest.RestController):
agent_url = dii.get('agent_url')
# If we have an agent_url on file, and we get something different
# we should fail because this is unexpected behavior of the agent.
- if (agent_url is not None
- and agent_url != callback_url):
- LOG.error('Received heartbeat for node %(node)s with '
- 'callback URL %(url)s. This is not expected, '
- 'and the heartbeat will not be processed.',
- {'node': rpc_node.uuid, 'url': callback_url})
- raise exception.Invalid(
- _('Detected change in ramdisk provided '
- '"callback_url"'))
+ if agent_url is not None and agent_url != callback_url:
+ LOG.error('Received heartbeat for node %(node)s with '
+ 'callback URL %(url)s. This is not expected, '
+ 'and the heartbeat will not be processed.',
+ {'node': rpc_node.uuid, 'url': callback_url})
+ raise exception.Invalid(
+ _('Detected change in ramdisk provided '
+ '"callback_url"'))
# NOTE(TheJulia): If tokens are required, lets go ahead and fail the
# heartbeat very early on.
token_required = CONF.require_agent_token