Fix agent_id with string type in API samples files for os-agents v2
The agent_id should be integer for agent create and index. But in the api sample file it is string type. It's because the api sample tests provide agent_id with string type in fake data. This patch correct the api sample files and tests. For agent update, it use agent_id that passed from url, make the response use string for agent_id. We can't fix this problem for back-compatibility. This will be fix in the future after v3 API expose by micro-version Change-Id: I262b4b26c94dba003e80bda2f38d2e985ef9f220 Partial-Bug: #1333494
This commit is contained in:
parent
8bc56d8bf2
commit
a8b805d3a3
@ -1,6 +1,6 @@
|
||||
{
|
||||
"agent": {
|
||||
"agent_id": "1",
|
||||
"agent_id": 1,
|
||||
"architecture": "x86",
|
||||
"hypervisor": "hypervisor",
|
||||
"md5hash": "add6bb58e139be103324d04d82d8f545",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"agents": [
|
||||
{
|
||||
"agent_id": "1",
|
||||
"agent_id": 1,
|
||||
"architecture": "x86",
|
||||
"hypervisor": "hypervisor",
|
||||
"md5hash": "add6bb58e139be103324d04d82d8f545",
|
||||
|
@ -112,6 +112,11 @@ class AgentController(object):
|
||||
except exception.AgentBuildNotFound as ex:
|
||||
raise webob.exc.HTTPNotFound(explanation=ex.format_message())
|
||||
|
||||
# NOTE(alex_xu): The agent_id should be integer that consistent with
|
||||
# create/index actions. But parameter 'id' is string type that parsed
|
||||
# from url. This is a bug, but because back-compatibility, it can't be
|
||||
# fixed for v2 API. This will be fixed after v3 API feature exposed by
|
||||
# micro-version in the future. lp bug #1333494
|
||||
return {"agent": {'agent_id': id, 'version': version,
|
||||
'url': url, 'md5hash': md5hash}}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
"version": "%(version)s",
|
||||
"md5hash": "%(md5hash)s",
|
||||
"url": "%(url)s",
|
||||
"agent_id": "%(agent_id)d"
|
||||
"agent_id": 1
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
"version": "%(version)s",
|
||||
"md5hash": "%(md5hash)s",
|
||||
"url": "%(url)s",
|
||||
"agent_id": "%(agent_id)d"
|
||||
"agent_id": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1368,10 +1368,10 @@ class AgentsJsonTest(ApiSampleTestBaseV2):
|
||||
'os': 'os',
|
||||
'version': '8.0',
|
||||
'md5hash': 'add6bb58e139be103324d04d82d8f545',
|
||||
'id': '1'}]
|
||||
'id': 1}]
|
||||
|
||||
def fake_agent_build_create(context, values):
|
||||
values['id'] = '1'
|
||||
values['id'] = 1
|
||||
agent_build_ref = models.AgentBuild()
|
||||
agent_build_ref.update(values)
|
||||
return agent_build_ref
|
||||
|
Loading…
Reference in New Issue
Block a user