mirror of
https://github.com/frappe/bench.git
synced 2025-01-25 07:58:24 +00:00
[fix] [cleanup] bench-path
This commit is contained in:
parent
8ff5519959
commit
0c0144021b
@ -22,7 +22,7 @@ def setup_letsencrypt(site, bench_path):
|
|||||||
return
|
return
|
||||||
|
|
||||||
create_config(site)
|
create_config(site)
|
||||||
run_certbot_and_setup_ssl(site, bench_path)
|
run_certbot_and_setup_ssl(site, bench_path)
|
||||||
setup_crontab()
|
setup_crontab()
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ def create_config(site):
|
|||||||
def run_certbot_and_setup_ssl(site, bench_path):
|
def run_certbot_and_setup_ssl(site, bench_path):
|
||||||
service('nginx', 'stop')
|
service('nginx', 'stop')
|
||||||
get_certbot()
|
get_certbot()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
exec_cmd("{path} --config /etc/letsencrypt/configs/{site}.cfg certonly".format(path=get_certbot_path(), site=site))
|
exec_cmd("{path} --config /etc/letsencrypt/configs/{site}.cfg certonly".format(path=get_certbot_path(), site=site))
|
||||||
except CommandFailedError:
|
except CommandFailedError:
|
||||||
@ -48,10 +48,10 @@ def run_certbot_and_setup_ssl(site, bench_path):
|
|||||||
|
|
||||||
ssl_path = "/etc/letsencrypt/live/{site}/".format(site=site)
|
ssl_path = "/etc/letsencrypt/live/{site}/".format(site=site)
|
||||||
|
|
||||||
ssl_config = { "ssl_certificate": os.path.join(ssl_path, "fullchain.pem"),
|
ssl_config = { "ssl_certificate": os.path.join(ssl_path, "fullchain.pem"),
|
||||||
"ssl_certificate_key": os.path.join(ssl_path, "privkey.pem") }
|
"ssl_certificate_key": os.path.join(ssl_path, "privkey.pem") }
|
||||||
|
|
||||||
update_site_config(site, ssl_config, bench=bench_path)
|
update_site_config(site, ssl_config, bench_path=bench_path)
|
||||||
make_nginx_conf(bench_path)
|
make_nginx_conf(bench_path)
|
||||||
|
|
||||||
service('nginx', 'start')
|
service('nginx', 'start')
|
||||||
@ -77,7 +77,7 @@ def get_certbot():
|
|||||||
create_dir_if_missing(certbot_path)
|
create_dir_if_missing(certbot_path)
|
||||||
|
|
||||||
if not os.path.isfile(certbot_path):
|
if not os.path.isfile(certbot_path):
|
||||||
urllib.urlretrieve ("https://dl.eff.org/certbot-auto", certbot_path)
|
urllib.urlretrieve ("https://dl.eff.org/certbot-auto", certbot_path)
|
||||||
os.chmod(certbot_path, 0744)
|
os.chmod(certbot_path, 0744)
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class TestBenchInit(unittest.TestCase):
|
|||||||
self.new_site(site_name)
|
self.new_site(site_name)
|
||||||
bench_path = os.path.join(self.benches_path, "test-bench")
|
bench_path = os.path.join(self.benches_path, "test-bench")
|
||||||
|
|
||||||
bench.app.get_app("https://github.com/frappe/frappe-client", bench=bench_path)
|
bench.app.get_app("https://github.com/frappe/frappe-client", bench_path=bench_path)
|
||||||
self.assertTrue(os.path.exists(os.path.join(bench_path, "apps", "frappeclient")))
|
self.assertTrue(os.path.exists(os.path.join(bench_path, "apps", "frappeclient")))
|
||||||
|
|
||||||
def test_install_app(self):
|
def test_install_app(self):
|
||||||
@ -122,12 +122,12 @@ class TestBenchInit(unittest.TestCase):
|
|||||||
bench_path = os.path.join(self.benches_path, "test-bench")
|
bench_path = os.path.join(self.benches_path, "test-bench")
|
||||||
app_path = os.path.join(bench_path, "apps", "frappe")
|
app_path = os.path.join(bench_path, "apps", "frappe")
|
||||||
|
|
||||||
bench.app.switch_branch(branch="master", apps=["frappe"], bench=bench_path, check_upgrade=False)
|
bench.app.switch_branch(branch="master", apps=["frappe"], bench_path=bench_path, check_upgrade=False)
|
||||||
out = subprocess.check_output(['git', 'status'], cwd=app_path)
|
out = subprocess.check_output(['git', 'status'], cwd=app_path)
|
||||||
self.assertTrue("master" in out)
|
self.assertTrue("master" in out)
|
||||||
|
|
||||||
# bring it back to develop!
|
# bring it back to develop!
|
||||||
bench.app.switch_branch(branch="develop", apps=["frappe"], bench=bench_path, check_upgrade=False)
|
bench.app.switch_branch(branch="develop", apps=["frappe"], bench_path=bench_path, check_upgrade=False)
|
||||||
out = subprocess.check_output(['git', 'status'], cwd=app_path)
|
out = subprocess.check_output(['git', 'status'], cwd=app_path)
|
||||||
self.assertTrue("develop" in out)
|
self.assertTrue("develop" in out)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user