From d2c5e3d544a25514e6372b86b8792d2c35bf3d38 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Thu, 19 Apr 2018 13:31:45 +0530 Subject: [PATCH] Check if production dependencies are installed --- bench/commands/setup.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bench/commands/setup.py b/bench/commands/setup.py index ccc3148e..2d9da784 100755 --- a/bench/commands/setup.py +++ b/bench/commands/setup.py @@ -55,10 +55,15 @@ def setup_production(user, yes=False): from bench.config.production_setup import setup_production from bench.utils import run_playbook # Install prereqs for production - exec_cmd("sudo pip install ansible") - exec_cmd("bench setup role fail2ban") - exec_cmd("bench setup role nginx") - exec_cmd("bench setup role supervisor") + from distutils.spawn import find_executable + if not find_executable('ansible'): + exec_cmd("sudo pip install ansible") + if not find_executable('fail2ban-client'): + exec_cmd("bench setup role fail2ban") + if not find_executable('nginx'): + exec_cmd("bench setup role nginx") + if not find_executable('supervisord'): + exec_cmd("bench setup role supervisor") setup_production(user=user, yes=yes)