Commit e32b1568 authored by Samuel Sirois's avatar Samuel Sirois
Browse files

Change the interactive_mode environment variable from string to boolean

It was confusing to test on a string but passing a boolean as the default
value.
parent 241b2f91
...@@ -32,7 +32,7 @@ Those are global project parameters mandatory to Drupalizer. ...@@ -32,7 +32,7 @@ Those are global project parameters mandatory to Drupalizer.
|Project root directory. |Project root directory.
|_interactive_mode_ |_interactive_mode_
|If false, no prompt. Useful for Jenkins. |If False, no prompt. Useful for Jenkins.
|_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) != 'false': if env.get('interactive_mode', 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) != 'false': if env.get('interactive_mode', 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) != 'false': if env.get('interactive_mode', 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))
......
...@@ -50,20 +50,19 @@ def make(action='install'): ...@@ -50,20 +50,19 @@ 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 env.get('interactive_mode', True) == 'false': if not env.get('interactive_mode', True):
drush_opts += "--translations=fr " drush_opts += "--translations=fr "
elif confirm(red('Say [Y] to {} the site at {} with the French translation, if you say [n] ' elif confirm(red('Say [Y] to {} the site at {} with the French translation, if you say [n] '
'the site will be installed in English only'.format(action, env.site_root))): 'the site will be installed in English only'.format(action, env.site_root))):
drush_opts += "--translations=fr " drush_opts += "--translations=fr "
if env.get('interactive_mode', True) != 'false': if env.get('interactive_mode', 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))
with h.fab_cd('local', env.site_root): with h.fab_cd('local', env.site_root):
h.fab_run('local', 'drush make {} {} -y'.format(drush_opts, env.makefile)) h.fab_run('local', 'drush make {} {} -y'.format(drush_opts, env.makefile))
@task @task
@roles('local') @roles('local')
def aliases(): def aliases():
......
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