added debugging to run, create - docker_service_name property passed to jinja file
This commit is contained in:
parent
f8e3efc3da
commit
fe5c77a5bf
1 changed files with 24 additions and 5 deletions
|
|
@ -36,6 +36,9 @@ def docker_run(cmd):
|
||||||
from fabric.context_managers import prefix
|
from fabric.context_managers import prefix
|
||||||
configuration = env.config
|
configuration = env.config
|
||||||
|
|
||||||
|
if env.debug:
|
||||||
|
logger = loggify("docker", 'create')
|
||||||
|
|
||||||
# use executize to return either the methods sudo or run from
|
# use executize to return either the methods sudo or run from
|
||||||
# fabric.operations
|
# fabric.operations
|
||||||
#
|
#
|
||||||
|
|
@ -53,10 +56,16 @@ def docker_run(cmd):
|
||||||
configuration.docker.machine
|
configuration.docker.machine
|
||||||
|
|
||||||
with prefix(docker_eval):
|
with prefix(docker_eval):
|
||||||
_execute(cmd)
|
if env.debug:
|
||||||
|
logger.debug("_execute(cmd): %s" % cmd)
|
||||||
|
else:
|
||||||
|
_execute(cmd)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
_execute(cmd)
|
if env.debug:
|
||||||
|
logger.debug("_execute(cmd): %s" % cmd)
|
||||||
|
else:
|
||||||
|
_execute(cmd)
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
|
|
@ -161,7 +170,7 @@ def create(container='database'):
|
||||||
NOTE:
|
NOTE:
|
||||||
"container" must have a corresponding value in configuration file
|
"container" must have a corresponding value in configuration file
|
||||||
"""
|
"""
|
||||||
# configuration = env.config
|
configuration = env.config
|
||||||
|
|
||||||
if env.debug:
|
if env.debug:
|
||||||
logger = loggify("docker", 'create')
|
logger = loggify("docker", 'create')
|
||||||
|
|
@ -177,12 +186,18 @@ under "docker"
|
||||||
|
|
||||||
print_console(info_msg, numsep=60)
|
print_console(info_msg, numsep=60)
|
||||||
|
|
||||||
|
docker_service_name = configuration.docker.database.service_name
|
||||||
|
|
||||||
dockercompose_cmd = \
|
dockercompose_cmd = \
|
||||||
"docker-compose -f {build_path} up -d".format(build_path=build_path)
|
"docker-compose -f {build_path} up -d {docker_service_name}".format(
|
||||||
|
build_path=build_path,
|
||||||
|
docker_service_name=docker_service_name
|
||||||
|
)
|
||||||
|
|
||||||
if env.debug:
|
if env.debug:
|
||||||
logger.debug("build_path : %s" % build_path)
|
logger.debug("build_path : %s" % build_path)
|
||||||
logger.debug("dockercompose_cmd : %s" % dockercompose_cmd)
|
logger.debug("dockercompose_cmd : %s" % dockercompose_cmd)
|
||||||
|
logger.debug("docker_service_name : %s" % docker_service_name)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
docker_run(dockercompose_cmd)
|
docker_run(dockercompose_cmd)
|
||||||
|
|
@ -204,6 +219,9 @@ def start(create=False):
|
||||||
container_type - the type of container to start
|
container_type - the type of container to start
|
||||||
create - craete if container has not yet been created
|
create - craete if container has not yet been created
|
||||||
"""
|
"""
|
||||||
|
if env.debug:
|
||||||
|
logger = loggify("docker", 'create')
|
||||||
|
|
||||||
configuration = env.config
|
configuration = env.config
|
||||||
create = booleanize(create)
|
create = booleanize(create)
|
||||||
|
|
||||||
|
|
@ -211,7 +229,8 @@ def start(create=False):
|
||||||
configuration.docker.database.container_name
|
configuration.docker.database.container_name
|
||||||
|
|
||||||
if env.debug:
|
if env.debug:
|
||||||
print("docker_run(%s)" % docker_start)
|
logger.debug("docker_run(%s)" % docker_start)
|
||||||
|
docker_run(docker_start)
|
||||||
else:
|
else:
|
||||||
docker_run(docker_start)
|
docker_run(docker_start)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue