Skip to content

Commit d0cd7c1

Browse files
[patch]
1 parent c26425f commit d0cd7c1

1 file changed

Lines changed: 58 additions & 54 deletions

File tree

python/src/mas/cli/install/settings/aiSettings.py

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,41 @@ def generateAiCfg(self, instanceId: str, scope: str, destination: str, workspace
6464

6565
def configAi(self, silentMode=False) -> None:
6666
"""Configure AiCfg for MAS installation"""
67+
68+
# FIRST: Check MAS version - AiCfg is only supported in MAS 9.2+
69+
# This must be done BEFORE checking user preferences to prevent errors on 9.1
70+
mas_channel = self.getParam("mas_channel")
71+
is_mas_92_or_later = False
72+
73+
if mas_channel:
74+
try:
75+
# Extract major.minor version (e.g., "9.2" from "9.2.0")
76+
version_parts = mas_channel.split(".")
77+
if len(version_parts) >= 2:
78+
major = int(version_parts[0])
79+
minor = int(version_parts[1])
80+
is_mas_92_or_later = (major > 9) or (major == 9 and minor >= 2)
81+
except (ValueError, IndexError):
82+
pass
83+
84+
# If MAS 9.1 or earlier, force disable AiCfg regardless of user input
85+
if not is_mas_92_or_later:
86+
if not silentMode:
87+
self.printH1("Configure AiCfg")
88+
self.printDescription(
89+
[
90+
"⚠️ IMPORTANT: AiCfg is only available in MAS 9.2 and later.",
91+
f" Your MAS channel is: {mas_channel or 'not set'}",
92+
"",
93+
"AiCfg configuration will be skipped.",
94+
"If you upgrade to MAS 9.2+ in the future, you can configure AiCfg then.",
95+
]
96+
)
97+
self.setParam("configure_aiassistant", "none")
98+
print_formatted_text("⚠️ AiCfg configuration skipped (requires MAS 9.2+)")
99+
return
100+
101+
# MAS 9.2+ - proceed with normal configuration
67102
if not silentMode:
68103
self.printH1("Configure AiCfg")
69104
self.printDescription(
@@ -97,61 +132,27 @@ def configAi(self, silentMode=False) -> None:
97132

98133
# Check if AI Service is being installed on the same cluster
99134
if hasattr(self, "installAIService") and self.installAIService:
100-
# Check MAS version - AiCfg is only supported in MAS 9.2+
101-
mas_channel = self.getParam("mas_channel")
102-
is_mas_92_or_later = False
103-
104-
if mas_channel:
105-
try:
106-
# Extract major.minor version (e.g., "9.2" from "9.2.0")
107-
version_parts = mas_channel.split(".")
108-
if len(version_parts) >= 2:
109-
major = int(version_parts[0])
110-
minor = int(version_parts[1])
111-
is_mas_92_or_later = (major > 9) or (major == 9 and minor >= 2)
112-
except (ValueError, IndexError):
113-
pass
114-
115-
if is_mas_92_or_later:
116-
# AI Service will be installed - defer AiCfg generation to pipeline
117-
if not silentMode:
118-
self.printH2("AiCfg Configuration (Automatic)")
119-
self.printDescription(
120-
[
121-
"AI Service is being installed on this cluster.",
122-
"The AiCfg will be automatically generated and applied by the pipeline",
123-
"AFTER AI Service installation completes.",
124-
"",
125-
"The pipeline will:",
126-
" 1. Install AI Service first",
127-
" 2. Auto-detect connection details (URL, API key, certificate)",
128-
" 3. Generate and apply AiCfg automatically",
129-
"",
130-
"No manual configuration needed!",
131-
]
132-
)
133-
134-
# Set action to indicate pipeline should handle it
135-
self.setParam("configure_aiassistant", "pipeline")
136-
print_formatted_text("\n✓ AiCfg will be automatically configured by the pipeline after AI Service installation")
137-
else:
138-
# MAS 9.1 or earlier - AiCfg not supported
139-
if not silentMode:
140-
self.printH2("AiCfg Configuration (Not Available)")
141-
self.printDescription(
142-
[
143-
"AI Service is being installed on this cluster.",
144-
"",
145-
"⚠️ IMPORTANT: AiCfg is only available in MAS 9.2 and later.",
146-
f" Your MAS channel is: {mas_channel or 'not set'}",
147-
"",
148-
"The AiCfg custom resource will NOT be created automatically.",
149-
"If you upgrade to MAS 9.2+ in the future, you can configure AiCfg then.",
150-
]
151-
)
135+
# AI Service will be installed - defer AiCfg generation to pipeline
136+
if not silentMode:
137+
self.printH2("AiCfg Configuration (Automatic)")
138+
self.printDescription(
139+
[
140+
"AI Service is being installed on this cluster.",
141+
"The AiCfg will be automatically generated and applied by the pipeline",
142+
"AFTER AI Service installation completes.",
143+
"",
144+
"The pipeline will:",
145+
" 1. Install AI Service first",
146+
" 2. Auto-detect connection details (URL, API key, certificate)",
147+
" 3. Generate and apply AiCfg automatically",
148+
"",
149+
"No manual configuration needed!",
150+
]
151+
)
152152

153-
self.setParam("configure_aiassistant", "none")
154-
print_formatted_text("\n⚠️ AiCfg configuration skipped (requires MAS 9.2+)")
153+
# Set action to indicate pipeline should handle it
154+
self.setParam("configure_aiassistant", "pipeline")
155+
print_formatted_text("\n✓ AiCfg will be automatically configured by the pipeline after AI Service installation")
155156
else:
156157
# Manual configuration for external AI Service
157158
if not silentMode:
@@ -199,3 +200,6 @@ def configAi(self, silentMode=False) -> None:
199200
else:
200201
self.setParam("configure_aiassistant", "none")
201202
print_formatted_text("AiCfg configuration skipped")
203+
204+
205+
# Made with Bob

0 commit comments

Comments
 (0)