correct api schema for instance patch
The api schema specification for the patch oepration is in error and defined a parameter of "configuration_id" while the code (both in the server and the client, and also all the tests) used "configuration". A fix with fewer lines of code would have been to just embed the { "type": "null" } into the definition of configuration_id but I am going to be making additional changes to the way in which we signal (through a put call) that we want to detach a configuration_id so I've defined a null_configuration_id type which I can use there as well. To prevent this from reoccuring, additionalProperties has been set to False. Change-Id: Ic98050e487b0d8cd9a68e8c46169456a52e2b16c Closes-Bug: #1460174
This commit is contained in:
parent
0f3d242548
commit
ddb9b7da03
|
@ -197,9 +197,14 @@ users_list = {
|
|||
}
|
||||
}
|
||||
|
||||
null_configuration_id = {
|
||||
"type": "null"
|
||||
}
|
||||
|
||||
configuration_id = {
|
||||
'oneOf': [
|
||||
uuid
|
||||
uuid,
|
||||
null_configuration_id
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -301,10 +306,12 @@ instance = {
|
|||
"instance": {
|
||||
"type": "object",
|
||||
"required": [],
|
||||
"additionalProperties": False,
|
||||
"properties": {
|
||||
"slave_of": {},
|
||||
"replica_of": {},
|
||||
"name": non_empty_string,
|
||||
"configuration_id": configuration_id,
|
||||
"configuration": configuration_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -305,7 +305,9 @@ class InstanceController(wsgi.Controller):
|
|||
instance = models.Instance.load(context, id)
|
||||
|
||||
args = {}
|
||||
args['detach_replica'] = 'slave_of' in body['instance']
|
||||
args['detach_replica'] = ('replica_of' in body['instance'] or
|
||||
'slave_of' in body['instance'])
|
||||
|
||||
if 'name' in body['instance']:
|
||||
args['name'] = body['instance']['name']
|
||||
if 'configuration' in body['instance']:
|
||||
|
|
Loading…
Reference in New Issue