Commit 3478d904 authored by Ernesto Rodriguez Ortiz's avatar Ernesto Rodriguez Ortiz
Browse files

Fix bug: dont crash if the drush aliases don't exists.

Add support for the config_installer profile
parent ad1ddc7d
Pipeline #2040 passed with stages
in 1 minute and 56 seconds
...@@ -129,13 +129,14 @@ def hook_execute(cmds=env.hook_post_install, service=env.services['php']): ...@@ -129,13 +129,14 @@ def hook_execute(cmds=env.hook_post_install, service=env.services['php']):
dk_run(service, cmd=cmd) dk_run(service, cmd=cmd)
def is_core_profile(profile_name): def is_custom_profile(profile_name):
""" """
Helper function to check if the profile is a core profile Helper function to check if the profile is a core profile
:param profile_name: :param profile_name:
:return: :return:
""" """
return profile_name in ('minimal', 'standard', 'testing') return profile_name not in ('minimal', 'standard', 'testing',
'config_installer')
def remove_from_hosts(hostname): def remove_from_hosts(hostname):
......
...@@ -42,7 +42,7 @@ def make(action='install'): ...@@ -42,7 +42,7 @@ def make(action='install'):
drush_opts = "--prepare-install " if action != 'update' else '' drush_opts = "--prepare-install " if action != 'update' else ''
# Update profile codebase # Update profile codebase
if env.site_profile and not is_core_profile(env.site_profile): if env.site_profile_repo and is_custom_profile(env.site_profile):
update_profile() update_profile()
if env.site_languages: if env.site_languages:
...@@ -80,11 +80,13 @@ def aliases(): ...@@ -80,11 +80,13 @@ def aliases():
if os.path.exists('{}/aliases.drushrc.php'.format(drush_aliases)): if os.path.exists('{}/aliases.drushrc.php'.format(drush_aliases)):
local('rm {}/aliases.drushrc.php'.format(drush_aliases)) local('rm {}/aliases.drushrc.php'.format(drush_aliases))
local('cp {}/conf/aliases.drushrc.php {}/'.format(workspace, if os.path.exists('{}/conf/aliases.drushrc.php'.format(workspace)):
drush_aliases)) local('cp {}/conf/aliases.drushrc.php {}/'.format(workspace,
print(green('Drush aliases have been copied to {} directory.' drush_aliases))
''.format(drush_aliases))) print(green('Drush aliases have been copied to {} directory.'
''.format(drush_aliases)))
else:
print(green('Drush aliases have not been found'))
@task @task
def updatedb(): def updatedb():
...@@ -113,10 +115,14 @@ def site_install(): ...@@ -113,10 +115,14 @@ def site_install():
site_admin_pass = env.site_admin_pass site_admin_pass = env.site_admin_pass
site_subdir = env.site_subdir site_subdir = env.site_subdir
profile_opts = ''
locale = '' locale = ''
if env.site_languages: if env.site_languages:
locale = '--locale="{}"'.format(env.site_languages.split(',')[0]) locale = '--locale="{}"'.format(env.site_languages.split(',')[0])
if env.site_conf and env.site_profile == "config_installer":
profile_opts += " config_installer " \
"config_installer_sync_configure_form.sync_directory=" \
"{}".format(env.site_conf)
dk_run(service, user='root', dk_run(service, user='root',
cmd='chown -R {}:{} .'.format(env.apache_userid, env.local_userid)) cmd='chown -R {}:{} .'.format(env.apache_userid, env.local_userid))
if env.drupal_version == 8: if env.drupal_version == 8:
...@@ -124,11 +130,12 @@ def site_install(): ...@@ -124,11 +130,12 @@ def site_install():
dk_run( dk_run(
service, service,
cmd="drush site-install {} {} --db-url=mysql://{}:{}@{}/{} " cmd="drush site-install {} {} {} --db-url=mysql://{}:{}@{}/{} "
"--site-name='{}' --account-name={} --account-pass={} " "--site-name='{}' --account-name={} --account-pass={} "
"--sites-subdir={} -y" "--sites-subdir={} -y"
"".format(profile, locale, db_user, db_pass, db_host, db_name, "".format(profile, profile_opts, locale, db_user, db_pass,
site_name, site_admin_name, site_admin_pass, site_subdir) db_host, db_name, site_name, site_admin_name,
site_admin_pass, site_subdir)
) )
fix_permissions() fix_permissions()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment