frappe / bench

CLI to manage Multi-tenant deployments for Frappe apps
https://frappeframework.com/docs/user/en/bench
GNU General Public License v3.0
1.37k stars 1.2k forks source link

(lets-encrypt) ImportError: cannot import name update_site_config #265

Closed yashodhank closed 8 years ago

yashodhank commented 8 years ago

Command failing to setup lets encrypt on Ubuntu 14.04 LTS (Updated) on freshly installed ERPNext V7 with Production mode.

frappe@xxxxx01:~/frappe-bench$ sudo bench setup lets-encrypt zs.xxx.xxxxxxx.in

Version:

$ bench --version
4.0.0
$ bench version
erpnext 7.0.0
frappe 7.0.0
razorpay_integration 1.0.0

Error Log:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/.bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/.bench/bench/commands/setup.py", line 83, in setup_letsencrypt
    from bench.config.lets_encrypt import setup_letsencrypt
  File "/home/frappe/.bench/bench/config/lets_encrypt.py", line 2, in <module>
    from bench.utils import exec_cmd, update_site_config, CommandFailedError
ImportError: cannot import name update_site_config
vjFaLk commented 8 years ago

Fixed! : https://github.com/frappe/bench/pull/266

ccfiel commented 8 years ago

@vjFaLk still got the error.

frappe@erpnext-prod:~$ sudo bench setup lets-encrypt ooo.ooo
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/.bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/.bench/bench/commands/setup.py", line 83, in setup_letsencrypt
    from bench.config.lets_encrypt import setup_letsencrypt
  File "/home/frappe/.bench/bench/config/lets_encrypt.py", line 2, in <module>
    from bench.utils import exec_cmd, update_site_config, CommandFailedError
ImportError: cannot import name update_site_config

I tried to go in .bench and git pull is says its up to date.

vjFaLk commented 8 years ago

Which branch are you on? The fix is on the master branch, you just need to pull the changes.

ccfiel commented 8 years ago

You are right bench is in develop. I tried to bench switch-to-master still its in develop. How can I transfer everything frappe,erpnext and bench to master?

vjFaLk commented 8 years ago

@ccfiel The naming for the command isn't great haha. So, bench switch-to-master will change the branches of erpnext and frappe (you need to run it from frappe-bench), however to change the branch for bench, just do git checkout master inside the bench-repo folder, and follow that up by git pull.

ccfiel commented 8 years ago

@vjFaLk I tried your suggestion I got this error.

frappe@erpnext-prod:~/.bench$ git checkout master
error: pathspec 'master' did not match any file(s) known to git.

any idea why?

vjFaLk commented 8 years ago

Hm, try git fetch --unshallow and try the same command again. Else try :

git checkout -b master origin/master

ccfiel commented 8 years ago

@vjFaLk Still unsuccessful :(


frappe@erpnext-prod:~/.bench$ git fetch --unshallow
remote: Counting objects: 2911, done.
remote: Compressing objects: 100% (1002/1002), done.
remote: Total 2911 (delta 1964), reused 2822 (delta 1875), pack-reused 0
Receiving objects: 100% (2911/2911), 21.98 MiB | 7.82 MiB/s, done.
Resolving deltas: 100% (1964/1964), completed with 62 local objects.
remote: Counting objects: 1, done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 1
Unpacking objects: 100% (1/1), done.
From https://github.com/frappe/bench
 * [new tag]         v0.9       -> v0.9
 * [new tag]         v0.91      -> v0.91
 * [new tag]         v0.92      -> v0.92
 * [new tag]         v0.93      -> v0.93
 * [new tag]         v1.0       -> v1.0
 * [new tag]         v2.0       -> v2.0
 * [new tag]         v2.1       -> v2.1
 * [new tag]         v3.0       -> v3.0
 * [new tag]         v3.1       -> v3.1
frappe@erpnext-prod:~/.bench$ git checkout master
error: pathspec 'master' did not match any file(s) known to git.
frappe@erpnext-prod:~/.bench$ git checkout -b master origin/master
fatal: Cannot update paths and switch to branch 'master' at the same time.
Did you intend to checkout 'origin/master' which can not be resolved as commit?
vjFaLk commented 8 years ago

Git why. This will work:

git checkout --track -b origin/master

ccfiel commented 8 years ago

@vjFaLk git is not with us hehehehe. Still in develop :(

frappe@erpnext-prod:~/.bench$ git checkout --track -b origin/master
Branch origin/master set up to track local branch develop.
Switched to a new branch 'origin/master'
frappe@erpnext-prod:~/.bench$ git pull
From .
 * branch            develop    -> FETCH_HEAD
Already up-to-date.
vjFaLk commented 8 years ago

Ahh sorry for the trouble, well, just do git remote rm origin and then do git remote add origin https://github.com/frappe/bench.git followed by git fetch

ccfiel commented 8 years ago

@vjFaLk Still the same :(


rappe@erpnext-prod:~/.bench$  git remote rm origin
frappe@erpnext-prod:~/.bench$ git remote add origin https://github.com/frappe/bench.git
frappe@erpnext-prod:~/.bench$ git fetch
From .
 * branch            develop    -> FETCH_HEAD
vjFaLk commented 8 years ago

Try git checkout master now?

ccfiel commented 8 years ago

@vjFaLk :(


frappe@erpnext-prod:~/.bench$ git remote rm origin
frappe@erpnext-prod:~/.bench$ git remote add origin https://github.com/frappe/bench.git
frappe@erpnext-prod:~/.bench$ git fetch
From .
 * branch            develop    -> FETCH_HEAD
frappe@erpnext-prod:~/.bench$ git checkout master
error: pathspec 'master' did not match any file(s) known to git.
vjFaLk commented 8 years ago

Oh god, this is my mistake, sorry! Run git fetch origin

ccfiel commented 8 years ago

@vjFaLk yey! its now working! thanks a lot!