Commit 57053925 authored by Philippe Mouchel's avatar Philippe Mouchel
Browse files

Use a env var provided by Fabri instead of inter..

active_mode, cause we can not override its value as it's defined in a file
parent fb7d9b76
...@@ -31,8 +31,9 @@ Those are global project parameters mandatory to Drupalizer. ...@@ -31,8 +31,9 @@ Those are global project parameters mandatory to Drupalizer.
|_workspace_ |_workspace_
|Project root directory. |Project root directory.
|_interactive_mode_ |_always_use_pty_
|If False, no prompt. Useful for Jenkins. |This env var is defined by Fabric itself, and it's defaut value is True.
|You can easily pass it to False, addinf --no-pty to your fab command line. Useful in Jenkins jobs.
|_locale_ |_locale_
|If True, install the site in French. |If True, install the site in French.
......
...@@ -141,7 +141,7 @@ def container_start(role='local'): ...@@ -141,7 +141,7 @@ def container_start(role='local'):
# If container was successful build, get the IP address and show it to the user. # If container was successful build, get the IP address and show it to the user.
env.container_ip = h.fab_run(role, 'docker inspect -f "{{{{.NetworkSettings.IPAddress}}}}" ' env.container_ip = h.fab_run(role, 'docker inspect -f "{{{{.NetworkSettings.IPAddress}}}}" '
'{}_container'.format(env.project_name), capture=True) '{}_container'.format(env.project_name), capture=True)
if env.get('interactive_mode', True): if env.get('always_use_pty', True):
h.fab_update_hosts(env.container_ip, env.site_hostname) h.fab_update_hosts(env.container_ip, env.site_hostname)
print(green('Docker container {}_container was build successful. ' print(green('Docker container {}_container was build successful. '
...@@ -165,7 +165,7 @@ def container_stop(role='local'): ...@@ -165,7 +165,7 @@ def container_stop(role='local'):
""" """
with h.fab_cd(role, env.workspace): with h.fab_cd(role, env.workspace):
if '{}_container'.format(env.project_name) in docker_ps(): if '{}_container'.format(env.project_name) in docker_ps():
if env.get('interactive_mode', True): if env.get('always_use_pty', True):
h.fab_remove_from_hosts(env.site_hostname) h.fab_remove_from_hosts(env.site_hostname)
h.fab_run(role, 'docker stop {}_container'.format(env.project_name)) h.fab_run(role, 'docker stop {}_container'.format(env.project_name))
print(green('Docker container {}_container was successful stopped'.format(env.project_name))) print(green('Docker container {}_container was successful stopped'.format(env.project_name)))
...@@ -183,7 +183,7 @@ def container_remove(role='local'): ...@@ -183,7 +183,7 @@ def container_remove(role='local'):
with h.fab_cd(role, env.workspace): with h.fab_cd(role, env.workspace):
if '{}_container'.format(env.project_name) in docker_ps(): if '{}_container'.format(env.project_name) in docker_ps():
if env.get('interactive_mode', True): if env.get('always_use_pty', True):
h.fab_remove_from_hosts(env.site_hostname) h.fab_remove_from_hosts(env.site_hostname)
h.fab_run(role, 'docker rm -f {}_container'.format(env.project_name)) h.fab_run(role, 'docker rm -f {}_container'.format(env.project_name))
......
...@@ -37,7 +37,7 @@ def make(action='install'): ...@@ -37,7 +37,7 @@ def make(action='install'):
Build the platform by running the Makefile specified in the local_vars.py configuration file. Build the platform by running the Makefile specified in the local_vars.py configuration file.
""" """
if env.get('interactive_mode', True): if env.get('always_use_pty', True):
if (isGitDirty()): if (isGitDirty()):
if (not confirm(red('There are warnings on status of your repositories. ' 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)): 'Do you want to continue and reset all changes to remote repositories'' states?'), default=False)):
...@@ -50,13 +50,13 @@ def make(action='install'): ...@@ -50,13 +50,13 @@ def make(action='install'):
drush_opts += "--contrib-destination=profiles/{} ".format(env.site_profile) drush_opts += "--contrib-destination=profiles/{} ".format(env.site_profile)
h.update_profile() h.update_profile()
if not env.get('interactive_mode', True): if not env.get('always_use_pty', True):
drush_opts += "--translations=" + env.site_languages + " " drush_opts += "--translations=" + env.site_languages + " "
elif confirm(red('Say [Y] to {} the site at {} with the specified translation(s): {}. If you say [n] ' elif confirm(red('Say [Y] to {} the site at {} with the specified translation(s): {}. If you say [n] '
'the site will be installed in English only'.format(action, env.site_root, env.site_languages))): 'the site will be installed in English only'.format(action, env.site_root, env.site_languages))):
drush_opts += "--translations=" + env.site_languages + " " drush_opts += "--translations=" + env.site_languages + " "
if env.get('interactive_mode', True): if env.get('always_use_pty', True):
drush_opts += " --working-copy --no-gitinfofile" drush_opts += " --working-copy --no-gitinfofile"
if not h.fab_exists('local', env.site_root): if not h.fab_exists('local', env.site_root):
h.fab_run('local', "mkdir {}".format(env.site_root)) h.fab_run('local', "mkdir {}".format(env.site_root))
......
...@@ -49,7 +49,7 @@ def _checkRepo(repoLocalPath): ...@@ -49,7 +49,7 @@ def _checkRepo(repoLocalPath):
filesStatusRawInfo = _getFilesStatusInformation() filesStatusRawInfo = _getFilesStatusInformation()
print green('Verify local files status against current HEAD commit...') print green('Verify local files status against current HEAD commit...')
nbWarnings += _checkFilesStatusVsHeadCommit(filesStatusRawInfo, remoteName) nbWarnings += _checkFilesStatusVsHeadCommit(filesStatusRawInfo)
localBranchesRawInfo = _getLocalBranchesInformation() localBranchesRawInfo = _getLocalBranchesInformation()
print green('Verify local branches exist on remote "' + remoteName + '"...'); print green('Verify local branches exist on remote "' + remoteName + '"...');
...@@ -61,7 +61,7 @@ def _checkRepo(repoLocalPath): ...@@ -61,7 +61,7 @@ def _checkRepo(repoLocalPath):
return nbWarnings return nbWarnings
def _checkFilesStatusVsHeadCommit(filesStatusRawInfo, remoteName): def _checkFilesStatusVsHeadCommit(filesStatusRawInfo):
nbWarnings = 0 nbWarnings = 0
addableFiles = [] addableFiles = []
if (len(filesStatusRawInfo) > 0): if (len(filesStatusRawInfo) > 0):
......
Supports Markdown
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