mas-cli 10.0.6__py3-none-any.whl → 10.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mas-cli might be problematic. Click here for more details.

mas/cli/__init__.py CHANGED
@@ -8,4 +8,4 @@
8
8
  #
9
9
  # *****************************************************************************
10
10
 
11
- __version__ = "10.0.6"
11
+ __version__ = "10.1.1"
mas/cli/cli.py CHANGED
@@ -124,9 +124,7 @@ class BaseApp(PrintMixin, PromptMixin):
124
124
  self.printTitle(f"\nIBM Maximo Application Suite Admin CLI v{self.version}")
125
125
  print_formatted_text(HTML("Powered by <DarkGoldenRod><u>https://github.com/ibm-mas/ansible-devops/</u></DarkGoldenRod> and <DarkGoldenRod><u>https://tekton.dev/</u></DarkGoldenRod>\n"))
126
126
  if which("kubectl") is None:
127
- logger.error("Could not find kubectl on the path")
128
- print_formatted_text(HTML("\n<Red>Error: Could not find kubectl on the path, see <u>https://kubernetes.io/docs/tasks/tools/#kubectl</u> for installation instructions</Red>\n"))
129
- exit(1)
127
+ self.fatalError("Could not find kubectl on the path, see <u>https://kubernetes.io/docs/tasks/tools/#kubectl</u> for installation instructions")
130
128
 
131
129
  def getCompatibleVersions(self, coreChannel: str, appId: str) -> list:
132
130
  if coreChannel in self.compatibilityMatrix:
@@ -136,8 +134,11 @@ class BaseApp(PrintMixin, PromptMixin):
136
134
 
137
135
  def fatalError(self, message: str, exception: Exception=None) -> None:
138
136
  if exception is not None:
137
+ logger.error(message)
138
+ logger.exception(exception, stack_info=True)
139
139
  print_formatted_text(HTML(f"<Red>Fatal Exception: {message.replace(' & ', ' &amp; ')}: {exception}</Red>"))
140
140
  else:
141
+ logger.error(message)
141
142
  print_formatted_text(HTML(f"<Red>Fatal Error: {message.replace(' & ', ' &amp; ')}</Red>"))
142
143
  exit(1)
143
144
 
@@ -7,3 +7,5 @@
7
7
  # http://www.eclipse.org/legal/epl-v10.html
8
8
  #
9
9
  # *****************************************************************************
10
+
11
+ from ..cli import BaseApp
@@ -1,4 +1,4 @@
1
- #!python
1
+ #!/usr/bin/env python
2
2
  # *****************************************************************************
3
3
  # Copyright (c) 2024 IBM Corporation and other Contributors.
4
4
  #
@@ -18,20 +18,16 @@ import re
18
18
  from openshift.dynamic.exceptions import NotFoundError
19
19
 
20
20
  from prompt_toolkit import prompt, print_formatted_text, HTML
21
- from urllib3.exceptions import MaxRetryError
22
- from jinja2.exceptions import TemplateNotFound
23
- from kubeconfig.exceptions import KubectlCommandError
24
- from kubernetes.client.exceptions import ApiException
25
21
 
26
22
  from tabulate import tabulate
27
23
 
28
24
  from halo import Halo
29
25
 
30
- from mas.cli.cli import BaseApp
31
- from mas.cli.gencfg import ConfigGeneratorMixin
32
- from mas.cli.install.argParser import installArgParser
33
- from mas.cli.install.settings import InstallSettingsMixin
34
- from mas.cli.install.summarizer import InstallSummarizerMixin
26
+ from ..cli import BaseApp
27
+ from ..gencfg import ConfigGeneratorMixin
28
+ from .argParser import installArgParser
29
+ from .settings import InstallSettingsMixin
30
+ from .summarizer import InstallSummarizerMixin
35
31
 
36
32
  from mas.cli.validators import (
37
33
  InstanceIDFormatValidator,
@@ -47,7 +43,7 @@ from mas.devops.tekton import installOpenShiftPipelines, updateTektonDefinitions
47
43
  logger = logging.getLogger(__name__)
48
44
 
49
45
 
50
- class App(BaseApp, InstallSettingsMixin, InstallSummarizerMixin, ConfigGeneratorMixin):
46
+ class InstallApp(BaseApp, InstallSettingsMixin, InstallSummarizerMixin, ConfigGeneratorMixin):
51
47
  def validateCatalogSource(self):
52
48
  catalogsAPI = self.dynamicClient.resources.get(api_version="operators.coreos.com/v1alpha1", kind="CatalogSource")
53
49
  try:
@@ -667,7 +663,7 @@ class App(BaseApp, InstallSettingsMixin, InstallSummarizerMixin, ConfigGenerator
667
663
  "mas_arcgis_channel"
668
664
  ]
669
665
 
670
- for key, value in vars(args).items():
666
+ for key, value in vars(self.args).items():
671
667
  # These fields we just pass straight through to the parameters and fail if they are not set
672
668
  if key in requiredParams:
673
669
  if value is None:
@@ -778,10 +774,12 @@ class App(BaseApp, InstallSettingsMixin, InstallSummarizerMixin, ConfigGenerator
778
774
  self.validateCatalogSource()
779
775
  self.licensePrompt()
780
776
 
781
- def install(self, args):
777
+ def install(self, argv):
782
778
  """
783
779
  Install MAS instance
784
780
  """
781
+ args = installArgParser.parse_args(args=argv)
782
+
785
783
  # We use the presence of --mas-instance-id to determine whether
786
784
  # the CLI is being started in interactive mode or not
787
785
  instanceId = args.mas_instance_id
@@ -967,25 +965,3 @@ class App(BaseApp, InstallSettingsMixin, InstallSummarizerMixin, ConfigGenerator
967
965
  else:
968
966
  h.stop_and_persist(symbol=self.failureIcon, text=f"Failed to submit PipelineRun for {self.getParam('mas_instance_id')} install, see log file for details")
969
967
  print()
970
-
971
-
972
- if __name__ == '__main__':
973
- args = installArgParser.parse_args()
974
-
975
- try:
976
- app = App()
977
- app.install(args)
978
- except KeyboardInterrupt as e:
979
- pass
980
- except ApiException as e:
981
- logger.exception(e, stack_info=True)
982
- app.fatalError(message=f"An error occured communicating with the target server: {e.reason} ({e.status})")
983
- except MaxRetryError as e:
984
- logger.exception(e, stack_info=True)
985
- app.fatalError(message="Unable to connect to API server", exception=e)
986
- except TemplateNotFound as e:
987
- logger.exception(e, stack_info=True)
988
- app.fatalError("Could not find template", exception=e)
989
- except KubectlCommandError as e:
990
- logger.exception(e, stack_info=True)
991
- app.fatalError("Could not execute kubectl command", exception=e)
@@ -21,7 +21,7 @@ def isValidFile(parser, arg) -> str:
21
21
  return arg
22
22
 
23
23
  installArgParser = argparse.ArgumentParser(
24
- prog="mas uninstall",
24
+ prog="mas install",
25
25
  description="\n".join([
26
26
  f"IBM Maximo Application Suite Admin CLI v{packageVersion}",
27
27
  "Install MAS by configuring and launching the MAS Uninstall Tekton Pipeline.\n",