Skip to content

Commit 92bebe1

Browse files
authored
chore(release): check deploy release ptypes
1 parent e2f09b6 commit 92bebe1

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

rootfs/api/models/build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ def save(self, **kwargs):
131131
)
132132

133133
# spin down any proc type removed between the last procfile and the newest one
134-
if remove_procs and previous_release.build is not None:
134+
if remove_procs and previous_release.build is not None and \
135+
self.app.appsettings_set.latest().autodeploy:
135136
removed = {}
136137
for proc in previous_release.ptypes:
137138
if proc not in self.ptypes and self.app.structure.get(proc, 0) > 0:

rootfs/api/views.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,20 +620,17 @@ def get_object(self, **kwargs):
620620
def deploy(self, request, **kwargs):
621621
"""Deploy the latest release"""
622622
latest_release = self.get_app().release_set.latest()
623+
623624
force_deploy = request.data.get("force", False)
624625
ptypes = set(
625626
[ptype for ptype in request.data.get("ptypes", "").split(",") if ptype])
626627
if not ptypes:
627628
ptypes = latest_release.ptypes
628629
else:
629-
previous_release = latest_release.previous()
630-
all_ptypes = latest_release.ptypes
631-
if previous_release:
632-
all_ptypes += previous_release.ptypes
633-
invalid_ptypes = ptypes.difference(all_ptypes)
630+
invalid_ptypes = ptypes.difference(
631+
latest_release.ptypes + [d["name"] for d in self.get_app().list_deployments()])
634632
if len(invalid_ptypes) != 0:
635-
raise DryccException("process type {} is not exists".
636-
format(','.join(invalid_ptypes)))
633+
raise DryccException(f"process type {','.join(invalid_ptypes)} is not exists")
637634
latest_release.deploy(ptypes, force_deploy)
638635
return Response(status=status.HTTP_204_NO_CONTENT)
639636

0 commit comments

Comments
 (0)