Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Drupal
drupalizer
Compare Revisions
f669a4a1a2a4f9a7aa76a7001718bd95c18ced6f...a5b0f160ef982cc826d0a542f67ad8f5040c88f5
Commits (5)
Remove not used import and change the name of the migration scripts
· 6d51163d
Ernesto Rodriguez Ortiz
authored
Apr 15, 2016
6d51163d
Fix bug in the use of os.path and made hook_execute use the params.
· 260771d5
Ernesto Rodriguez Ortiz
authored
Apr 15, 2016
260771d5
Execute hook_post_update before drush updb.
· 150ad295
Ernesto Rodriguez Ortiz
authored
Apr 15, 2016
150ad295
Copy aliases file instead of creating symlink
· a1993b25
Philippe Mouchel
authored
Apr 15, 2016
a1993b25
Use path.join to generate makefile path
· a5b0f160
Philippe Mouchel
authored
Apr 15, 2016
a5b0f160
Hide whitespace changes
Inline
Side-by-side
deploy.py
View file @
a5b0f160
...
...
@@ -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-site
s {} {}'
.
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"
:
...
...
drush.py
View file @
a5b0f160
...
...
@@ -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
...
...
helpers.py
View file @
a5b0f160
...
...
@@ -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
...
...