mirror of
https://github.com/frappe/frappe_docker.git
synced 2025-01-25 16:18:32 +00:00
fix: move run_command to utils
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
parent
2b2a57a85d
commit
5c57334bb6
@ -5,7 +5,7 @@ import semantic_version
|
|||||||
from frappe.commands.site import _new_site
|
from frappe.commands.site import _new_site
|
||||||
from frappe.installer import update_site_config
|
from frappe.installer import update_site_config
|
||||||
from check_connection import get_config, get_site_config, COMMON_SITE_CONFIG_FILE
|
from check_connection import get_config, get_site_config, COMMON_SITE_CONFIG_FILE
|
||||||
from restore_backup import run_command
|
from utils import run_command
|
||||||
|
|
||||||
|
|
||||||
def get_password(env_var, default=None):
|
def get_password(env_var, default=None):
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import subprocess
|
|
||||||
import tarfile
|
import tarfile
|
||||||
import hashlib
|
import hashlib
|
||||||
import frappe
|
import frappe
|
||||||
@ -9,21 +8,12 @@ import boto3
|
|||||||
|
|
||||||
from new import get_password
|
from new import get_password
|
||||||
from push_backup import DATE_FORMAT, check_environment_variables
|
from push_backup import DATE_FORMAT, check_environment_variables
|
||||||
|
from utils import run_command
|
||||||
from frappe.utils import get_sites, random_string
|
from frappe.utils import get_sites, random_string
|
||||||
from frappe.installer import make_conf, get_conf_params, make_site_dirs, update_site_config
|
from frappe.installer import make_conf, get_conf_params, make_site_dirs, update_site_config
|
||||||
from check_connection import get_site_config, get_config, COMMON_SITE_CONFIG_FILE
|
from check_connection import get_site_config, get_config, COMMON_SITE_CONFIG_FILE
|
||||||
|
|
||||||
|
|
||||||
def run_command(command):
|
|
||||||
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
||||||
out, error = process.communicate()
|
|
||||||
if process.returncode:
|
|
||||||
print("Something went wrong:")
|
|
||||||
print(f"error code: {process.returncode}")
|
|
||||||
print(f"stdout:\n{out}")
|
|
||||||
print(f"\nstderr:\n{error}")
|
|
||||||
|
|
||||||
|
|
||||||
def list_directories(path):
|
def list_directories(path):
|
||||||
directories = []
|
directories = []
|
||||||
for name in os.listdir(path):
|
for name in os.listdir(path):
|
||||||
|
12
build/common/commands/utils.py
Normal file
12
build/common/commands/utils.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
def run_command(command):
|
||||||
|
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
out, error = process.communicate()
|
||||||
|
if process.returncode:
|
||||||
|
print("Something went wrong:")
|
||||||
|
print(f"return code: {process.returncode}")
|
||||||
|
print(f"stdout:\n{out}")
|
||||||
|
print(f"\nstderr:\n{error}")
|
||||||
|
exit(process.returncode)
|
Loading…
x
Reference in New Issue
Block a user