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/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: 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'