Skip to content

Commit 11b9768

Browse files
boonwareJosef Harte
andauthored
[minor] support AI Service updates (#1763)
Co-authored-by: Josef Harte <josefharte@Josefs-MacBook-Pro.local>
1 parent eb2d46d commit 11b9768

3 files changed

Lines changed: 23 additions & 11 deletions

File tree

.secrets.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-08-15T21:40:03Z",
6+
"generated_at": "2025-09-03T13:58:29Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ tekton-test: tekton
3030
docker:
3131
docker build -t quay.io/ibmmas/cli:100.0.0-pre.local image/cli
3232

33-
all: ansible python tekton docker
33+
all: ansible-devops python tekton docker
3434

3535
run:
3636
docker run -ti quay.io/ibmmas/cli:100.0.0-pre.local

python/src/mas/cli/update/app.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import logging
1313
import logging.handlers
14+
from typing import Callable
1415
from halo import Halo
1516
from prompt_toolkit import print_formatted_text, HTML
1617

@@ -21,7 +22,7 @@
2122
from .argParser import updateArgParser
2223

2324
from mas.devops.ocp import createNamespace, getStorageClasses, getConsoleURL
24-
from mas.devops.mas import listMasInstances, getCurrentCatalog
25+
from mas.devops.mas import listMasInstances, listAiServiceInstances, getCurrentCatalog
2526
from mas.devops.tekton import preparePipelinesNamespace, installOpenShiftPipelines, updateTektonDefinitions, launchUpdatePipeline
2627

2728

@@ -94,7 +95,10 @@ def update(self, argv):
9495
# deprecated MaximoApplicationSuite ImageContentSourcePolicy instead of the new ImageDigestMirrorSet
9596
self.isAirgap()
9697
self.reviewCurrentCatalog()
97-
self.reviewMASInstance()
98+
isMasInstalled = self.reviewMASInstance()
99+
isAiServiceInstalled = self.reviewAiServiceInstance()
100+
if not isMasInstalled and not isAiServiceInstalled:
101+
self.fatalError(["No MAS or AI Service instances were detected on the cluster => nothing to update! See log file for details"])
98102

99103
if self.args.mas_catalog_version is None:
100104
# Interactive mode
@@ -228,15 +232,23 @@ def reviewCurrentCatalog(self) -> None:
228232
f" <u>{catalogInfo['image']}</u>"
229233
])
230234

231-
def reviewMASInstance(self) -> None:
232-
self.printH1("Review MAS Instances")
233-
self.printDescription(["The following MAS intances are installed on the target cluster and will be affected by the catalog update:"])
235+
def reviewMASInstance(self) -> bool:
236+
return self.reviewInstances(listMasInstances, 'MAS', 'Suite.core.mas.ibm.com/v1')
237+
238+
def reviewAiServiceInstance(self) -> bool:
239+
return self.reviewInstances(listAiServiceInstances, 'AI Service', 'AIServiceApp.aiservice.ibm.com/v1')
240+
241+
def reviewInstances(self, getInstances: Callable, name: str, kind: str) -> bool:
242+
self.printH1(f"Review {name} Instances")
234243
try:
235-
suites = listMasInstances(self.dynamicClient)
236-
for suite in suites:
237-
self.printDescription([f"- <u>{suite['metadata']['name']}</u> v{suite['status']['versions']['reconciled']}"])
244+
instances = getInstances(self.dynamicClient)
245+
self.printDescription([f"The following {name} instances are installed on the target cluster and will be affected by the catalog update:"])
246+
for instance in instances:
247+
self.printDescription([f"- <u>{instance['metadata']['name']}</u> v{instance['status']['versions']['reconciled']}"])
248+
return True
238249
except ResourceNotFoundError:
239-
self.fatalError("No MAS instances were detected on the cluster (Suite.core.mas.ibm.com/v1 API is not available). See log file for details")
250+
self.printDescription([f"No {name} instances were detected on the cluster ({kind} API is not available)"])
251+
return False
240252

241253
def chooseCatalog(self) -> None:
242254
self.printH1("Select IBM Maximo Operator Catalog Version")

0 commit comments

Comments
 (0)