mirror of
https://opendev.org/openstack/ironic.git
synced 2026-01-16 23:01:47 +00:00
Pass agent token to get command results
Change-Id: Iad0d8086e1e79b59da3f9940b83128a3b34d4787
(cherry picked from commit 279392966b)
This commit is contained in:
parent
e20665f759
commit
b2a7382d2c
3 changed files with 14 additions and 3 deletions
|
|
@ -314,9 +314,15 @@ class AgentClient(object):
|
|||
url = self._get_command_url(node)
|
||||
LOG.debug('Fetching status of agent commands for node %s', node.uuid)
|
||||
|
||||
request_params = {}
|
||||
agent_token = node.driver_internal_info.get('agent_secret_token')
|
||||
if agent_token:
|
||||
request_params['agent_token'] = agent_token
|
||||
|
||||
def _get():
|
||||
try:
|
||||
return self.session.get(url,
|
||||
params=request_params,
|
||||
verify=self._get_verify(node),
|
||||
timeout=CONF.agent.command_timeout)
|
||||
except (requests.ConnectionError, requests.Timeout) as e:
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ class TestAgentClient(base.TestCase):
|
|||
params={'wait': 'false'},
|
||||
timeout=60,
|
||||
verify=True)
|
||||
self.client.session.get.assert_called_with(url, timeout=60,
|
||||
self.client.session.get.assert_called_with(url, params={}, timeout=60,
|
||||
verify=True)
|
||||
mock_sleep.assert_called_with(CONF.agent.command_wait_interval)
|
||||
|
||||
|
|
@ -571,7 +571,7 @@ class TestAgentClient(base.TestCase):
|
|||
'%(agent_url)s/%(api_version)s/commands/' % {
|
||||
'agent_url': agent_url,
|
||||
'api_version': CONF.agent.agent_api_version},
|
||||
verify=True, timeout=CONF.agent.command_timeout)
|
||||
params={}, verify=True, timeout=CONF.agent.command_timeout)
|
||||
|
||||
def test_get_commands_status_retries(self):
|
||||
res = mock.MagicMock(spec_set=['json'])
|
||||
|
|
@ -608,7 +608,7 @@ class TestAgentClient(base.TestCase):
|
|||
'%(agent_url)s/%(api_version)s/commands/' % {
|
||||
'agent_url': agent_url,
|
||||
'api_version': CONF.agent.agent_api_version},
|
||||
verify='/path/to/agent.crt',
|
||||
params={}, verify='/path/to/agent.crt',
|
||||
timeout=CONF.agent.command_timeout)
|
||||
|
||||
def _test_install_bootloader(self, root_uuid, efi_system_part_uuid=None,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Includes the agent token parameter in get command status requests as
|
||||
the endpoint now requires authentication.
|
||||
Loading…
Add table
Reference in a new issue