2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

Merge pull request #1079 from ceefour/patch-3

fix(install): Allow override of frappe_branch and erpnext_branch
This commit is contained in:
gavin 2020-11-24 13:14:21 +05:30 committed by GitHub
commit cb05b17179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -247,12 +247,11 @@ def install_bench(args):
else: else:
frappe_branch = "version-{0}".format(args.version) frappe_branch = "version-{0}".format(args.version)
erpnext_branch = "version-{0}".format(args.version) erpnext_branch = "version-{0}".format(args.version)
else: # Allow override of frappe_branch and erpnext_branch, regardless of args.version (which always has a default set)
if args.frappe_branch: if args.frappe_branch:
frappe_branch = args.frappe_branch frappe_branch = args.frappe_branch
if args.erpnext_branch:
if args.erpnext_branch: erpnext_branch = args.erpnext_branch
erpnext_branch = args.erpnext_branch
extra_vars.update(frappe_branch=frappe_branch) extra_vars.update(frappe_branch=frappe_branch)
extra_vars.update(erpnext_branch=erpnext_branch) extra_vars.update(erpnext_branch=erpnext_branch)
@ -261,6 +260,10 @@ def install_bench(args):
extra_vars.update(bench_name=bench_name) extra_vars.update(bench_name=bench_name)
# Will install ERPNext production setup by default # Will install ERPNext production setup by default
if args.without_erpnext:
log("Initializing bench {bench_name}:\n\tFrappe Branch: {frappe_branch}\n\tERPNext will not be installed due to --without-erpnext".format(bench_name=bench_name, frappe_branch=frappe_branch))
else:
log("Initializing bench {bench_name}:\n\tFrappe Branch: {frappe_branch}\n\tERPNext Branch: {erpnext_branch}".format(bench_name=bench_name, frappe_branch=frappe_branch, erpnext_branch=erpnext_branch))
run_playbook('site.yml', sudo=True, extra_vars=extra_vars) run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
if os.path.exists(tmp_bench_repo): if os.path.exists(tmp_bench_repo):
@ -273,11 +276,15 @@ def clone_bench_repo(args):
repo_url = args.repo_url or 'https://github.com/frappe/bench' repo_url = args.repo_url or 'https://github.com/frappe/bench'
if os.path.exists(tmp_bench_repo): if os.path.exists(tmp_bench_repo):
log('Not cloning already existing Bench repository at {tmp_bench_repo}'.format(tmp_bench_repo=tmp_bench_repo))
return 0 return 0
elif args.without_bench_setup: elif args.without_bench_setup:
clone_path = os.path.join(os.path.expanduser('~'), 'bench') clone_path = os.path.join(os.path.expanduser('~'), 'bench')
log('--without-bench-setup specified, clone path is: {clone_path}'.format(clone_path=clone_path))
else: else:
clone_path = tmp_bench_repo clone_path = tmp_bench_repo
# Not logging repo_url to avoid accidental credential leak in case credential is embedded in URL
log('Cloning bench repository branch {branch} into {clone_path}'.format(branch=branch, clone_path=clone_path))
success = run_os_command( success = run_os_command(
{'git': 'git clone --quiet {repo_url} {bench_repo} --depth 1 --branch {branch}'.format( {'git': 'git clone --quiet {repo_url} {bench_repo} --depth 1 --branch {branch}'.format(
@ -336,6 +343,8 @@ def get_passwords(args):
passwords_didnt_match("Administrator") passwords_didnt_match("Administrator")
admin_password = '' admin_password = ''
continue continue
elif args.without_site:
log("Not creating a new site due to --without-site")
pass_set = False pass_set = False
else: else:
@ -405,8 +414,8 @@ def parse_commandline_args():
args_group.add_argument('--develop', dest='develop', action='store_true', default=False, help='Install developer setup') args_group.add_argument('--develop', dest='develop', action='store_true', default=False, help='Install developer setup')
args_group.add_argument('--production', dest='production', action='store_true', default=False, help='Setup Production environment for bench') args_group.add_argument('--production', dest='production', action='store_true', default=False, help='Setup Production environment for bench')
parser.add_argument('--site', dest='site', action='store', default='site1.local', help='Specifiy name for your first ERPNext site') parser.add_argument('--site', dest='site', action='store', default='site1.local', help='Specify name for your first ERPNext site')
parser.add_argument('--without-site', dest='without_site', action='store_true', default=False) parser.add_argument('--without-site', dest='without_site', action='store_true', default=False, help='Do not create a new site')
parser.add_argument('--verbose', dest='verbose', action='store_true', default=False, help='Run the script in verbose mode') parser.add_argument('--verbose', dest='verbose', action='store_true', default=False, help='Run the script in verbose mode')
parser.add_argument('--user', dest='user', help='Install frappe-bench for this user') parser.add_argument('--user', dest='user', help='Install frappe-bench for this user')
parser.add_argument('--bench-branch', dest='bench_branch', help='Clone a particular branch of bench repository') parser.add_argument('--bench-branch', dest='bench_branch', help='Clone a particular branch of bench repository')