add machine name to docker
This commit is contained in:
parent
e83adf4a15
commit
0e69a5d65a
2 changed files with 23 additions and 4 deletions
|
|
@ -13,17 +13,27 @@ def docker_ip():
|
||||||
configuration = env.config
|
configuration = env.config
|
||||||
|
|
||||||
if configuration.docker.database.host == 'local':
|
if configuration.docker.database.host == 'local':
|
||||||
docker_cmd = 'docker-machine ip default'
|
docker_cmd = 'docker-machine ip %s' % \
|
||||||
|
configuration.docker.machine
|
||||||
|
|
||||||
return run(docker_cmd)
|
return run(docker_cmd)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return configuration.docker.database.host
|
return configuration.docker.database.host
|
||||||
|
|
||||||
|
|
||||||
def docker_run(cmd):
|
def docker_run(cmd):
|
||||||
from fabric.context_managers import prefix
|
from fabric.context_managers import prefix
|
||||||
|
configuration = env.config
|
||||||
|
|
||||||
docker_eval = "eval $(docker-machine env default)"
|
if configuration.docker.machine:
|
||||||
with prefix(docker_eval):
|
docker_eval = "eval $(docker-machine env %s)" % \
|
||||||
|
configuration.docker.machine
|
||||||
|
|
||||||
|
with prefix(docker_eval):
|
||||||
|
run(cmd)
|
||||||
|
|
||||||
|
else:
|
||||||
run(cmd)
|
run(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -863,7 +863,7 @@ def _init_docker(configuration, layout, config):
|
||||||
project_branch=configuration.project.branch)
|
project_branch=configuration.project.branch)
|
||||||
|
|
||||||
if 'name' in config['docker'] and config['docker']['name']:
|
if 'name' in config['docker'] and config['docker']['name']:
|
||||||
configuration.docker.name = config['docker']['name']
|
configuration.docker.name = config['docker']['name']
|
||||||
|
|
||||||
#
|
#
|
||||||
# host information
|
# host information
|
||||||
|
|
@ -871,6 +871,15 @@ def _init_docker(configuration, layout, config):
|
||||||
if 'host' in config['docker']:
|
if 'host' in config['docker']:
|
||||||
configuration.docker.host = config['docker']['host']
|
configuration.docker.host = config['docker']['host']
|
||||||
|
|
||||||
|
#
|
||||||
|
# get machine name for docker-machine if exists
|
||||||
|
|
||||||
|
configuration.docker.machine = None
|
||||||
|
|
||||||
|
if 'machine' in config['docker']:
|
||||||
|
configuration.docker.machine = config['docker']['machine']
|
||||||
|
|
||||||
|
#
|
||||||
#
|
#
|
||||||
# configuration info for docker database
|
# configuration info for docker database
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue