Skip to content

Commit

Permalink
fix: run file directly instead of using exec
Browse files Browse the repository at this point in the history
  • Loading branch information
gavindsouza committed Jul 10, 2020
1 parent 517752c commit 6f51b12
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions frappe/integrations/frappe_providers/frappecloud.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import click
import requests
from six import PY3
from html2text import html2text

import frappe


def frappecloud_migrator(local_site):
print("Retreiving Migrator...")
print("Retreiving Site Migrator...")
remote_site = frappe.conf.frappecloud_url or "frappecloud.com"
request_url = "https://{}/api/method/press.api.script".format(remote_site)
request_url = "http://{}/api/method/press.api.script".format("gavin.frappe.cloud:8000")
request = requests.get(request_url)

if request.status_code / 100 != 2:
Expand All @@ -18,7 +18,12 @@ def frappecloud_migrator(local_site):

script_contents = request.json()["message"]

if PY3:
exec(script_contents)
else:
exec script_contents
import tempfile
import os
import sys

py = sys.executable
script = tempfile.NamedTemporaryFile(mode="w")
script.write(script_contents)
print("Site Migrator stored at {}".format(script.name))
os.execv(py, [py, script.name, local_site])

0 comments on commit 6f51b12

Please sign in to comment.