-
Notifications
You must be signed in to change notification settings - Fork 841
PUT on /v2/apps has a PATCH semantic. #5157
Conversation
Add a command line parameter, that allows for proper PUT semantics which will overwrite all values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test when updateExisting is false.
We're happy with the name, thank you for addressing this! |
@@ -90,6 +90,16 @@ | |||
Note: This operation will create a deployment. The operation finishes, if the deployment succeeds. | |||
You can query the deployments endoint to see the status of the deployment. | |||
is: [ secured, deployable ] | |||
queryParameters: | |||
updateExisting: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm confused by this parameter name. aren't we updating via PUT or PATCH? how does updateExisting
imply "I'd like to partially update"?
suggestions: partialUpdate
, patchUpdate
, applyAsPatch
@@ -251,6 +261,16 @@ | |||
Note: This operation will create a deployment. The operation finishes, if the deployment succeeds. | |||
You can query the deployments endoint to see the status of the deployment. | |||
is: [ secured, deployable ] | |||
queryParameters: | |||
updateExisting: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
or else, perhaps invert the meaning parameter: call it |
We went ahead and created a tag in docker hub v1.4.0-RC6.5157 then I launched is as MoM and pointed my dcos-ui to it instead of the root Marathon. Then I added the param to the API request, I can see the UI sending it but Marathon still replies with the same error. |
| }, | ||
| "ipAddress": { "name": "dcos" } | ||
|}""".stripMargin.getBytes("UTF-8") | ||
val appUpdate = appsResource.canonicalAppUpdateFromJson(app.id, body, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also include a test case where partialUpdate=true
to demonstrate that it will fail validation?
also discussed with @aquamatthias that we should add support for the (The plan for 1.5 should be to, at least, change the default of |
@@ -141,20 +143,66 @@ class AppsResource @Inject() ( | |||
} | |||
} | |||
|
|||
/** | |||
* Validate and normalize an array of application updates submitted via the REST API. Validation exceptions are not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy/paste doc error
// some hackery here to pass initial JSON parsing. | ||
val jsObj = Json.parse(body).as[JsObject] + ("id" -> Json.toJson(appId.toString)) | ||
// the version is thrown away in toUpdate so just pass `zero` for now | ||
normalizedApp(validateOrThrow(jsObj.as[AppDefinition].copy(id = appId).withCanonizedIds()), Timestamp.zero).toUpdate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't actually need to copy the id in this step since we just did it in the previous one
overall i'm not super happy w/ the efficiency when |
[EDIT] I'm guessing it's the 3s timeout for "update a group with application with health checks" |
Summary: 1.) PUT on /v2/apps has a PATCH semantic. (#5157) See 8df2a5d * document that, by default, PUT on /v2/apps has a PATCH semantic: only the fields specified in the app update are applied to the existing app definition. * add a query parameter, `partialUpdate`, that allows for proper PUT semantics for an app. `false` means "completely replace the existing app with the new one that I'm **fully specifying** here" 2.) Add support for PATCH updates to apps in 1.4 (#5183) See 1ba8ea7 * added support to PATCH apps also-by: unterstein 3.) Fixes #5211 by defining the jersey annotated methods explicitly. (#5217) See e1b7952 * With the newly introduced `PATCH` semantic, we introduced a misleading method declaration which is not resolvable for jersey. Therefore this logic was restructured and methods are defined explicitly. Test Plan: sbt test sbt integration:test Reviewers: meichstedt, aquamatthias, jasongilanfarr, jenkins, jdef Reviewed By: meichstedt, aquamatthias, jenkins, jdef Subscribers: jdef, marathon-team Differential Revision: https://phabricator.mesosphere.com/D552
[EDIT] Add a query parameter, that allows for proper PUT semantics which will overwrite all values.