......@@ -153,7 +153,7 @@ def _aegir_remove_platform_without_sites(target, environment, platform):
:param platform The patern name of the platform in wich the sites will be migrated on
"""
aegir_path = target.get('aegir_path')
run('{}/remove-platform-wihout-sites {} {}'.format(aegir_path, environment, platform))
run('{}/remove-platforms {} {}'.format(aegir_path, environment, platform))
@task
......@@ -217,7 +217,7 @@ def migrate(environment):
if _is_aegir_deployment(target):
# Deploy to Aegir server.
platform = _aegir_platform_name(target, environment)
if env.get('migrate', "false") == "true":
if env.get('migrate_sites', "false") == "true":
_aegir_migrate_sites(target, environment, platform)
if env.get('remove_platforms', "false") == "true":
......
......@@ -72,7 +72,7 @@ def aliases():
# Create aliases
if h.fab_exists(role, '{}/aliases.drushrc.php'.format(drush_aliases)):
h.fab_run(role, 'rm {}/aliases.drushrc.php'.format(drush_aliases))
h.fab_run(role, 'ln -s {}/conf/aliases.drushrc.php .'.format(workspace))
h.fab_run(role, 'cp {}/conf/aliases.drushrc.php .'.format(workspace))
print(green('Drush aliases have been copied to {} directory.'.format(drush_aliases)))
......@@ -88,6 +88,7 @@ def updatedb():
with h.fab_cd(role, env.docker_site_root):
h.fab_run(role, 'drush updatedb -y')
h.hook_execute(env.hook_post_update, role)
@task
......@@ -130,7 +131,7 @@ def site_install():
if 'db_dump' in env and env.db_dump is not False:
c.db_import(env.db_dump, role)
h.hook_execute('post_install', role)
h.hook_execute(env.hook_post_install, role)
@task
......
......@@ -26,11 +26,6 @@ from fabric.contrib.files import exists
# Import socket to find the localhost IP address
import socket
import os
# Import datetime
from datetime import datetime
# Import default variables
from default_vars import *
......@@ -52,7 +47,7 @@ env.roledefs['local'] = ["{}@{}".format(user_name, host_name)]
env.roledefs['docker'] = ["root@{}".format(env.container_ip)]
env.builddir = path.join(env.workspace, 'build')
env.makefile = '{}/{}/{}'.format(env.builddir, env.site_profile, env.site_profile_makefile)
env.makefile = path.join(env.builddir, env.site_profile, env.site_profile_makefile)
env.site_drush_aliases = path.join(env.site_root, 'sites/all/drush')
def fab_run(role="local", cmd="", capture=False):
......@@ -124,9 +119,9 @@ def fab_remove_from_hosts(site_hostname):
def fab_update_container_ip(container_ip):
local('sed -i "/env.container_ip/d" {}/local_vars.py'.format(os.path.dirname(os.path.abspath(__file__))))
local('sed -i "/env.container_ip/d" {}/local_vars.py'.format(path.dirname(path.abspath(__file__))))
local('sed -i "/# Docker auto-added container IP/a env.container_ip = \'{}\'" '
'{}/local_vars.py'.format(''.join(container_ip), os.path.dirname(os.path.abspath(__file__))))
'{}/local_vars.py'.format(''.join(container_ip), path.dirname(path.abspath(__file__))))
def fab_update_hosts(ip, site_hostname):
......@@ -140,22 +135,19 @@ def fab_update_hosts(ip, site_hostname):
fab_add_to_hosts(ip, site_hostname)
def hook_execute(hook, role='docker'):
def hook_execute(cmds=env.hook_post_install, role='docker'):
"""
Execute a list of drush commands after the installation or update process
:param role Default 'role' where to run the task
:param cmds Drush commands to run, default to POST_INSTALL, it could be POST_UPDATE too.
"""
cmds = env.hook_post_install
for cmd in cmds:
with fab_cd(role, env.docker_site_root):
fab_run(role, cmd)
def copy_public_ssh_keys(role='local'):
"""
Copy your public SSH keys to use it in the docker container to connect to it using ssh protocol.
:param role Default 'role' where to run the task
......