Skip to content

Commit 867ed58

Browse files
authored
Merge pull request #106 from controlm/_Support-run-ondemand
Support run ondemand Automation-API Control-M
2 parents 1cb651f + c214eed commit 867ed58

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
name="ctm-python-client",
99
packages=find_packages(where="src"),
1010
package_dir={"": "src"},
11-
version="2.4.2",
11+
version="2.4.3",
1212
description="Python Workflows for Control-M",
1313
long_description=long_description,
1414
long_description_content_type='text/markdown',

src/aapi/bases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def run_on_demand(self, environment: Environment, inpath: str = f'run_on_demand{
9292
open_in_browser=open_in_browser
9393
)
9494
except Exception as e:
95-
if e.body:
95+
if hasattr(e, 'body'):
9696
errors = [err.get('message', '') + ' ' + err.get('item', '')
9797
for err in json.loads(e.body)['errors']]
9898
raise RuntimeError(f"AAPI request failed: {', '.join(errors)}")

src/ctm_python_client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = '2.4.2'
1+
__version__ = '2.4.3'
22
__author__ = 'BMC Software'

src/ctm_python_client/core/workflow.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,12 @@ def run(self, skip_login: bool = False, file_path: str = None, delete_afterwards
412412
run_.open_in_browser()
413413
return run_
414414
except Exception as e:
415-
errors = [err.get('message', '') + ' ' + err.get('item', '')
416-
for err in json.loads(e.body)['errors']]
417-
raise RuntimeError(f"AAPI request failed: {', '.join(errors)}")
415+
if hasattr(e, 'body'):
416+
errors = [err.get('message', '') + ' ' + err.get('item', '')
417+
for err in json.loads(e.body)['errors']]
418+
raise RuntimeError(f"AAPI request failed: {', '.join(errors)}")
419+
else:
420+
raise e
418421
finally:
419422
if delete_afterwards:
420423
fpath.unlink()
@@ -438,7 +441,7 @@ def run_on_demand(self, skip_login: bool = False, file_path: str = None, delete_
438441
run_.open_in_browser()
439442
return run_
440443
except Exception as e:
441-
if e.body:
444+
if hasattr(e, 'body'):
442445
errors = [err.get('message', '') + ' ' + err.get('item', '')
443446
for err in json.loads(e.body)['errors']]
444447
raise RuntimeError(f"AAPI request failed: {', '.join(errors)}")

tests/test_sanity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ def test_version_author():
22
import ctm_python_client
33

44
assert ctm_python_client.__author__ == 'BMC Software'
5-
assert ctm_python_client.__version__ == '2.4.2'
5+
assert ctm_python_client.__version__ == '2.4.3'
66

77

0 commit comments

Comments
 (0)