mirror of
https://github.com/frappe/bench.git
synced 2024-11-12 00:06:36 +00:00
fix: dont abort script if not overwriting scripts (#919)
* fix: dont abort script if not overwriting scripts why: currently, running of `bench ` or `bench setup production` creates nginx conf files and asks for confirmation before overwriting them. in case user doesnt want to overwrite files, `setup production` and `lets-encrypt` is exitted abrubtly and nginx isnt started again after * fix: use click.confirm instead of six.moves.input * fix: use click.confirm instead of six.moves.input * chore: remove unused imports
This commit is contained in:
parent
ddcd2c11a1
commit
ec1343c0fa
@ -1,8 +1,24 @@
|
||||
import os, json, click, random, string, hashlib
|
||||
from bench.utils import get_sites, get_bench_name, exec_cmd
|
||||
# imports - standard imports
|
||||
import hashlib
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
|
||||
# imports - third party imports
|
||||
import click
|
||||
from six import string_types
|
||||
|
||||
# imports - module imports
|
||||
from bench.utils import get_bench_name, get_sites
|
||||
|
||||
|
||||
def make_nginx_conf(bench_path, yes=False):
|
||||
conf_path = os.path.join(bench_path, "config", "nginx.conf")
|
||||
|
||||
if not yes and os.path.exists(conf_path):
|
||||
if not click.confirm('nginx.conf already exists and this will overwrite it. Do you want to continue?'):
|
||||
return
|
||||
|
||||
from bench import env
|
||||
from bench.config.common_site_config import get_config
|
||||
|
||||
@ -37,10 +53,6 @@ def make_nginx_conf(bench_path, yes=False):
|
||||
|
||||
nginx_conf = template.render(**template_vars)
|
||||
|
||||
conf_path = os.path.join(bench_path, "config", "nginx.conf")
|
||||
if not yes and os.path.exists(conf_path):
|
||||
click.confirm('nginx.conf already exists and this will overwrite it. Do you want to continue?',
|
||||
abort=True)
|
||||
|
||||
with open(conf_path, "w") as f:
|
||||
f.write(nginx_conf)
|
||||
|
Loading…
Reference in New Issue
Block a user