Commit 241b2f91 authored by Samuel Sirois's avatar Samuel Sirois
Browse files

Check for git repositories status precicely when needed

The drush.make command is the one dangerous method. The test should be
done there and not on all methods calling it.
parent f464a29d
......@@ -10,23 +10,18 @@ from fabric.api import task, env, execute
from fabric.colors import red
from fabric.contrib.console import confirm
import git
@task
def init():
"""
Complete local installation process, used generally when building the docker image for install and configure Drupal.
"""
if (git.isGitDirty()):
if (confirm(red('There are warnings on status of your repositories. '
'Do you want to continue and reset all changes to remote repositories'' states?'), default=False)):
execute(docker.image_create)
execute(docker.container_start)
execute(drush.make, 'install')
execute(drush.site_install, host='root@{}'.format(env.container_ip))
execute(drush.aliases)
execute(behat.init, host='root@{}'.format(env.container_ip))
execute(docker.image_create)
execute(docker.container_start)
execute(drush.make, 'install')
execute(drush.site_install, host='root@{}'.format(env.container_ip))
execute(drush.aliases)
execute(behat.init, host='root@{}'.format(env.container_ip))
......@@ -51,12 +46,9 @@ def install():
Run the full installation process.
"""
if (git.isGitDirty()):
if (confirm(red('There are warnings on status of your repositories. '
'Do you want to continue and reset all changes to remote repositories'' states?'), default=False)):
execute(drush.make, 'install')
execute(drush.site_install)
execute(behat.init)
execute(drush.make, 'install')
execute(drush.site_install)
execute(behat.init)
......@@ -67,12 +59,9 @@ def update():
Update the full codebase and run the availabe database updates.
"""
if (git.isGitDirty()):
if (confirm(red('There are warnings on status of your repositories. '
'Do you want to continue and reset all changes to remote repositories'' states?'), default=False)):
execute(drush.make, 'update')
execute(drush.updatedb)
execute(behat.init)
execute(drush.make, 'update')
execute(drush.updatedb)
execute(behat.init)
@task
......
......@@ -20,12 +20,15 @@ from __future__ import unicode_literals
from fabric.api import task, roles, env
from fabric.contrib.console import confirm
from fabric.colors import red, green
from fabric.utils import abort
from datetime import datetime
import helpers as h
import core as c
from git import isGitDirty
@task(alias='make')
@roles('local')
......@@ -34,6 +37,12 @@ def make(action='install'):
Build the platform by running the Makefile specified in the local_vars.py configuration file.
"""
if env.get('interactive_mode', True):
if (isGitDirty()):
if (not confirm(red('There are warnings on status of your repositories. '
'Do you want to continue and reset all changes to remote repositories'' states?'), default=False)):
abort('Aborting "drush {}" since there might be a risk of loosing local data.'.format(action))
drush_opts = "--prepare-install " if action != 'update' else ''
# Update profile codebase
......
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