Skip to content

Commit

Permalink
v1.3.0 to develop
Browse files Browse the repository at this point in the history
v1.3.0 to develop
  • Loading branch information
dirtycajunrice authored Feb 25, 2019
2 parents 0d54908 + af79007 commit 3599f05
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 27 deletions.
31 changes: 30 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
# Change Log

## [1.2.1](https://github.com/pyouroboros/ouroboros/tree/1.2.1) (2019-02-13)
## [1.3.0](https://github.com/pyouroboros/ouroboros/tree/1.3.0) (2019-02-25)
[Full Changelog](https://github.com/pyouroboros/ouroboros/compare/1.2.1...1.3.0)

**Implemented enhancements:**

- Start new container in detached mode [\#222](https://github.com/pyouroboros/ouroboros/pull/222) ([nightvisi0n](https://github.com/nightvisi0n))
- Optimise dockerfile layers [\#218](https://github.com/pyouroboros/ouroboros/pull/218) ([nightvisi0n](https://github.com/nightvisi0n))

**Fixed bugs:**

- Catch Failed self-updates [\#230](https://github.com/pyouroboros/ouroboros/issues/230)
- Cron scheduled missed following successful runs [\#229](https://github.com/pyouroboros/ouroboros/issues/229)
- Catch attribute.id error [\#226](https://github.com/pyouroboros/ouroboros/issues/226)
- AttachStdout and AttachStderr are not carried over properly [\#221](https://github.com/pyouroboros/ouroboros/issues/221)
- Exception when updating container started with --rm \(autoremove\) [\#219](https://github.com/pyouroboros/ouroboros/issues/219)
- Issue with Swarm Mode V2 [\#216](https://github.com/pyouroboros/ouroboros/issues/216)
- Fix docker swarm mode [\#227](https://github.com/pyouroboros/ouroboros/pull/227) ([mathcantin](https://github.com/mathcantin))

**Other Pull Requests**

- v1.3.0 Merge [\#241](https://github.com/pyouroboros/ouroboros/pull/241) ([DirtyCajunRice](https://github.com/DirtyCajunRice))
- v1.3.0 to develop [\#240](https://github.com/pyouroboros/ouroboros/pull/240) ([DirtyCajunRice](https://github.com/DirtyCajunRice))
- Catch self update apierror [\#238](https://github.com/pyouroboros/ouroboros/pull/238) ([circa10a](https://github.com/circa10a))
- Catch attribute error [\#237](https://github.com/pyouroboros/ouroboros/pull/237) ([circa10a](https://github.com/circa10a))
- Check for autoremove [\#236](https://github.com/pyouroboros/ouroboros/pull/236) ([circa10a](https://github.com/circa10a))
- Add misfire\_grace\_time for cron scheduler [\#234](https://github.com/pyouroboros/ouroboros/pull/234) ([circa10a](https://github.com/circa10a))
- Check all services by default on swarm mode [\#228](https://github.com/pyouroboros/ouroboros/pull/228) [[cleanup](https://github.com/pyouroboros/ouroboros/labels/cleanup)] ([mathcantin](https://github.com/mathcantin))
- remove git in pypi + branch develop + version bump + maintainer\_email [\#214](https://github.com/pyouroboros/ouroboros/pull/214) ([DirtyCajunRice](https://github.com/DirtyCajunRice))

## [1.2.1](https://github.com/pyouroboros/ouroboros/tree/1.2.1) (2019-02-14)
[Full Changelog](https://github.com/pyouroboros/ouroboros/compare/1.2.0...1.2.1)

**Fixed bugs:**
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM amd64/python:3.7.2-alpine

LABEL maintainers="dirtycajunrice,circa10a,tkdeviant"
LABEL maintainers="dirtycajunrice,circa10a"

ENV TZ UTC

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.arm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM arm32v6/python:3.7.2-alpine

LABEL maintainers="dirtycajunrice,circa10a,tkdeviant"
LABEL maintainers="dirtycajunrice,circa10a"

ENV TZ UTC

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM arm64v8/python:3.7.2-alpine

LABEL maintainers="dirtycajunrice,circa10a,tkdeviant"
LABEL maintainers="dirtycajunrice,circa10a"

ENV TZ UTC

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[![BuyUsCoffee](https://img.shields.io/badge/BuyMeACoffee-Donate-ff813f.svg?logo=CoffeeScript&style=flat-square)](https://buymeacoff.ee/ouroboros)
[![Build Status](https://jenkins.cajun.pro/buildStatus/icon?job=Ouroboros/master)](https://jenkins.cajun.pro/job/Ouroboros/job/master/)
[![Release](https://img.shields.io/github/release/pyouroboros/ouroboros.svg?style=flat-square)](https://hub.docker.com/r/pyouroboros/ouroboros/)
[![Pypi Downloads](https://img.shields.io/pypi/dm/ouroboros-cli.svg?style=flat-square)](https://pypi.org/project/ouroboros-cli/)
[![Python Version](https://img.shields.io/pypi/pyversions/ouroboros-cli.svg?style=flat-square)](https://pypi.org/project/ouroboros-cli/)
[![Docker Pulls](https://img.shields.io/docker/pulls/pyouroboros/ouroboros.svg?style=flat-square)](https://hub.docker.com/r/pyouroboros/ouroboros/)
[![Layers](https://images.microbadger.com/badges/image/pyouroboros/ouroboros.svg)](https://microbadger.com/images/pyouroboros/ouroboros)
Expand Down
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.2.2"
BRANCH = "develop"
VERSION = "1.3.0"
BRANCH = "master"
26 changes: 6 additions & 20 deletions pyouroboros/dockerclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from os.path import isdir, isfile, join
from docker.errors import DockerException, APIError, NotFound

from pyouroboros.helpers import set_properties
from pyouroboros.helpers import set_properties, remove_sha_prefix, get_digest


class Docker(object):
Expand Down Expand Up @@ -66,8 +66,6 @@ def __init__(self, docker_client):
self.data_manager.total_updated[self.socket] = 0
self.notification_manager = self.docker.notification_manager

self.monitored = self.monitor_filter()

def _pull(self, tag):
"""Docker pull image tag"""
self.logger.debug('Checking tag: %s', tag)
Expand All @@ -77,7 +75,7 @@ def _pull(self, tag):
"username"), self.config.auth_json.get("password"))

if self.config.dry_run:
# The authentification doesn't work with this call
# The authentication doesn't work with this call
# See bugs https://github.com/docker/docker-py/issues/2225
return self.client.images.get_registry_data(tag)
else:
Expand Down Expand Up @@ -106,6 +104,7 @@ def _pull(self, tag):
class Container(BaseImageObject):
def __init__(self, docker_client):
super().__init__(docker_client)
self.monitored = self.monitor_filter()

# Container sub functions
def stop(self, container):
Expand Down Expand Up @@ -375,6 +374,7 @@ def update_self(self, count=None, old_container=None, me_list=None, new_image=No
class Service(BaseImageObject):
def __init__(self, docker_client):
super().__init__(docker_client)
self.monitored = self.monitor_filter()

def monitor_filter(self):
"""Return filtered service objects list"""
Expand All @@ -396,20 +396,6 @@ def pull(self, tag):
"""Docker pull image tag"""
return self._pull(tag)

def _remove_sha_prefix(self, digest):
if digest.startswith("sha256:"):
return digest[7:]
return digest

def _get_digest(self, image):
digest = image.attrs.get(
"Descriptor", {}
).get("digest") or image.attrs.get(
"RepoDigests"
)[0].split('@')[1] or image.id

return self._remove_sha_prefix(digest)

def update(self):
updated_service_tuples = []
self.monitored = self.monitor_filter()
Expand All @@ -421,7 +407,7 @@ def update(self):
image_string = service.attrs['Spec']['TaskTemplate']['ContainerSpec']['Image']
if '@' in image_string:
tag = image_string.split('@')[0]
sha256 = self._remove_sha_prefix(image_string.split('@')[1])
sha256 = remove_sha_prefix(image_string.split('@')[1])
else:
self.logger.error('No image SHA for %s. Skipping', image_string)
continue
Expand All @@ -431,7 +417,7 @@ def update(self):
except ConnectionError:
continue

latest_image_sha256 = self._get_digest(latest_image)
latest_image_sha256 = get_digest(latest_image)
self.logger.debug('Latest sha256 for %s is %s', tag, latest_image_sha256)

if sha256 != latest_image_sha256:
Expand Down
15 changes: 15 additions & 0 deletions pyouroboros/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,18 @@ def set_properties(old, new, self_name=None):
}

return properties


def remove_sha_prefix(digest):
if digest.startswith("sha256:"):
return digest[7:]
return digest


def get_digest(image):
digest = image.attrs.get(
"Descriptor", {}
).get("digest") or image.attrs.get(
"RepoDigests"
)[0].split('@')[1] or image.id
return remove_sha_prefix(digest)

0 comments on commit 3599f05

Please sign in to comment.