From b2714126868bfa196833fe8100d01f617b5a6a29 Mon Sep 17 00:00:00 2001 From: RefaelBeker7 Date: Sun, 1 Dec 2024 13:08:37 +0200 Subject: [PATCH 1/2] Support run ondemand Automation-API Control-M --- src/aapi/bases.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/aapi/bases.py b/src/aapi/bases.py index eaf7d64..32c613f 100644 --- a/src/aapi/bases.py +++ b/src/aapi/bases.py @@ -66,9 +66,9 @@ def run_on_demand(self, environment: Environment, inpath: str = f'run_on_demand{ file_path: str = None, delete_afterwards: bool = True, open_in_browser: str = None) -> RunMonitor: # Import circular dependency from ctm_python_client.core.workflow import Workflow, WorkflowDefaults - from aapi import Job, Folder + from aapi import Folder - if isinstance(self, Job) or (hasattr(self, 'job_list') and self.job_list is not None and len(self.job_list) > 0): + if (hasattr(self, '_type') and 'Job' in self._type) or (hasattr(self, 'job_list') and self.job_list is not None and len(self.job_list) > 0): try: on_demand_workflow = Workflow( environment, @@ -92,9 +92,12 @@ def run_on_demand(self, environment: Environment, inpath: str = f'run_on_demand{ open_in_browser=open_in_browser ) except Exception as e: - errors = [err.get('message', '') + ' ' + err.get('item', '') - for err in json.loads(e.body)['errors']] - raise RuntimeError(f"AAPI request failed: {', '.join(errors)}") + if e.body: + errors = [err.get('message', '') + ' ' + err.get('item', '') + for err in json.loads(e.body)['errors']] + raise RuntimeError(f"AAPI request failed: {', '.join(errors)}") + else: + raise e finally: on_demand_workflow.clear_all() else: From 4060a4ec5e6f0cbf524e33f4f7de473bf4f9e6fa Mon Sep 17 00:00:00 2001 From: RefaelBeker7 Date: Sun, 1 Dec 2024 14:09:01 +0200 Subject: [PATCH 2/2] Support run ondemand Automation-API Control-M --- setup.py | 2 +- src/ctm_python_client/__init__.py | 2 +- tests/test_sanity.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 03bdfb1..295990b 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ name="ctm-python-client", packages=find_packages(where="src"), package_dir={"": "src"}, - version="2.4.0", + version="2.4.1", description="Python Workflows for Control-M", long_description=long_description, long_description_content_type='text/markdown', diff --git a/src/ctm_python_client/__init__.py b/src/ctm_python_client/__init__.py index cb387db..cd2e500 100644 --- a/src/ctm_python_client/__init__.py +++ b/src/ctm_python_client/__init__.py @@ -1,2 +1,2 @@ -__version__ = '2.4.0' +__version__ = '2.4.1' __author__ = 'BMC Software' \ No newline at end of file diff --git a/tests/test_sanity.py b/tests/test_sanity.py index 64cdb92..68935d9 100644 --- a/tests/test_sanity.py +++ b/tests/test_sanity.py @@ -2,6 +2,6 @@ def test_version_author(): import ctm_python_client assert ctm_python_client.__author__ == 'BMC Software' - assert ctm_python_client.__version__ == '2.4.0' + assert ctm_python_client.__version__ == '2.4.1'