Skip to content

Commit 97dbcbe

Browse files
authored
Merge branch 'stable' into issue-1812
2 parents 9a4e6f3 + 638f68c commit 97dbcbe

47 files changed

Lines changed: 1205 additions & 46 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENT_INSTRUCTIONS.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# python-devops AI Coding Instructions
2+
3+
## Project Overview
4+
Python package for IBM Maximo DevOps utilities. Provides command-line tools for deployment automation, database validation, Slack notifications, and user management. Distributed as installable package with `setup.py`/`pyproject.toml` and standalone scripts in `bin/`.
5+
6+
## Architecture
7+
- **bin/**: Executable CLI scripts (entry points)
8+
- `mas-devops-*`: Command-line tools for specific operations
9+
- Scripts import from `src/` package for implementation
10+
- Each script typically wraps a single operational task
11+
- **src/**: Main package source code
12+
- Organized by module/function (import path: `from mas_devops import ...`)
13+
- Core utilities: configuration management, API clients, database handlers
14+
- **test/**: Test suite (pytest structure)
15+
- Mirror `src/` structure in test files
16+
- Run with `pytest` or `make test`
17+
- **build/**: Generated artifacts (don't edit)
18+
- `*.egg-info/`: Package metadata
19+
- `dist/`, `*.whl`: Distribution packages
20+
- **setup.py** / **pyproject.toml**: Package definition
21+
- Entry points defined in setup.py pointing to `bin/` scripts
22+
- Dependencies in both files (must keep in sync)
23+
- Version defined once (check both files)
24+
25+
## Key Patterns
26+
- **CLI Tool Pattern**: `bin/mas-devops-*` scripts are thin wrappers
27+
- Import main logic from `src/mas_devops/`
28+
- Handle argument parsing and error reporting
29+
- Example: `mas-devops-notify-slack` → calls slack notification module
30+
- **Dependency Management**:
31+
- Core dependencies in `setup.py` `install_requires`
32+
- Dev dependencies in `setup.py` `extras_require['dev']`
33+
- `requirements.txt` for pinned versions (reproducible installs)
34+
- Keep all three in sync
35+
- **Entry Points**: `setup.py` defines CLI commands
36+
- Format: `'mas-devops-task-name = mas_devops.module:main_function'`
37+
- Creates executable scripts in `bin/` when package installed
38+
- **Module Organization**: Import directly from package
39+
- `from mas_devops.db2_validator import validate_config`
40+
- Avoid deep nesting; keep public API clear
41+
42+
## Development Workflow
43+
```bash
44+
make install # Install package in dev mode (pip install -e .)
45+
make test # Run pytest suite
46+
make test-verbose # Pytest with verbose output
47+
make build # Build distribution (wheel/tarball)
48+
make clean # Remove build artifacts
49+
make all # Clean, test, build
50+
```
51+
52+
## Important Conventions
53+
- **Python Version**: Check `setup.py` for `python_requires` (e.g., `>=3.8`)
54+
- **Entry Points**: Adding new CLI tool requires editing `setup.py` entry_points section
55+
- **Error Handling**: CLI scripts should catch exceptions and exit with meaningful error messages
56+
- **Logging**: Use Python logging module; configure in main module
57+
- **Testing**: Test structure mirrors source; test file for `src/module.py` is `test/test_module.py`
58+
- **Documentation**: Docstrings in functions should describe parameters, return, exceptions
59+
- **Imports**: Use absolute imports from package (`from mas_devops import ...`), not relative
60+
61+
## Common CLI Tools (Reference)
62+
- `mas-devops-create-initial-users-for-saas`: User provisioning (SaaS)
63+
- `mas-devops-db2-validate-config`: Validate DB2 configuration
64+
- `mas-devops-notify-slack`: Send notifications
65+
- `mas-devops-saas-job-cleaner`: Cleanup SaaS jobs
66+
67+
## Integration Points
68+
- **ansible-devops**: Playbooks call these Python utilities for infrastructure setup
69+
- **playbook**: Runbooks document procedures; Python tools automate them
70+
- **Standalone Usage**: Scripts can be called independently or from other tools via entry points
71+
- **Distribution**: Package installed via pip; entry points register CLI commands globally
72+
73+
## When Adding New CLI Tool
74+
1. Create implementation module in `src/mas_devops/`
75+
2. Create script in `bin/mas-devops-tool-name` or update `setup.py` entry_points
76+
3. Add entry to `setup.py` entry_points section
77+
4. Add tests in `test/` matching module structure
78+
5. Update `requirements.txt` if adding dependencies
79+
6. Test with `make install` then run `mas-devops-tool-name --help`
80+
81+
## Packaging & Distribution
82+
- Build: `python -m build` or `make build`
83+
- Outputs: wheel file in `dist/` ready for pip install
84+
- Version managed in `setup.py` (check both setup.py and pyproject.toml)

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include src/mas/devops/templates/*.json.j2
22
include src/mas/devops/templates/*.yml.j2
33
include src/mas/devops/data/catalogs/*.yaml
4+
include src/mas/devops/data/*.yaml

src/mas/devops/data/__init__.py

Lines changed: 104 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# *****************************************************************************
2-
# Copyright (c) 2024 IBM Corporation and other Contributors.
2+
# Copyright (c) 2024, 2026 IBM Corporation and other Contributors.
33
#
44
# All rights reserved. This program and the accompanying materials
55
# are made available under the terms of the Eclipse Public License v1.0
@@ -20,7 +20,11 @@
2020
from os import path
2121

2222

23-
def getCatalog(name: str) -> dict | None:
23+
class NoSuchCatalogError(Exception):
24+
pass
25+
26+
27+
def getCatalog(name: str) -> dict:
2428
"""
2529
Load a specific IBM Operator Catalog definition by name.
2630
@@ -32,21 +36,25 @@ def getCatalog(name: str) -> dict | None:
3236
3337
Returns:
3438
dict: The catalog definition dictionary containing operator versions and metadata.
35-
Returns None if the catalog file doesn't exist.
39+
40+
Raises:
41+
NoSuchCatalogError: If the specified catalog does not exist.
3642
"""
3743
moduleFile = path.abspath(__file__)
3844
modulePath = path.dirname(moduleFile)
3945
catalogFileName = f"{name}.yaml"
4046

4147
pathToCatalog = path.join(modulePath, "catalogs", catalogFileName)
4248
if not path.exists(pathToCatalog):
43-
return None
49+
raise NoSuchCatalogError(
50+
f"Catalog {name} is unknown: {pathToCatalog} does not exist"
51+
)
4452

4553
with open(pathToCatalog) as stream:
4654
return yaml.safe_load(stream)
4755

4856

49-
def listCatalogTags(arch="amd64") -> list:
57+
def listCatalogTags(arch="amd64") -> list[str]:
5058
"""
5159
List all available IBM Operator Catalog tags for a specific architecture.
5260
@@ -70,7 +78,7 @@ def listCatalogTags(arch="amd64") -> list:
7078
return result
7179

7280

73-
def getNewestCatalogTag(arch="amd64") -> str | None:
81+
def getNewestCatalogTag(arch="amd64") -> str:
7482
"""
7583
Get the most recent IBM Operator Catalog tag for a specific architecture.
7684
@@ -83,10 +91,98 @@ def getNewestCatalogTag(arch="amd64") -> str | None:
8391
8492
Returns:
8593
str: The newest catalog tag (e.g., "v9-241205-amd64").
86-
Returns None if no catalogs are found for the architecture.
94+
95+
Raises:
96+
NoSuchCatalogError: If no catalogs are found for the specified architecture.
8797
"""
8898
catalogs = listCatalogTags(arch)
8999
if len(catalogs) == 0:
90-
return None
100+
raise NoSuchCatalogError(f"There are no known catalogs for the {arch} platform")
91101
else:
92102
return catalogs[-1]
103+
104+
105+
def getOCPLifecycleData() -> dict | None:
106+
"""
107+
Load OpenShift Container Platform lifecycle data.
108+
109+
This function reads the OCP lifecycle YAML file containing General Availability dates,
110+
Standard Support end dates, and Extended Update Support (EUS) end dates for various
111+
OCP versions.
112+
113+
Returns:
114+
dict: The OCP lifecycle data dictionary with version information.
115+
Returns None if the ocp.yaml file doesn't exist.
116+
"""
117+
moduleFile = path.abspath(__file__)
118+
modulePath = path.dirname(moduleFile)
119+
ocpFileName = "ocp.yaml"
120+
121+
pathToOCP = path.join(modulePath, ocpFileName)
122+
if not path.exists(pathToOCP):
123+
return None
124+
125+
with open(pathToOCP) as stream:
126+
return yaml.safe_load(stream)
127+
128+
129+
def getOCPVersion(version: str) -> dict | None:
130+
"""
131+
Get lifecycle information for a specific OCP version.
132+
133+
This function retrieves the General Availability date, Standard Support end date,
134+
and Extended Update Support (EUS) end date for a specific OpenShift version.
135+
136+
Args:
137+
version (str): The OCP version (e.g., "4.16", "4.17").
138+
139+
Returns:
140+
dict: Dictionary containing 'ga_date', 'standard_support', and 'extended_support'.
141+
Returns None if the version is not found or OCP data doesn't exist.
142+
"""
143+
ocpData = getOCPLifecycleData()
144+
if not ocpData:
145+
return None
146+
147+
ocpVersions = ocpData.get("ocp_versions", {})
148+
return ocpVersions.get(version)
149+
150+
151+
def listOCPVersions() -> list:
152+
"""
153+
List all OCP versions with lifecycle data available.
154+
155+
This function returns a sorted list of all OpenShift Container Platform versions
156+
that have lifecycle information defined.
157+
158+
Returns:
159+
list: Sorted list of OCP version strings (e.g., ["4.12", "4.13", "4.14", ...]).
160+
Returns empty list if OCP data doesn't exist.
161+
"""
162+
ocpData = getOCPLifecycleData()
163+
if not ocpData:
164+
return []
165+
166+
ocpVersions = ocpData.get("ocp_versions", {})
167+
# Sort versions numerically (4.12, 4.13, etc.)
168+
return sorted(ocpVersions.keys(), key=lambda v: [int(x) for x in v.split(".")])
169+
170+
171+
def getCatalogEditorial(catalogTag: str) -> dict | None:
172+
"""
173+
Get editorial content (What's New and Known Issues) for a specific catalog.
174+
175+
This function retrieves the editorial metadata from a catalog definition,
176+
which includes "What's New" highlights and "Known Issues" information.
177+
178+
Args:
179+
catalogTag (str): The catalog tag (e.g., "v9-251231-amd64").
180+
181+
Returns:
182+
dict: Dictionary with 'whats_new' and 'known_issues' keys containing
183+
structured lists. Returns None if catalog doesn't exist
184+
or has no editorial content.
185+
"""
186+
catalog = getCatalog(catalogTag)
187+
188+
return catalog.get("editorial")

src/mas/devops/data/catalogs/v9-250109-amd64.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,18 @@ amlen_extras_version: 1.1.2
112112
# Default Cloud Pak for Data version
113113
# ------------------------------------------------------------------------------
114114
cpd_product_version_default: 5.0.0
115+
116+
editorial:
117+
whats_new:
118+
- title: '**Security updates and bug fixes**'
119+
details:
120+
- IBM Maximo Application Suite Core Platform v8.10, v8.11, v9.0, v9.1
121+
- IBM Maximo Manage v8.7, v8.6, v9.0 and v9.1
122+
- IBM Maximo Monitor v8.11, v8.10 and v9.0
123+
- IBM Maximo Optimizer v8.5, v8.4, v9.0 and v9.1
124+
- IBM Maximo Predict v9.0
125+
- IBM Data Dictionary v1.1
126+
- IBM SLS v3.0
127+
known_issues:
128+
- title: Customers using Maximo Assist v8.7 or v8.8 should not update and must instead contact IBM Support for guidance regarding the removal of IBM Watson Discovery and upgrading to Maximo Assist v9.0
129+
- title: Disconnected environments with Manage Civil, Aviation and ICD should not be updated at this time due to a known bug.

src/mas/devops/data/catalogs/v9-250109-s390x.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,12 @@ mongo_extras_version_4: 4.4.21
4343
mongo_extras_version_5: 5.0.23
4444
mongo_extras_version_6: 6.0.12
4545
mongo_extras_version_7: 7.0.12
46+
47+
editorial:
48+
whats_new:
49+
- title: '**Security updates and bug fixes**'
50+
details:
51+
- IBM Maximo Application Suite Core Platform v9.0 & v9.1
52+
- IBM Maximo Manage v9.0 & v9.1
53+
- IBM SLS v3.0
54+
known_issues: []

src/mas/devops/data/catalogs/v9-250206-amd64.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,18 @@ amlen_extras_version: 1.1.2
112112
# Default Cloud Pak for Data version
113113
# ------------------------------------------------------------------------------
114114
cpd_product_version_default: 5.0.0
115+
116+
editorial:
117+
whats_new:
118+
- title: '**Security updates and bug fixes**'
119+
details:
120+
- IBM Maximo Application Suite Core Platform v8.10, v8.11, v9.0, v9.1
121+
- IBM Maximo IoT v8.7, v8.8 and v9.0
122+
- IBM Maximo Manage v8.7, v8.6, v9.0 and v9.1
123+
- IBM Maximo Monitor v8.11, v8.10 and v9.0
124+
- IBM Maximo Optimizer v8.5, v8.4, v9.0 and v9.1
125+
- IBM Data Dictionary v1.1
126+
- IBM SLS v3.0
127+
- IBM Maximo Visual Inspection v8.9, v9.0 and v9.1
128+
known_issues:
129+
- title: Customers using Maximo Assist v8.7 or v8.8 should not update and must instead contact IBM Support for guidance regarding the removal of IBM Watson Discovery and upgrading to Maximo Assist v9.0

src/mas/devops/data/catalogs/v9-250206-s390x.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,12 @@ mongo_extras_version_4: 4.4.21
4343
mongo_extras_version_5: 5.0.23
4444
mongo_extras_version_6: 6.0.12
4545
mongo_extras_version_7: 7.0.12
46+
47+
editorial:
48+
whats_new:
49+
- title: '**Security updates and bug fixes**'
50+
details:
51+
- IBM Maximo Application Suite Core Platform v9.0 & v9.1
52+
- IBM Maximo Manage v9.0 & v9.1
53+
- IBM SLS v3.0
54+
known_issues: []

src/mas/devops/data/catalogs/v9-250306-amd64.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,20 @@ amlen_extras_version: 1.1.2
113113
# Default Cloud Pak for Data version
114114
# ------------------------------------------------------------------------------
115115
cpd_product_version_default: 5.0.0
116+
117+
editorial:
118+
whats_new:
119+
- title: '**Security updates and bug fixes**'
120+
details:
121+
- IBM Maximo Application Suite Core Platform v8.10, v8.11, v9.0, v9.1
122+
- IBM Maximo Assist v9.0
123+
- IBM Maximo IoT v8.7, v8.8 and v9.0
124+
- IBM Maximo Manage v8.7, v8.6, v9.0 and v9.1
125+
- IBM Maximo Monitor v8.11, v8.10 and v9.0
126+
- IBM Maximo Optimizer v8.5, v8.4, v9.0 and v9.1
127+
- IBM Maximo Predict v9.0, v8.9, v8.8
128+
- IBM Maximo Visual Inspection v8.9, v9.0 and v9.1
129+
- IBM Data Dictionary v1.1
130+
- IBM SLS v3.11
131+
known_issues:
132+
- title: Customers using Maximo Assist v8.7 or v8.8 should not update and must instead contact IBM Support for guidance regarding the removal of IBM Watson Discovery and upgrading to Maximo Assist v9.0

src/mas/devops/data/catalogs/v9-250306-s390x.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,12 @@ mongo_extras_version_4: 4.4.21
4343
mongo_extras_version_5: 5.0.23
4444
mongo_extras_version_6: 6.0.12
4545
mongo_extras_version_7: 7.0.12
46+
47+
editorial:
48+
whats_new:
49+
- title: '**Security updates and bug fixes**'
50+
details:
51+
- IBM Maximo Application Suite Core Platform v9.0 & v9.1
52+
- IBM Maximo Manage v9.0 & v9.1
53+
- IBM SLS v3.0
54+
known_issues: []

src/mas/devops/data/catalogs/v9-250403-amd64.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,20 @@ amlen_extras_version: 1.1.2
113113
# Default Cloud Pak for Data version
114114
# ------------------------------------------------------------------------------
115115
cpd_product_version_default: 5.0.0
116+
117+
editorial:
118+
whats_new:
119+
- title: '**Security updates and bug fixes**'
120+
details:
121+
- IBM Maximo Application Suite Core Platform v8.10, v8.11, v9.0
122+
- IBM Maximo IoT v8.7, v8.8 and v9.0
123+
- IBM Maximo Manage v8.7, v8.6, v9.0
124+
- IBM Maximo Monitor v8.11, v8.10 and v9.0
125+
- IBM Maximo Optimizer v8.5, v8.4, v9.0
126+
- IBM Maximo Predict v9.0, v8.9, v8.8
127+
- IBM Maximo Visual Inspection v8.9, v9.0
128+
- IBM Data Dictionary v1.1
129+
known_issues:
130+
- title: Customers using Maximo Assist v8.7 or v8.8 should not update and must instead contact IBM Support for guidance regarding the removal of IBM Watson Discovery and upgrading to Maximo Assist v9.0
131+
- title: If your Maximo usage is significantly reliant on Maximo Mobile / Maximo's Role Based Applications, it is advised to bypass this Patch 9.0.11 release and await the subsequent patch release for 9.0.12 . Due to the recently encountered issue, this particular patch may not function as intended for Maximo Mobile/Role Based Applications' work order Change Status feature if you have industry solutions layered on top of the core Manage. However, if you still need to apply this patch, we can offer a Limited Availability Fix (LA Fix) in the event you encounter this issue. Please note that you will need to submit a LA Fix request for this
132+
- title: You can click the link below for further details. <a href="https://www.ibm.com/support/pages/bmxaa9238e-when-changing-status-wo-after-applying-managemobile-9011"> www.ibm.com/support/pages/bmxaa9238e-when-changing-status-wo-after-applying-managemobile-9011 </a>

0 commit comments

Comments
 (0)