Commit 22b622fe authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

Project deactivation/termination

parent 29cca735
......@@ -702,10 +702,14 @@ def approve_application(app):
logger.error(e.message)
def terminate(project_id):
project = get_project_by_id(project_id)
project.set_termination_start_date()
project = get_project_for_update(project_id)
if not project.is_alive:
m = _(astakos_messages.NOT_ALIVE_PROJECT) % project.__dict__
raise PermissionDenied(m)
project.terminate()
trigger_sync()
project.set_termination_date()
try:
notification = build_notification(
......
......@@ -53,8 +53,8 @@ class Command(NoArgsCommand):
apps = ProjectApplication.objects.select_related().all().order_by('id')
labels = (
'application.id', 'application.state', 'project.id', 'name',
'is_active', 'is_alive', 'is_suspended', 'is_terminated'
'application.id', 'application.state', 'project.id', 'name',
'is_alive', 'is_suspended', 'is_terminated'
)
columns = (15, 10, 20, 10, 10, 10, 10, 10)
......@@ -67,13 +67,11 @@ class Command(NoArgsCommand):
for app in apps:
try:
project_id = str(app.project.id)
is_active = app.project.is_active
is_alive = app.project.is_alive
is_suspended = app.project.is_suspended
is_terminated = app.project.is_terminated
except:
project_id = ''
is_active = ''
is_alive = ''
is_suspended = ''
is_terminated = ''
......@@ -82,7 +80,6 @@ class Command(NoArgsCommand):
app.state,
str(project_id),
app.name,
format_bool(is_active),
format_bool(is_alive),
format_bool(is_suspended),
format_bool(is_terminated)
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment