Пример #1
0
    def run(self):

        # Check which shell.
        shell = "/bin/sh" if self.options["--sh"] else "/bin/bash"

        # Get the docker client.
        docker_client = docker.from_env()

        # Determine the app.
        app = self.options["<app>"]
        if App.check_running(docker_client, app):

            # Execute a shell.
            subprocess.call(["docker-compose", "exec", app, shell])
Пример #2
0
    def run(self):

        # Get a docker client.
        docker_client = docker.from_env()

        # Check all the build parameters.
        apps = App.get_apps()
        for app in apps:

            # Check images.
            if not App.check_docker_images(docker_client, app):
                logger.error("({}) Container image does not exist, build and"
                             " try again...".format(app))
                return

            # Ensure it is running.
            if not App.check_running(docker_client, app):
                logger.error(
                    "({}) Container is not running, ensure all containers"
                    " are started...".format(app))
                return

        # Capture and redirect output.
        Stack.run(["nosetests", "-s", "-v"])