2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-12-23 18:48:58 +00:00

fix: move run_command to utils

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
Chinmay D. Pai 2020-07-09 17:27:54 +05:30
parent 2b2a57a85d
commit 5c57334bb6
No known key found for this signature in database
GPG Key ID: 75507BE256F40CED
3 changed files with 14 additions and 12 deletions

View File

@ -5,7 +5,7 @@ import semantic_version
from frappe.commands.site import _new_site
from frappe.installer import update_site_config
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):

View File

@ -1,7 +1,6 @@
import os
import datetime
import json
import subprocess
import tarfile
import hashlib
import frappe
@ -9,21 +8,12 @@ import boto3
from new import get_password
from push_backup import DATE_FORMAT, check_environment_variables
from utils import run_command
from frappe.utils import get_sites, random_string
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
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):
directories = []
for name in os.listdir(path):

View 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)