Pass agent token to get command results
Change-Id: Iad0d8086e1e79b59da3f9940b83128a3b34d4787
This commit is contained in:
@@ -316,9 +316,15 @@ class AgentClient(object):
|
|||||||
url = self._get_command_url(node)
|
url = self._get_command_url(node)
|
||||||
LOG.debug('Fetching status of agent commands for node %s', node.uuid)
|
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():
|
def _get():
|
||||||
try:
|
try:
|
||||||
return self.session.get(url,
|
return self.session.get(url,
|
||||||
|
params=request_params,
|
||||||
verify=self._get_verify(node),
|
verify=self._get_verify(node),
|
||||||
timeout=CONF.agent.command_timeout)
|
timeout=CONF.agent.command_timeout)
|
||||||
except (requests.ConnectionError, requests.Timeout) as e:
|
except (requests.ConnectionError, requests.Timeout) as e:
|
||||||
|
@@ -552,7 +552,7 @@ class TestAgentClient(base.TestCase):
|
|||||||
params={'wait': 'false'},
|
params={'wait': 'false'},
|
||||||
timeout=60,
|
timeout=60,
|
||||||
verify=True)
|
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)
|
verify=True)
|
||||||
mock_sleep.assert_called_with(CONF.agent.command_wait_interval)
|
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)s/%(api_version)s/commands/' % {
|
||||||
'agent_url': agent_url,
|
'agent_url': agent_url,
|
||||||
'api_version': CONF.agent.agent_api_version},
|
'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):
|
def test_get_commands_status_retries(self):
|
||||||
res = mock.MagicMock(spec_set=['json'])
|
res = mock.MagicMock(spec_set=['json'])
|
||||||
@@ -608,7 +608,7 @@ class TestAgentClient(base.TestCase):
|
|||||||
'%(agent_url)s/%(api_version)s/commands/' % {
|
'%(agent_url)s/%(api_version)s/commands/' % {
|
||||||
'agent_url': agent_url,
|
'agent_url': agent_url,
|
||||||
'api_version': CONF.agent.agent_api_version},
|
'api_version': CONF.agent.agent_api_version},
|
||||||
verify='/path/to/agent.crt',
|
params={}, verify='/path/to/agent.crt',
|
||||||
timeout=CONF.agent.command_timeout)
|
timeout=CONF.agent.command_timeout)
|
||||||
|
|
||||||
def _test_install_bootloader(self, root_uuid, efi_system_part_uuid=None,
|
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.
|
Reference in New Issue
Block a user