From bafbc226a5cd4f2542996af94119b9786f8866b7 Mon Sep 17 00:00:00 2001 From: Arjun Suresh Date: Tue, 26 Nov 2024 01:22:56 +0530 Subject: [PATCH] Load customize.py before deps only in the case of cached scripts --- automation/script/module.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/automation/script/module.py b/automation/script/module.py index de57fef424..62018a412c 100644 --- a/automation/script/module.py +++ b/automation/script/module.py @@ -1169,13 +1169,13 @@ def _run(self, i): cached_path = '' local_env_keys_from_meta = meta.get('local_env_keys', []) - + # Check if has customize.py path_to_customize_py = os.path.join(path, 'customize.py') customize_code = None - customize_common_input = None + customize_common_input = {} - if os.path.isfile(path_to_customize_py): + if os.path.isfile(path_to_customize_py) and cache: r = utils.load_python_module( {'path': path, 'name': 'customize'}) if r['return'] > 0: @@ -1647,7 +1647,24 @@ def _run(self, i): 'meta': meta, 'self': self } - if customize_code: + if os.path.isfile(path_to_customize_py): #possible duplicate execution - needs fix + r = utils.load_python_module( + {'path': path, 'name': 'customize'}) + if r['return'] > 0: + return r + + customize_code = r['code'] + + customize_common_input = { + 'input': i, + 'automation': self, + 'artifact': script_artifact, + 'customize': script_artifact.meta.get('customize', {}), + 'os_info': os_info, + 'recursion_spaces': recursion_spaces, + 'script_tags': script_tags, + 'variation_tags': variation_tags + } run_script_input['customize_code'] = customize_code run_script_input['customize_common_input'] = customize_common_input