Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/src/mas/cli/aiservice/install/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def install(self, argv):
self.lookupTargetArchitecture()

if self.dynamicClient is None:
print_formatted_text(HTML("<Red>Error: The Kubernetes dynamic Client is not available. See log file for details</Red>"))
print_formatted_text(HTML("<Red>Error: Not successfully connected to a Kubernetes cluster. See log file for details</Red>"))
exit(1)

# Perform a check whether the cluster is set up for airgap install, this will trigger an early failure if the cluster is using the now
Expand Down
2 changes: 1 addition & 1 deletion python/src/mas/cli/aiservice/upgrade/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def upgrade(self, argv):
self.lookupTargetArchitecture()

if self.dynamicClient is None:
print_formatted_text(HTML("<Red>Error: The Kubernetes dynamic Client is not available. See log file for details</Red>"))
print_formatted_text(HTML("<Red>Error: Not successfully connected to a Kubernetes cluster. See log file for details</Red>"))
sys.exit(1)

if aiserviceInstanceId is None:
Expand Down
2 changes: 1 addition & 1 deletion python/src/mas/cli/backup/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def backup(self, argv):
self.connect()

if self.dynamicClient is None:
self.fatalError("The Kubernetes dynamic Client is not available. See log file for details")
self.fatalError("Not successfully connected to a Kubernetes cluster. See log file for details")

# Perform a check whether the cluster is set up for airgap install
self.isAirgap()
Expand Down
4 changes: 3 additions & 1 deletion python/src/mas/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,12 @@ def lookupTargetArchitecture(self, architecture: str | None = None) -> None:
if architecture is not None:
self.architecture = architecture
logger.debug(f"Target architecture (overridden): {self.architecture}")
else:
elif self.dynamicClient is not None:
nodes = getNodes(self.dynamicClient)
self.architecture = nodes[0]["status"]["nodeInfo"]["architecture"]
logger.debug(f"Target architecture: {self.architecture}")
else:
return

if self.architecture not in ["amd64", "s390x", "ppc64le"]:
self.fatalError(f"Unsupported worker node architecture: {self.architecture}")
Expand Down
9 changes: 7 additions & 2 deletions python/src/mas/cli/install/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
JsonValidator,
OptimizerInstallPlanValidator,
BucketPrefixValidator,
NotEmptyValidator,
)

from mas.devops.ocp import (
Expand Down Expand Up @@ -1347,7 +1348,11 @@ def configApps(self):
def configAppChannel(self, appId):
versions = self.getCompatibleVersions(self.params["mas_channel"], appId)
if len(versions) == 0:
self.params[f"mas_app_channel_{appId}"] = prompt(HTML(f"<Yellow>Custom channel for {appId}</Yellow>"))
self.promptForString(
f"Custom channel for {appId}",
f"mas_app_channel_{appId}",
validator=NotEmptyValidator(),
)
else:
self.params[f"mas_app_channel_{appId}"] = versions[0]

Expand Down Expand Up @@ -2502,7 +2507,7 @@ def install(self, argv):
self.lookupTargetArchitecture()

if self.dynamicClient is None:
print_formatted_text(HTML("<Red>Error: The Kubernetes dynamic Client is not available. See log file for details</Red>"))
print_formatted_text(HTML("<Red>Error: Not successfully connected to a Kubernetes cluster. See log file for details</Red>"))
exit(1)

# Perform a check whether the cluster is set up for airgap install, this will trigger an early failure if the cluster is using the now
Expand Down
2 changes: 1 addition & 1 deletion python/src/mas/cli/restore/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def restore(self, argv):
self.connect()

if self.dynamicClient is None:
self.fatalError("The Kubernetes dynamic Client is not available. See log file for details")
self.fatalError("Not successfully connected to a Kubernetes cluster. See log file for details")

# Perform a check whether the cluster is set up for airgap install
self.isAirgap()
Expand Down
2 changes: 1 addition & 1 deletion python/src/mas/cli/uninstall/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def uninstall(self, argv):
logger.debug("MAS instance ID is set, so we assume already connected to the desired OCP")

if self.dynamicClient is None:
self.fatalError("The Kubernetes dynamic Client is not available. See log file for details")
self.fatalError("Not successfully connected to a Kubernetes cluster. See log file for details")

if instanceId is None:
# Interactive mode
Expand Down
2 changes: 1 addition & 1 deletion python/src/mas/cli/update/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def update(self, argv):
self.connect()

if self.dynamicClient is None:
self.fatalError("The Kubernetes dynamic Client is not available. See log file for details")
self.fatalError("Not successfully connected to a Kubernetes cluster. See log file for details")

# Perform a check whether the cluster is set up for airgap install, this will trigger an early failure if the cluster is using the now
# deprecated MaximoApplicationSuite ImageContentSourcePolicy instead of the new ImageDigestMirrorSet
Expand Down
2 changes: 1 addition & 1 deletion python/src/mas/cli/upgrade/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def upgrade(self, argv):
self.lookupTargetArchitecture()

if self.dynamicClient is None:
print_formatted_text(HTML("<Red>Error: The Kubernetes dynamic Client is not available. See log file for details</Red>"))
print_formatted_text(HTML("<Red>Error: Not successfully connected to a Kubernetes cluster. See log file for details</Red>"))
sys.exit(1)

if instanceId is None:
Expand Down
11 changes: 11 additions & 0 deletions python/src/mas/cli/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,14 @@ def validate(self, document: Document) -> None:

if not match(r"^.{1,4}$", bucketPrefix):
raise ValidationError(message="Bucket prefix does not meet the requirement", cursor_position=len(bucketPrefix))


class NotEmptyValidator(Validator):
def validate(self, document: Document) -> None:
"""
Validate that the input value is not empty
"""
value = document.text

if not match(r"^.+$", value):
raise ValidationError(message="Enter a value", cursor_position=0)
Loading