Skip to content

Commit

Permalink
Pushed by gbuild.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Middleton committed Dec 15, 2017
1 parent d668685 commit 0b27112
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
7 changes: 4 additions & 3 deletions gaze-control/gazectl/gazectl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import sys

import docker
from tabulate import tabulate

# from gazelib.compose import GazeCompose
from gazelib.config import GazeConfig
from gazelib.container import GazeContainer
Expand All @@ -30,6 +28,7 @@
from gazelib.network import GazeNetwork
from gazelib.template import GazeTemplate
from gazelib.volume import GazeVolume
from tabulate import tabulate

# Initialise a global logger.
try:
Expand Down Expand Up @@ -225,7 +224,9 @@ def __call__(self):
try:
containers = self.docker_client.containers.list(
all=True,
filters={'label': 'gaze.service'}
filters={
'label': 'gaze.service'
}
)

except docker.errors.APIError:
Expand Down
4 changes: 3 additions & 1 deletion gaze-control/gazectl/gazelib/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def run(self, name, image, environment, volumes, networks, ports,

except docker.errors.APIError as e:
self.log(
"The Docker daemon returned the following error:\n{}".format(e),
"The Docker daemon returned the following error:\n{}".format(
e),
'exception'
)
sys.exit(1)
Expand Down Expand Up @@ -124,6 +125,7 @@ def run(self, name, image, environment, volumes, networks, ports,
return container

def stop(self, name):
pass
# TODO: Dafuq is there no stop method?
# self.docker_client.containers.stop()

Expand Down
4 changes: 3 additions & 1 deletion gaze-control/gazectl/gazelib/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def create(self, name):
try:
network = self.docker_client.networks.create(
name=name,
labels={"gaze.network": name}
labels={
"gaze.network": name
}
)

except docker.errors.APIError:
Expand Down
18 changes: 14 additions & 4 deletions gaze-control/gazectl/gazelib/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,22 @@ def up(self):
"ADVERTISE_IP=0.0.0.0"
],
volumes={
'/etc/localtime': {'bind': '/etc/localtime', 'mode': 'ro'}
'/etc/localtime': {
'bind': '/etc/localtime',
'mode': 'ro'
}
},
networks=['gaze_internal'],
ports={'32400/tcp': 32400},
restart_policy={"Name": "on-failure", "MaximumRetryCount": 5},
labels={"gaze.service": "plex"}
ports={
'32400/tcp': 32400
},
restart_policy={
"Name": "on-failure",
"MaximumRetryCount": 5
},
labels={
"gaze.service": "plex"
}
)

self.log("Success!", 'success')
Expand Down
6 changes: 4 additions & 2 deletions gaze-control/gazectl/gazelib/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"""
import sys

from jinja2 import Environment, FileSystemLoader
from jinja2 import Environment, \
FileSystemLoader

from .log import GazeLog

Expand Down Expand Up @@ -54,7 +55,8 @@ def render(self, template, items, destination):

self.log("Success!", 'success')

self.log("Writing template to file ({})...".format(destination), 'info')
self.log("Writing template to file ({})...".format(destination),
'info')
try:
with open(destination, "w") as file:
file.write(rendered)
Expand Down
4 changes: 3 additions & 1 deletion gaze-control/gazectl/gazelib/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ def create(self, name, driver='local', driver_opts=None):
name=name,
driver=driver,
driver_opts=driver_opts,
labels={"gaze.volume": name}
labels={
"gaze.volume": name
}
)

except docker.errors.APIError:
Expand Down

0 comments on commit 0b27112

Please sign in to comment.