Skip to content

Commit

Permalink
Ensure proper locals get sent to before_self_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gmt2001 committed Mar 7, 2022
1 parent 4d94efa commit 741e8df
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pyouroboros/dockerclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,14 @@ def update(self):
def update_self(self, count=None, old_container=None, me_list=None, new_image=None):
if count == 2:
self.logger.debug('God im messy... cleaning myself up.')
old_me_id = me_list[0].id if me_list[0].attrs['Created'] < me_list[1].attrs['Created'] else me_list[1].id
old_me_index = 0 if me_list[0].attrs['Created'] < me_list[1].attrs['Created'] else 1
old_me_id = me_list[old_me_index].id
old_me = self.client.containers.get(old_me_id)
old_me_image_id = old_me.image.id

locals = {}
locals['old_container'] = old_me
locals['new_container'] = self.client.containers.get(me_list[0].id if me_list[0].attrs['Created'] >= me_list[1].attrs['Created'] else me_list[1].id)
locals['new_container'] = self.client.containers.get(me_list[0].id if old_me_index == 1 else me_list[1].id)
run_hook('before_self_cleanup', None, locals)

old_me.stop()
Expand Down

0 comments on commit 741e8df

Please sign in to comment.