Skip to content

Commit 2de9faa

Browse files
committed
switch deploy to use v1 apis
1 parent dfcc5cc commit 2de9faa

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

rsconnect/api.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,16 @@ def content_get(self, content_guid: str) -> ContentItemV1:
473473
response = self._server.handle_bad_response(response)
474474
return response
475475

476-
def content_build(self, content_guid: str, bundle_id: Optional[str] = None) -> BuildOutputDTO:
476+
def content_build(self, content_guid: str, bundle_id: Optional[str] = None, activate: bool = True) -> BuildOutputDTO:
477+
body = {"bundle_id": bundle_id}
478+
if not activate:
479+
# The default behavior is to activate the app after building.
480+
# So we only pass the parameter if we want to deactivate it.
481+
# That way we can keep the API backwards compatible.
482+
body["activate"] = False
477483
response = cast(
478484
Union[BuildOutputDTO, HTTPResponse],
479-
self.post("v1/content/%s/build" % content_guid, body={"bundle_id": bundle_id}),
485+
self.post("v1/content/%s/build" % content_guid, body=body),
480486
)
481487
response = self._server.handle_bad_response(response)
482488
return response
@@ -552,10 +558,10 @@ def deploy(
552558

553559
app_bundle = self.app_upload(app_id, tarball)
554560

555-
task = self.app_deploy(app_id, app_bundle["id"], activate=activate)
561+
task = self.content_build(app_guid, str(app_bundle["id"]), activate=activate)
556562

557563
return {
558-
"task_id": task["id"],
564+
"task_id": task["task_id"],
559565
"app_id": app_id,
560566
"app_guid": app["guid"],
561567
"app_url": app["url"],

rsconnect/http_support.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ def _do_request(
379379
logger.debug("Headers:")
380380
for key, value in headers.items():
381381
logger.debug("--> %s: %s" % (key, value))
382+
logger.debug("Body:")
383+
logger.debug("--> %s" % (body if body is not None else "<no body>"))
382384

383385
# if we weren't called under a `with` statement, we'll need to manage the
384386
# connection here.

0 commit comments

Comments
 (0)