mas-cli 15.4.0__py3-none-any.whl → 15.6.0__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__ = "15.4.0" # Python module compatible semver
11
+ __version__ = "15.6.0" # Python module compatible semver
@@ -24,6 +24,7 @@ from tabulate import tabulate
24
24
  from halo import Halo
25
25
 
26
26
  from ...cli import BaseApp
27
+ from ...gencfg import ConfigGeneratorMixin
27
28
  from .argBuilder import aiServiceInstallArgBuilderMixin
28
29
  from .argParser import aiServiceinstallArgParser
29
30
  from .summarizer import aiServiceInstallSummarizerMixin
@@ -74,7 +75,7 @@ def logMethodCall(func):
74
75
  return wrapper
75
76
 
76
77
 
77
- class AiServiceInstallApp(BaseApp, aiServiceInstallArgBuilderMixin, aiServiceInstallSummarizerMixin, MongoDbSettingsMixin, Db2SettingsMixin, AdditionalConfigsMixin):
78
+ class AiServiceInstallApp(BaseApp, aiServiceInstallArgBuilderMixin, aiServiceInstallSummarizerMixin, MongoDbSettingsMixin, Db2SettingsMixin, AdditionalConfigsMixin, ConfigGeneratorMixin):
78
79
  @logMethodCall
79
80
  def processCatalogChoice(self) -> list:
80
81
  self.catalogDigest = self.chosenCatalog["catalog_digest"]
@@ -759,8 +760,8 @@ class AiServiceInstallApp(BaseApp, aiServiceInstallArgBuilderMixin, aiServiceIns
759
760
  for storageClass in getStorageClasses(self.dynamicClient):
760
761
  print_formatted_text(HTML(f"<LightSlateGrey> - {storageClass.metadata.name}</LightSlateGrey>"))
761
762
 
762
- self.params["storage_class_rwo"] = prompt(HTML('<Yellow>ReadWriteOnce (RWO) storage class</Yellow> '), validator=StorageClassValidator(), validate_while_typing=False)
763
- self.params["storage_class_rwx"] = prompt(HTML('<Yellow>ReadWriteMany (RWX) storage class</Yellow> '), validator=StorageClassValidator(), validate_while_typing=False)
763
+ self.params["storage_class_rwo"] = prompt(message=HTML('<Yellow>ReadWriteOnce (RWO) storage class</Yellow> '), validator=StorageClassValidator(), validate_while_typing=False)
764
+ self.params["storage_class_rwx"] = prompt(message=HTML('<Yellow>ReadWriteMany (RWX) storage class</Yellow> '), validator=StorageClassValidator(), validate_while_typing=False)
764
765
 
765
766
  # Configure storage class for pipeline PVC
766
767
  # We prefer to use ReadWriteMany, but we can cope with ReadWriteOnce if necessary
mas/cli/cli.py CHANGED
@@ -21,7 +21,8 @@ import json
21
21
 
22
22
  # Use of the openshift client rather than the kubernetes client allows us access to "apply"
23
23
  from kubernetes import config
24
- from kubernetes.client import api_client, Configuration
24
+ from kubernetes.client.api_client import ApiClient
25
+ from kubernetes.client import Configuration
25
26
  from openshift.dynamic import DynamicClient
26
27
  from openshift.dynamic.exceptions import NotFoundError
27
28
 
@@ -117,7 +118,7 @@ class BaseApp(PrintMixin, PromptMixin):
117
118
  logging.getLogger('asyncio').setLevel(logging.INFO)
118
119
 
119
120
  # Supports extended semver, unlike mas.cli.__version__
120
- self.version = "15.4.0"
121
+ self.version = "15.6.0"
121
122
  self.h1count = 0
122
123
  self.h2count = 0
123
124
 
@@ -337,11 +338,11 @@ class BaseApp(PrintMixin, PromptMixin):
337
338
  if "KUBERNETES_SERVICE_HOST" in environ:
338
339
  config.load_incluster_config()
339
340
  k8s_config = Configuration.get_default_copy()
340
- self._apiClient = api_client.ApiClient(configuration=k8s_config)
341
+ self._apiClient = ApiClient(configuration=k8s_config)
341
342
  self._dynClient = DynamicClient(self._apiClient)
342
343
  else:
343
344
  config.load_kube_config()
344
- self._apiClient = api_client.ApiClient()
345
+ self._apiClient = ApiClient()
345
346
  self._dynClient = DynamicClient(self._apiClient)
346
347
  return self._dynClient
347
348
  except Exception as e:
@@ -430,3 +431,9 @@ class BaseApp(PrintMixin, PromptMixin):
430
431
  if enabled:
431
432
  logger.debug(f"Enabling approval workflow for {id} with {maxRetries} max retries on a {delay}s delay ({'ignoring failures' if ignoreFailure else 'abort on failure'})")
432
433
  cmAPI.create(body=configMap, namespace=namespace)
434
+
435
+ @logMethodCall
436
+ def selectLocalConfigDir(self) -> None:
437
+ if self.localConfigDir is None:
438
+ # You need to tell us where the configuration file can be found
439
+ self.localConfigDir = self.promptForDir("Select Local configuration directory")
mas/cli/displayMixins.py CHANGED
@@ -79,7 +79,7 @@ def masPromptValue(message):
79
79
 
80
80
  class PromptMixin():
81
81
  def yesOrNo(self, message: str, param: str = None) -> bool:
82
- response = prompt(masPromptYesOrNo(message), validator=YesNoValidator(), validate_while_typing=False)
82
+ response = prompt(message=masPromptYesOrNo(message), validator=YesNoValidator(), validate_while_typing=False)
83
83
  responseAsBool = response.lower() in ["y", "yes"]
84
84
 
85
85
  if param is not None:
@@ -92,9 +92,9 @@ class PromptMixin():
92
92
 
93
93
  if completer is not None:
94
94
  promptSession = PromptSession()
95
- response = promptSession.prompt(masPromptValue(message), is_password=isPassword, default=default, completer=completer, validator=validator, validate_while_typing=False, pre_run=promptSession.default_buffer.start_completion)
95
+ response = promptSession.prompt(message=masPromptValue(message), is_password=isPassword, default=default, completer=completer, validator=validator, validate_while_typing=False, pre_run=promptSession.default_buffer.start_completion)
96
96
  else:
97
- response = prompt(masPromptValue(message), is_password=isPassword, default=default, completer=completer, validator=validator, validate_while_typing=False)
97
+ response = prompt(message=masPromptValue(message), is_password=isPassword, default=default, completer=completer, validator=validator, validate_while_typing=False)
98
98
 
99
99
  if param is not None:
100
100
  self.params[param] = response
@@ -105,9 +105,9 @@ class PromptMixin():
105
105
  default = getenv(param.upper(), default=None)
106
106
 
107
107
  if default is None:
108
- response = int(prompt(masPromptValue(message)))
108
+ response = int(prompt(message=masPromptValue(message)))
109
109
  else:
110
- response = int(prompt(masPromptValue(message), default=str(default)))
110
+ response = int(prompt(message=masPromptValue(message), default=str(default)))
111
111
  if param is not None:
112
112
  self.params[param] = str(response)
113
113
  return response
@@ -121,12 +121,12 @@ class PromptMixin():
121
121
  if default == "" and envVar != "":
122
122
  default = getenv(envVar, "")
123
123
  if mustExist:
124
- return prompt(masPromptValue(message), validator=FileExistsValidator(), validate_while_typing=False, default=default)
124
+ return prompt(message=masPromptValue(message), validator=FileExistsValidator(), validate_while_typing=False, default=default)
125
125
  else:
126
- return prompt(masPromptValue(message), default=default)
126
+ return prompt(message=masPromptValue(message), default=default)
127
127
 
128
128
  def promptForDir(self, message: str, mustExist: bool = True, default: str = "") -> None:
129
129
  if mustExist:
130
- return prompt(masPromptValue(message), validator=DirectoryExistsValidator(), validate_while_typing=False, default=default)
130
+ return prompt(message=masPromptValue(message), validator=DirectoryExistsValidator(), validate_while_typing=False, default=default)
131
131
  else:
132
- return prompt(masPromptValue(message), default=default)
132
+ return prompt(message=masPromptValue(message), default=default)
mas/cli/install/app.py CHANGED
@@ -325,12 +325,6 @@ class InstallApp(BaseApp, InstallSettingsMixin, InstallSummarizerMixin, ConfigGe
325
325
  if self.showAdvancedOptions:
326
326
  self.promptForString("IBM Data Reporter Operator (DRO) Namespace", "dro_namespace", default="redhat-marketplace")
327
327
 
328
- @logMethodCall
329
- def selectLocalConfigDir(self) -> None:
330
- if self.localConfigDir is None:
331
- # You need to tell us where the configuration file can be found
332
- self.localConfigDir = self.promptForDir("Select Local configuration directory")
333
-
334
328
  @logMethodCall
335
329
  def configGrafana(self) -> None:
336
330
  if self.architecture == "s390x" or self.architecture == "ppc64le":
@@ -1055,6 +1049,12 @@ class InstallApp(BaseApp, InstallSettingsMixin, InstallSummarizerMixin, ConfigGe
1055
1049
  self.setParam(key, value)
1056
1050
  if value in ["jms", "snojms"]:
1057
1051
  self.setParam("mas_app_settings_persistent_volumes_flag", "true")
1052
+ elif key == "mas_app_settings_base_lang":
1053
+ if value is not None and value != "":
1054
+ self.setParam(key, value.upper())
1055
+ elif key == "mas_app_settings_secondary_langs":
1056
+ if value is not None and value != "":
1057
+ self.setParam(key, value.upper())
1058
1058
 
1059
1059
  # MongoDB
1060
1060
  elif key == "mongodb_namespace":
mas/cli/install/params.py CHANGED
@@ -53,8 +53,6 @@ optionalParams = [
53
53
  "mas_app_settings_old_crypto_key",
54
54
  "mas_app_settings_old_cryptox_key",
55
55
  "mas_app_settings_override_encryption_secrets_flag",
56
- "mas_app_settings_base_lang",
57
- "mas_app_settings_secondary_langs",
58
56
  "mas_app_settings_server_timezone",
59
57
  "mas_appws_bindings_jdbc_manage",
60
58
  "mas_appws_components",
@@ -8,6 +8,8 @@
8
8
  #
9
9
  # *****************************************************************************
10
10
 
11
+ from prompt_toolkit.completion import WordCompleter
12
+ from mas.cli.validators import LanguageValidator
11
13
  import logging
12
14
  logger = logging.getLogger(__name__)
13
15
 
@@ -226,15 +228,18 @@ class ManageSettingsMixin():
226
228
  self.printDescription([
227
229
  f"Define the base language for Maximo {self.manageAppName}"
228
230
  ])
229
- self.promptForString("Base language", "mas_app_settings_base_lang", default="EN")
231
+ baseLanguage = self.promptForString("Base language", validator=LanguageValidator(self.supportedLanguages), completer=WordCompleter(self.supportedLanguages))
232
+
233
+ self.setParam("mas_app_settings_base_lang", baseLanguage.upper())
230
234
 
231
235
  self.printDescription([
232
- f"Define the additional languages to be configured in Maximo {self.manageAppName}. provide a comma-separated list of supported languages codes, for example: 'JA,DE,AR'",
236
+ f"Define the additional languages to be configured in Maximo {self.manageAppName}. Provide a comma-separated list of the supported languages indexes, for example: 'DA,EN,ZH-TW'",
233
237
  "A complete list of available language codes is available online:",
234
238
  " <Orange><u>https://www.ibm.com/docs/en/mas-cd/mhmpmh-and-p-u/continuous-delivery?topic=deploy-language-support</u></Orange>"
235
239
  ])
236
240
 
237
- self.promptForString("Secondary languages", "mas_app_settings_secondary_langs")
241
+ secondaryLanguages = self.promptForString("Secondary language", validator=LanguageValidator(self.supportedLanguages), completer=WordCompleter(self.supportedLanguages))
242
+ self.setParam("mas_app_settings_secondary_langs", secondaryLanguages.upper())
238
243
 
239
244
  def manageSettingsCP4D(self) -> None:
240
245
  if self.getParam("mas_app_channel_manage") in ["8.7.x", "9.0.x"] and self.showAdvancedOptions:
@@ -250,6 +255,7 @@ class ManageSettingsMixin():
250
255
 
251
256
  def manageSettingsOther(self) -> None:
252
257
  self.printH2(f"Maximo {self.manageAppName} Settings - Other")
258
+ self.supportedLanguages = ["AR", "CS", "DA", "DE", "EN", "ES", "FI", "FR", "HE", "HR", "HU", "IT", "JA", "KO", "NL", "NO", "PL", "PT-BR", "RU", "SK", "SL", "SV", "TR", "UK", "ZH-CN", "ZH-TW"]
253
259
  if self.isManageFoundation:
254
260
  self.printDescription([
255
261
  "Configure additional settings:",