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
|
||||
configuration = env.config
|
||||
|
||||
if env.debug:
|
||||
logger = loggify("docker", 'create')
|
||||
|
||||
# use executize to return either the methods sudo or run from
|
||||
# fabric.operations
|
||||
#
|
||||
|
|
@ -53,8 +56,14 @@ def docker_run(cmd):
|
|||
configuration.docker.machine
|
||||
|
||||
with prefix(docker_eval):
|
||||
if env.debug:
|
||||
logger.debug("_execute(cmd): %s" % cmd)
|
||||
else:
|
||||
_execute(cmd)
|
||||
|
||||
else:
|
||||
if env.debug:
|
||||
logger.debug("_execute(cmd): %s" % cmd)
|
||||
else:
|
||||
_execute(cmd)
|
||||
|
||||
|
|
@ -161,7 +170,7 @@ def create(container='database'):
|
|||
NOTE:
|
||||
"container" must have a corresponding value in configuration file
|
||||
"""
|
||||
# configuration = env.config
|
||||
configuration = env.config
|
||||
|
||||
if env.debug:
|
||||
logger = loggify("docker", 'create')
|
||||
|
|
@ -177,12 +186,18 @@ under "docker"
|
|||
|
||||
print_console(info_msg, numsep=60)
|
||||
|
||||
docker_service_name = configuration.docker.database.service_name
|
||||
|
||||
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:
|
||||
logger.debug("build_path : %s" % build_path)
|
||||
logger.debug("dockercompose_cmd : %s" % dockercompose_cmd)
|
||||
logger.debug("docker_service_name : %s" % docker_service_name)
|
||||
|
||||
else:
|
||||
docker_run(dockercompose_cmd)
|
||||
|
|
@ -204,6 +219,9 @@ def start(create=False):
|
|||
container_type - the type of container to start
|
||||
create - craete if container has not yet been created
|
||||
"""
|
||||
if env.debug:
|
||||
logger = loggify("docker", 'create')
|
||||
|
||||
configuration = env.config
|
||||
create = booleanize(create)
|
||||
|
||||
|
|
@ -211,7 +229,8 @@ def start(create=False):
|
|||
configuration.docker.database.container_name
|
||||
|
||||
if env.debug:
|
||||
print("docker_run(%s)" % docker_start)
|
||||
logger.debug("docker_run(%s)" % docker_start)
|
||||
docker_run(docker_start)
|
||||
else:
|
||||
docker_run(docker_start)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue