Integration of CA Brightside to Python.
- Allow calling Brighside commands without any boilerplate code - just one function
bright(command)
- Output is converted to Python data structures
- Lists or dictionaries
- Automatic error handling - failures are reported as exception (as a Python developer would expect)
from pybright.cli import bright
for job in bright("zos-jobs list jobs"):
print(f"{job['jobname']} {job['jobid']} {job['retcode']}")
Prints:
PLAPE03A JOB20471 CC 0000
PLAPE03A JOB20380 CC 0000
PLAPE03A JOB17519 ABEND S222
PLAPE03A JOB17460 ABEND S222
for job in bright("zos-jobs list jobs"):
if job['retcode'] not in ['CC 0000', None]:
print(f"{job['jobname']} {job['jobid']} {job['retcode']}")
Prints:
PLAPE03A JOB17519 ABEND S222
PLAPE03A JOB17460 ABEND S222
for job in bright("zos-jobs list jobs --prefix MAS* --owner MASSERV"):
if job['retcode'] not in ['CC 0000', None]:
print(f"{job['jobname']} {job['jobid']} {job['retcode']}")
for spool_file in bright(f"zos-jobs list spool-files-by-jobid {job['jobid']}"):
if spool_file['ddname'] == 'SYSOUT':
sysout = bright(f"zos-jobs view spool-file-by-id {job['jobid']} {spool_file['id']}")
print(sysout)
Prints:
MASDDS1 STC03252 CC 0101
...
JVMJZBL2007E Stack trace follows:
java.io.FileNotFoundException: runtime/CA/MFSJDISV (EDC5129I No such file or directory.)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:241)
at java.util.zip.ZipFile.<init>(ZipFile.java:171)
at java.util.jar.JarFile.<init>(JarFile.java:179)
at java.util.jar.JarFile.<init>(JarFile.java:116)
...
jobname = "MASAGW1"
bright(f'zos-console issue command --sysplex-system ca31 "S {jobname}"')
See full example at start_api_layer.py.
- Python 3.6 or higher
- CA Brightside - Community Edition
-
Request access to z/OSMF as described here: https://docops.ca.com/ca-brightside-enterprise-and-essentials/1-0/en/installing/prerequisites/z-osmf-configuration-overview/configure-z-osmf-security
-
Issue the following command to set the npm registry to the CA Brightside scoped package:
npm config set @brightside:registry https://api.bintray.com/npm/ca/brightside
-
To install CA Brightside, issue the following command:
npm install -g @brightside/core@next
-
To create a
zosmf
profile, issue the following command. Refer to the available options in the help text to define your profile:bright profiles create zosmf-profile --help
Example for CA32 system:
bright profiles create zosmf-profile ca32 --host ca32.ca.com --port 1443 --user <userid> --pass <password> --reject-unauthorized false --overwrite
Full installation instructions are at https://docops.ca.com/ca-brightside-community-edition/1-0/en/installing/install-ca-brightside.
pip install pybright
EPL-2.0
pybright was written by Petr Plavjanik.