Merge pull request #186 from mesosphere/newschema
update app json-schema
This commit is contained in:
@@ -4,7 +4,33 @@
|
||||
"definitions": {
|
||||
"app": {
|
||||
"additionalProperties": false,
|
||||
"definitions": {
|
||||
"pathType": {
|
||||
"pattern": "^(\\/?((\\.{2})|([a-z0-9\\-]*))($|\\/))*$",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"not": {
|
||||
"allOf": [
|
||||
{
|
||||
"required": [
|
||||
"cmd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"args"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"properties": {
|
||||
"acceptedResourceRoles": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"args": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
@@ -20,6 +46,7 @@
|
||||
"type": "integer"
|
||||
},
|
||||
"cmd": {
|
||||
"minLength": 1,
|
||||
"type": "string"
|
||||
},
|
||||
"constraints": {},
|
||||
@@ -29,12 +56,27 @@
|
||||
"docker": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"forcePullImage": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"image": {
|
||||
"type": "string"
|
||||
},
|
||||
"network": {
|
||||
"type": "string"
|
||||
},
|
||||
"parameters": {
|
||||
"items": {
|
||||
"additionalProperties": false,
|
||||
"properties": {},
|
||||
"required": [
|
||||
"key",
|
||||
"value"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"portMappings": {
|
||||
"items": {
|
||||
"additionalProperties": false,
|
||||
@@ -61,6 +103,9 @@
|
||||
"type": "object"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"privileged": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -98,8 +143,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"items": {
|
||||
"pattern": "^/?(([a-z0-9]|[a-z0-9][a-z0-9\\-]*[a-z0-9])\\.)*([a-z0-9]|[a-z0-9][a-z0-9\\-]*[a-z0-9])$",
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/pathType"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
@@ -116,6 +160,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"executor": {
|
||||
"pattern": "^(|\\/\\/cmd|\\/?[^\\/]+(\\/[^\\/]+)*)$",
|
||||
"type": "string"
|
||||
},
|
||||
"healthChecks": {
|
||||
@@ -129,6 +174,9 @@
|
||||
"minimum": 0,
|
||||
"type": "integer"
|
||||
},
|
||||
"ignoreHttp1xx": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"intervalSeconds": {
|
||||
"minimum": 0,
|
||||
"type": "integer"
|
||||
@@ -157,7 +205,7 @@
|
||||
"type": "array"
|
||||
},
|
||||
"id": {
|
||||
"pattern": "^/?(([a-z0-9]|[a-z0-9][a-z0-9\\-]*[a-z0-9])\\.)*([a-z0-9]|[a-z0-9][a-z0-9\\-]*[a-z0-9])$",
|
||||
"pattern": "^(\\/?((\\.{2})|([a-z0-9][a-z0-9\\-]*[a-z0-9]+)|([a-z0-9]*))($|\\/))*$",
|
||||
"type": "string"
|
||||
},
|
||||
"instances": {
|
||||
@@ -170,6 +218,10 @@
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"maxLaunchDelaySeconds": {
|
||||
"minimum": 0,
|
||||
"type": "integer"
|
||||
},
|
||||
"mem": {
|
||||
"minimum": 0,
|
||||
"type": "number"
|
||||
@@ -185,9 +237,6 @@
|
||||
"requirePorts": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"storeUrls": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
@@ -197,6 +246,11 @@
|
||||
"upgradeStrategy": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"maximumOverCapacity": {
|
||||
"maximum": 1.0,
|
||||
"minimum": 0.0,
|
||||
"type": "number"
|
||||
},
|
||||
"minimumHealthCapacity": {
|
||||
"maximum": 1.0,
|
||||
"minimum": 0.0,
|
||||
@@ -213,8 +267,16 @@
|
||||
},
|
||||
"user": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
|
||||
@@ -472,8 +472,6 @@ def _start(app_id, instances, force):
|
||||
desc['instances']))
|
||||
return 1
|
||||
|
||||
schema = _app_schema()
|
||||
|
||||
# Need to add the 'id' because it is required
|
||||
app_json = {'id': app_id}
|
||||
|
||||
@@ -490,10 +488,6 @@ def _start(app_id, instances, force):
|
||||
|
||||
app_json['instances'] = instances
|
||||
|
||||
errs = util.validate_json(app_json, schema)
|
||||
if errs:
|
||||
raise DCOSException(util.list_to_err(errs))
|
||||
|
||||
deployment = client.update_app(app_id, app_json, force)
|
||||
|
||||
emitter.publish('Created deployment {}'.format(deployment))
|
||||
@@ -575,10 +569,6 @@ def _update(app_id, json_items, force):
|
||||
else:
|
||||
app_json[key] = value
|
||||
|
||||
errs = util.validate_json(app_json, schema)
|
||||
if errs:
|
||||
raise DCOSException(util.list_to_err(errs))
|
||||
|
||||
deployment = client.update_app(app_id, app_json, force)
|
||||
|
||||
emitter.publish('Created deployment {}'.format(deployment))
|
||||
|
||||
@@ -94,18 +94,10 @@ def test_add_bad_complicated_group():
|
||||
['dcos', 'marathon', 'group', 'add'],
|
||||
stdin=fd)
|
||||
|
||||
# id for group in test-group/more-groups
|
||||
err = "Property missing which is mandatory"
|
||||
# missing id in apps in appingroups
|
||||
err2 = "identifier / is not child of /test-group/appingroups"
|
||||
# missing cmd in appingroups
|
||||
err3 = "AppDefinition must either contain one of 'cmd' or 'args', " + \
|
||||
"and/or a 'container'"
|
||||
err = "Error: missing required property 'id'"
|
||||
assert returncode == 1
|
||||
assert stdout == b''
|
||||
assert err in stderr.decode('utf-8')
|
||||
assert err2 in stderr.decode('utf-8')
|
||||
assert err3 in stderr.decode('utf-8')
|
||||
|
||||
|
||||
def _list_groups(group_id=None):
|
||||
|
||||
Reference in New Issue
Block a user