From 9d8a28ff9a3c8c0800b2e2b1c4c203e4c7e89016 Mon Sep 17 00:00:00 2001 From: nineven Date: Thu, 7 May 2020 09:51:25 +0800 Subject: [PATCH] fix a bug --- fir_ser/api/utils/app/shellcmds.py | 2 ++ fir_ser/api/utils/app/supersignutils.py | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fir_ser/api/utils/app/shellcmds.py b/fir_ser/api/utils/app/shellcmds.py index e85969a..09c132c 100644 --- a/fir_ser/api/utils/app/shellcmds.py +++ b/fir_ser/api/utils/app/shellcmds.py @@ -101,6 +101,8 @@ def shell_command(cmdstrs,timeout): return result out, err = child.communicate() + if err: + result['err_info'] = err shell_end_time = time.time() result['shell_run_time'] = shell_end_time - shell_start_time out = out.strip(b'\n') diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index 23e7e45..680afcb 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -270,6 +270,7 @@ class IosUtils(object): app_api_obj2 = AppDeveloperApi(**auth) app_api_obj2.del_app(app_obj.bundle_id,app_obj.app_id) delete_app_to_dev_and_file(developer_obj, app_id) + delete_app_profile_file(developer_obj, app_obj) @staticmethod @@ -317,6 +318,7 @@ class IosUtils(object): IosUtils.clean_app_by_developer_obj(app_obj,developer_obj) delete_app_to_dev_and_file(developer_obj, app_obj.id) IosUtils.clean_udid_by_app_obj(app_obj,developer_obj) + delete_app_profile_file(developer_obj, app_obj) @staticmethod def clean_app_by_developer_obj(app_obj,developer_obj): @@ -435,6 +437,13 @@ def file_format_path(user_obj,auth): file_format_path_name = os.path.join(cert_dir_path, cert_dir_name) return file_format_path_name +def get_profile_full_path(developer_obj,app_obj): + cert_dir_name = make_app_uuid(developer_obj.user_id, developer_obj.email) + cert_dir_path = os.path.join(SUPER_SIGN_ROOT, cert_dir_name, "profile") + provisionName = os.path.join(cert_dir_path, app_obj.app_id) + return provisionName + '.mobileprovision' + + def delete_app_to_dev_and_file(developer_obj,app_id): APPToDeveloper_obj=APPToDeveloper.objects.filter(developerid=developer_obj, app_id_id=app_id) if APPToDeveloper_obj: @@ -443,4 +452,8 @@ def delete_app_to_dev_and_file(developer_obj,app_id): lsobj.del_file(binary_file) APPToDeveloper_obj.delete() - +def delete_app_profile_file(developer_obj,app_obj): + try: + os.remove(get_profile_full_path(developer_obj,app_obj)) + except Exception as e: + print(e) \ No newline at end of file