fixed problem with docker ip when running on local machine, just give it localhost
This commit is contained in:
parent
fe5c77a5bf
commit
cfa2b79788
3 changed files with 25 additions and 8 deletions
|
|
@ -118,6 +118,8 @@ def execute_sql(script_name, add_dbname=True, is_admin=False):
|
|||
if env.debug:
|
||||
logger.debug("db_name = %s" % db_name)
|
||||
logger.debug("run( %s ) " % psql_command)
|
||||
logger.debug("configuration.server.database.host: %s" %
|
||||
configuration.server.database.host)
|
||||
else:
|
||||
run_database_command(psql_command, user)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ from .utils import executize
|
|||
@task
|
||||
def docker_ip():
|
||||
configuration = env.config
|
||||
_execute = executize("run")
|
||||
|
||||
# in the configuration file under docker,database, if host is set to local
|
||||
# use docker-machine, because it means we are probably on OSX
|
||||
|
|
@ -19,14 +18,17 @@ def docker_ip():
|
|||
# return the host ip address that we set in configuration
|
||||
|
||||
if configuration.docker.database.host == 'local':
|
||||
docker_cmd = 'docker-machine ip %s' % \
|
||||
configuration.docker.machine
|
||||
# docker_cmd = 'docker-machine ip %s' % \
|
||||
# configuration.docker.machine
|
||||
|
||||
docker_cmd = "docker inspect -f '{{"
|
||||
docker_cmd += "range.NetworkSettings.Networks}}"
|
||||
docker_cmd += "{{.IPAddress}}{{end}}' pedantic_tu"
|
||||
# docker_cmd = "docker inspect -f '{{"
|
||||
# docker_cmd += "range.NetworkSettings.Networks}}"
|
||||
# docker_cmd += "{{.IPAddress}}{{end}}' pedantic_tu"
|
||||
|
||||
return _execute(docker_cmd)
|
||||
# _execute = executize("run")
|
||||
# return _execute(docker_cmd)
|
||||
|
||||
return "localhost"
|
||||
|
||||
else:
|
||||
return configuration.docker.database.host
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import fabric.utils
|
|||
from . import maintenance
|
||||
from fabric.api import env, task
|
||||
|
||||
# from utils import loggify
|
||||
from .utils import loggify
|
||||
|
||||
# import configuration values from PRJ_ROOT/sites/meta/configuration
|
||||
|
||||
|
|
@ -522,12 +522,25 @@ def _init_database(configuration, config, layout):
|
|||
initialize the database server information
|
||||
"""
|
||||
|
||||
if env.debug:
|
||||
logger = loggify('initialize', '_init_database')
|
||||
|
||||
configuration.server.addbranch('database')
|
||||
|
||||
configuration.server.database.name = config['database']['name']
|
||||
configuration.server.database.port = config['database']['port']
|
||||
configuration.server.database.host = config['database']['host']
|
||||
|
||||
if env.debug:
|
||||
logger.debug("server.database.name: %s"
|
||||
% configuration.server.database.name)
|
||||
|
||||
logger.debug("server.database.port: %s"
|
||||
% configuration.server.database.port)
|
||||
|
||||
logger.debug("server.database.host: %s"
|
||||
% configuration.server.database.host)
|
||||
|
||||
configuration.server.database.backend = config['database']['backend']
|
||||
|
||||
configuration.server.database.user = \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue