Skip to content

Commit

Permalink
Docstring changes and delete stopped aimmo containers as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mrniket committed Oct 31, 2018
1 parent 6145f7a commit 91c804a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions aimmo_runner/docker_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@

def vm_none_enabled(raw_env_settings):
"""
Check if the VM driver is enabled or not. This is important to see where
the environment variables live.
Check if the VM driver is enabled or not. This is important to see where the environment variables live.
:param raw_env_settings: String that is returned by the 'minikube docker-env' command.
:return: Boolean value indicating if enabled or not.
"""
return False if 'driver does not support' in raw_env_settings else True

def create_docker_client(raw_env_settings):
"""
Creates a docker client using the python SDK.
Create a docker client using the python SDK.
:param raw_env_settings: String that is returned by the 'minikube docker-env' command.
:return:
"""
Expand All @@ -36,7 +37,8 @@ def create_docker_client(raw_env_settings):

def build_docker_images(minikube=None):
"""
Finds environment settings and builds docker images for each directory.
Find environment settings and builds docker images for each directory.
:param minikube: Executable command to run in terminal.
"""
print('Building docker images')
Expand All @@ -59,14 +61,16 @@ def build_docker_images(minikube=None):


def delete_containers():
"""Delete any containers starting with 'aimmo'."""
client = docker.from_env(version='auto')

containers = [container for container in client.containers.list() if container.name.startswith('aimmo')]
containers = [container for container in client.containers.list(all=True) if container.name.startswith('aimmo')]
for container in containers:
container.remove(force=True)


def start_game_creator():
"""Start an aimmo-game-creator docker container."""
os_name = platform.system()
client = docker.from_env(version='auto')
template = {
Expand Down

0 comments on commit 91c804a

Please sign in to comment.