Skip to content

Commit

Permalink
Catch self update apierror (#238)
Browse files Browse the repository at this point in the history
* catch api error if self-update cant continue

* test fix lint
  • Loading branch information
circa10a authored Feb 23, 2019
1 parent 593c3c6 commit 0d54908
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pyouroboros/dockerclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,17 @@ def update_self(self, count=None, old_container=None, me_list=None, new_image=No
self.logger.debug('I need to update! Starting the ouroboros ;)')
self_name = 'ouroboros-updated' if old_container.name == 'ouroboros' else 'ouroboros'
new_config = set_properties(old=old_container, new=new_image, self_name=self_name)
me_created = self.client.api.create_container(**new_config)
new_me = self.client.containers.get(me_created.get("Id"))
new_me.start()
self.logger.debug('If you strike me down, I shall become more powerful than you could possibly imagine')
self.logger.debug('https://bit.ly/2VVY7GH')
sleep(30)
try:
me_created = self.client.api.create_container(**new_config)
new_me = self.client.containers.get(me_created.get("Id"))
new_me.start()
self.logger.debug('If you strike me down, I shall become \
more powerful than you could possibly imagine.')
self.logger.debug('https://bit.ly/2VVY7GH')
sleep(30)
except APIError as e:
self.logger.error("Self update failed.")
self.logger.error(e)


class Service(BaseImageObject):
Expand Down

0 comments on commit 0d54908

Please sign in to comment.