Skip to content

Commit

Permalink
Merge pull request #271 from pyouroboros/patch/catch-up
Browse files Browse the repository at this point in the history
Patch/catch up
  • Loading branch information
dirtycajunrice authored Mar 25, 2019
2 parents a50fcb1 + c6ba388 commit 55da85e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions pyouroboros/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION = "1.3.1"
BRANCH = "master"
VERSION = "1.4.0"
BRANCH = "develop"
21 changes: 13 additions & 8 deletions pyouroboros/dockerclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,15 @@ def recreate(self, container, latest_image):
new_network_config = {
'container': new_container,
'aliases': network_config['Aliases'],
'links': network_config['Links'],
'ipv4_address': network_config['IPAddress'],
'ipv6_address': network_config['GlobalIPv6Address']
'links': network_config['Links']
}
if network_config['IPAMConfig']:
new_network_config.update(
{
'ipv4_address': network_config['IPAddress'],
'ipv6_address': network_config['GlobalIPv6Address']
}
)
try:
network.connect(**new_network_config)
except APIError as e:
Expand Down Expand Up @@ -229,10 +234,10 @@ def monitor_filter(self):

# Socket Functions
def self_check(self):
self.monitored = self.monitor_filter()
me_list = [container for container in self.monitored if 'ouroboros' in container.name]
if len(me_list) > 1:
self.update_self(count=2, me_list=me_list)
if self.config.self_update:
me_list = [container for container in self.client.containers.list() if 'ouroboros' in container.name]
if len(me_list) > 1:
self.update_self(count=2, me_list=me_list)

def socket_check(self):
depends_on_names = []
Expand Down Expand Up @@ -347,7 +352,7 @@ 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]['Created'] < me_list[1]['Created'] else me_list[1]['Id']
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 = self.client.containers.get(old_me_id)
old_me_image_id = old_me.image.id

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ docker>=3.7.0
prometheus_client>=0.5.0
requests>=2.21.0
influxdb>=5.2.1
apprise>=0.5.2
apprise>=0.7.4
apscheduler>=3.5.3

0 comments on commit 55da85e

Please sign in to comment.