Merge "Address TODO in schema"

This commit is contained in:
Jenkins 2017-02-16 01:27:22 +00:00 committed by Gerrit Code Review
commit 5ec4d100ec
4 changed files with 13 additions and 8 deletions

View File

@ -26,13 +26,13 @@ patch_options = {
}
}
# NOTE(cpp-cabrera): a string valid for use in a URI
# TODO(cpp-cabrera): perhaps validate this further using jsonschema's
# uri validator as per rfc3987
patch_uri = {
'type': 'object', 'properties': {
'uri': {
'type': 'string'
'type': 'string',
'minLength': 0,
'maxLength': 255,
'format': 'uri'
},
'additionalProperties': False
}
@ -41,7 +41,9 @@ patch_uri = {
patch_group = {
'type': 'object', 'properties': {
'uri': {
'type': 'string'
'type': 'string',
'minLength': 0,
'maxLength': 255
},
'additionalProperties': False
}

View File

@ -63,12 +63,13 @@ def pools(test, count, uri):
:returns: (paths, weights, uris, options)
:rtype: ([six.text_type], [int], [six.text_type], [dict])
"""
mongo_url = uri
base = test.url_prefix + '/pools/'
args = [(base + str(i), i,
{str(i): i})
for i in range(count)]
for path, weight, option in args:
uri = "%s/%s" % (uri, str(uuid.uuid4()))
uri = "%s/%s" % (mongo_url, str(uuid.uuid4()))
doc = {'weight': weight, 'uri': uri, 'options': option}
test.simulate_put(path, body=jsonutils.dumps(doc))

View File

@ -65,12 +65,13 @@ def pools(test, count, uri, group):
:returns: (paths, weights, uris, options)
:rtype: ([six.text_type], [int], [six.text_type], [dict])
"""
mongo_url = uri
base = test.url_prefix + '/pools/'
args = [(base + str(i), i,
{str(i): i})
for i in range(count)]
for path, weight, option in args:
uri = "%s/%s" % (uri, str(uuid.uuid4()))
uri = "%s/%s" % (mongo_url, str(uuid.uuid4()))
doc = {'weight': weight, 'uri': uri,
'group': group, 'options': option}
test.simulate_put(path, body=jsonutils.dumps(doc))

View File

@ -64,12 +64,13 @@ def pools(test, count, uri, group):
:returns: (paths, weights, uris, options)
:rtype: ([six.text_type], [int], [six.text_type], [dict])
"""
mongo_url = uri
base = test.url_prefix + '/pools/'
args = [(base + str(i), i,
{str(i): i})
for i in range(count)]
for path, weight, option in args:
uri = "%s/%s" % (uri, str(uuid.uuid4()))
uri = "%s/%s" % (mongo_url, str(uuid.uuid4()))
doc = {'weight': weight, 'uri': uri,
'group': group, 'options': option}
test.simulate_put(path, body=jsonutils.dumps(doc))