Skip to content

Commit

Permalink
scenario copy: more robust check for completed copy
Browse files Browse the repository at this point in the history
  • Loading branch information
jdetaeye committed Feb 7, 2022
1 parent b2a14ab commit 4f72d23
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions freppledb/execute/management/commands/scenario_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,8 @@ def handle(self, **options):
# Successful copy can still leave warnings and errors
# To confirm copy is ok, let's check that the scenario copy task exists
# in the destination database
t = Task.objects.using(destination).order_by("-id").first()
if not (
t
and t.id == task.id
and t.name == task.name
and t.submitted == task.submitted
):
t = Task.objects.using(destination).filter(id=task.id).first()
if not t or t.name != task.name or t.submitted != task.submitted:
destinationscenario.status = "Free"
destinationscenario.lastrefresh = datetime.today()
destinationscenario.save(using=DEFAULT_DB_ALIAS)
Expand Down

0 comments on commit 4f72d23

Please sign in to comment.