2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-09 08:30:39 +00:00

[Fix] Fixes to replace new installer in erpnext and frappe travis.yml

This commit is contained in:
shreyas 2016-08-01 12:09:54 +05:30
parent 94d27493d2
commit d8215c6f1d
4 changed files with 31 additions and 13 deletions

View File

@ -19,5 +19,5 @@
when: ansible_distribution == 'MacOSX'
- name: Set /tmp/.bench folder perms
command: 'chown -R {{ frappe_user }}:{{ frappe_user }} /tmp/.bench'
command: 'chown -R {{ frappe_user }}:{{ frappe_user }} {{ repo_path }}'
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'CentOS'

View File

@ -7,19 +7,18 @@
- name: Set root Password for Ubuntu
mysql_user:
name: root
host: '{{ item }}'
host: localhost
password: '{{ mysql_root_password }}'
state: present
with_items:
- localhost
- 127.0.0.1
- ::1
become: yes
become_user: root
# when you have already defined mysql root password
ignore_errors: yes
when: mysql_root_password is defined and ansible_distribution == 'Ubuntu'
when: ansible_distribution == 'Ubuntu'
- name: Set root Password
command: mysqladmin -u root password {{ mysql_root_password }}
become: yes
become_user: root
when: mysql_root_password is defined and ansible_distribution != 'Ubuntu'
- name: Add configuration
template: src={{ mysql_config_template }} dest={{ mysql_conf_dir }}/frappe.cnf owner=root mode=0644

View File

@ -97,4 +97,4 @@
# setup development environment
- include: includes/setup_dev_env.yml
when: not production and not run_travis
when: not production and not run_travis and not without_bench_setup

View File

@ -86,6 +86,13 @@ def install_bench(args):
extra_vars = vars(args)
extra_vars.update(frappe_user=args.user)
if os.path.exists(tmp_bench_repo):
repo_path = tmp_bench_repo
else:
repo_path = os.path.join(os.path.expanduser('~'), 'bench')
extra_vars.update(repo_path=repo_path)
run_playbook('develop/create_user.yml', extra_vars=extra_vars)
extra_vars.update(get_passwords(args.run_travis or args.without_bench_setup))
@ -144,12 +151,19 @@ def clone_bench_repo(args):
if os.path.exists(tmp_bench_repo):
return 0
elif args.without_bench_setup:
clone_path = os.path.join(os.path.expanduser('~'), 'bench')
else:
clone_path = tmp_bench_repo
branch = args.bench_branch or 'master'
repo_url = args.repo_url or 'https://github.com/frappe/bench'
success = run_os_command(
{'git': 'git clone {repo_url} {bench_repo} --depth 1 --branch {branch}'.format(
repo_url=repo_url, bench_repo=tmp_bench_repo, branch=branch)}
repo_url=repo_url, bench_repo=clone_path, branch=branch)}
)
return success
@ -231,7 +245,12 @@ def run_playbook(playbook_name, sudo=False, extra_vars=None):
user = extra_vars.get('user') or getpass.getuser()
args.extend(['--become', '--become-user={0}'.format(user)])
success = subprocess.check_call(args, cwd=os.path.join(tmp_bench_repo, 'playbooks'))
if os.path.exists(tmp_bench_repo):
cwd = tmp_bench_repo
else:
cwd = os.path.join(os.path.expanduser('~'), 'bench')
success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'))
return success
def parse_commandline_args():