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 +1 -1
- mas/cli/cli.py +4 -3
- mas/cli/install/__init__.py +2 -0
- mas_cli-10.0.6.data/scripts/mas-install → mas/cli/install/app.py +11 -35
- mas/cli/install/argParser.py +1 -1
- mas/cli/templates/ibm-mas-tekton.yaml +164 -57
- mas/cli/uninstall/__init__.py +11 -0
- mas_cli-10.0.6.data/scripts/mas-uninstall → mas/cli/uninstall/app.py +8 -128
- mas/cli/uninstall/argParser.py +108 -0
- mas/cli/upgrade/__init__.py +11 -0
- mas_cli-10.0.6.data/scripts/mas-upgrade → mas/cli/upgrade/app.py +13 -65
- mas/cli/upgrade/argParser.py +56 -0
- mas_cli-10.1.1.data/scripts/mas-cli +75 -0
- {mas_cli-10.0.6.dist-info → mas_cli-10.1.1.dist-info}/METADATA +1 -1
- {mas_cli-10.0.6.dist-info → mas_cli-10.1.1.dist-info}/RECORD +17 -12
- {mas_cli-10.0.6.dist-info → mas_cli-10.1.1.dist-info}/WHEEL +1 -1
- {mas_cli-10.0.6.dist-info → mas_cli-10.1.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# *****************************************************************************
|
|
2
|
+
# Copyright (c) 2024 IBM Corporation and other Contributors.
|
|
3
|
+
#
|
|
4
|
+
# All rights reserved. This program and the accompanying materials
|
|
5
|
+
# are made available under the terms of the Eclipse Public License v1.0
|
|
6
|
+
# which accompanies this distribution, and is available at
|
|
7
|
+
# http://www.eclipse.org/legal/epl-v10.html
|
|
8
|
+
#
|
|
9
|
+
# *****************************************************************************
|
|
10
|
+
|
|
11
|
+
from ..cli import BaseApp
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env python
|
|
2
2
|
# *****************************************************************************
|
|
3
3
|
# Copyright (c) 2024 IBM Corporation and other Contributors.
|
|
4
4
|
#
|
|
@@ -9,23 +9,17 @@
|
|
|
9
9
|
#
|
|
10
10
|
# *****************************************************************************
|
|
11
11
|
|
|
12
|
-
import argparse
|
|
13
|
-
import sys
|
|
14
12
|
import logging
|
|
15
13
|
import logging.handlers
|
|
16
14
|
from halo import Halo
|
|
17
15
|
from prompt_toolkit import print_formatted_text, HTML
|
|
18
16
|
from prompt_toolkit.completion import WordCompleter
|
|
19
17
|
|
|
20
|
-
from jinja2.exceptions import TemplateNotFound
|
|
21
|
-
from urllib3.exceptions import MaxRetryError
|
|
22
18
|
from openshift.dynamic.exceptions import NotFoundError, ResourceNotFoundError
|
|
23
|
-
from kubeconfig.exceptions import KubectlCommandError
|
|
24
|
-
from kubernetes.client.exceptions import ApiException
|
|
25
19
|
|
|
26
|
-
from
|
|
27
|
-
from
|
|
28
|
-
from
|
|
20
|
+
from ..cli import BaseApp
|
|
21
|
+
from ..validators import InstanceIDValidator
|
|
22
|
+
from .argParser import uninstallArgParser
|
|
29
23
|
|
|
30
24
|
from mas.devops.ocp import createNamespace
|
|
31
25
|
from mas.devops.mas import listMasInstances, verifyMasInstance
|
|
@@ -34,12 +28,13 @@ from mas.devops.tekton import installOpenShiftPipelines, updateTektonDefinitions
|
|
|
34
28
|
|
|
35
29
|
logger = logging.getLogger(__name__)
|
|
36
30
|
|
|
37
|
-
class
|
|
38
|
-
def uninstall(self,
|
|
31
|
+
class UninstallApp(BaseApp):
|
|
32
|
+
def uninstall(self, argv):
|
|
39
33
|
"""
|
|
40
34
|
Uninstall MAS instance
|
|
41
35
|
"""
|
|
42
|
-
|
|
36
|
+
args = uninstallArgParser.parse_args(args=argv)
|
|
37
|
+
instanceId = args.mas_instance_id
|
|
43
38
|
self.noConfirm = args.no_confirm
|
|
44
39
|
|
|
45
40
|
if args.uninstall_all_deps:
|
|
@@ -195,118 +190,3 @@ class App(BaseApp):
|
|
|
195
190
|
else:
|
|
196
191
|
h.stop_and_persist(symbol=self.failureIcon, text=f"Failed to submit PipelineRun for {instanceId} uninstall, see log file for details")
|
|
197
192
|
print()
|
|
198
|
-
|
|
199
|
-
if __name__ == '__main__':
|
|
200
|
-
parser = argparse.ArgumentParser(
|
|
201
|
-
prog='mas uninstall',
|
|
202
|
-
description="\n".join([
|
|
203
|
-
f"IBM Maximo Application Suite Admin CLI v{packageVersion}",
|
|
204
|
-
"Uninstall MAS by configuring and launching the MAS Uninstall Tekton Pipeline.\n",
|
|
205
|
-
"Interactive Mode:",
|
|
206
|
-
"Omitting the --instance-id option will trigger an interactive prompt"
|
|
207
|
-
]),
|
|
208
|
-
epilog="Refer to the online documentation for more information: https://ibm-mas.github.io/cli/",
|
|
209
|
-
formatter_class=getHelpFormatter(),
|
|
210
|
-
add_help=False
|
|
211
|
-
)
|
|
212
|
-
|
|
213
|
-
masArgGroup = parser.add_argument_group('MAS Instance Selection')
|
|
214
|
-
masArgGroup.add_argument(
|
|
215
|
-
'--instance-id',
|
|
216
|
-
required=False,
|
|
217
|
-
help="The MAS instance ID to be uninstalled"
|
|
218
|
-
)
|
|
219
|
-
|
|
220
|
-
depsArgGroup = parser.add_argument_group('MAS Dependencies Selection')
|
|
221
|
-
depsArgGroup.add_argument(
|
|
222
|
-
'--uninstall-all-deps',
|
|
223
|
-
required=False,
|
|
224
|
-
action='store_true',
|
|
225
|
-
default=False,
|
|
226
|
-
help="Uninstall all MAS-related dependencies from the target cluster",
|
|
227
|
-
)
|
|
228
|
-
|
|
229
|
-
depsArgGroup.add_argument(
|
|
230
|
-
'--uninstall-cert-manager',
|
|
231
|
-
required=False,
|
|
232
|
-
action='store_true',
|
|
233
|
-
default=False,
|
|
234
|
-
help="Uninstall Certificate Manager from the target cluster",
|
|
235
|
-
)
|
|
236
|
-
depsArgGroup.add_argument(
|
|
237
|
-
'--uninstall-common-services',
|
|
238
|
-
required=False,
|
|
239
|
-
action='store_true',
|
|
240
|
-
default=False,
|
|
241
|
-
help="Uninstall IBM Common Services from the target cluster",
|
|
242
|
-
)
|
|
243
|
-
depsArgGroup.add_argument(
|
|
244
|
-
'--uninstall-grafana',
|
|
245
|
-
required=False,
|
|
246
|
-
action='store_true',
|
|
247
|
-
default=False,
|
|
248
|
-
help="Uninstall Grafana from the target cluster",
|
|
249
|
-
)
|
|
250
|
-
depsArgGroup.add_argument(
|
|
251
|
-
'--uninstall-ibm-catalog',
|
|
252
|
-
required=False,
|
|
253
|
-
action='store_true',
|
|
254
|
-
default=False,
|
|
255
|
-
help="Uninstall the IBM Maximo Operator Catalog Source (ibm-operator-catalog) from the target cluster",
|
|
256
|
-
)
|
|
257
|
-
depsArgGroup.add_argument(
|
|
258
|
-
'--uninstall-mongodb',
|
|
259
|
-
required=False,
|
|
260
|
-
action='store_true',
|
|
261
|
-
default=False,
|
|
262
|
-
help="Uninstall MongoDb from the target cluster",
|
|
263
|
-
)
|
|
264
|
-
depsArgGroup.add_argument(
|
|
265
|
-
'--uninstall-sls',
|
|
266
|
-
required=False,
|
|
267
|
-
action='store_true',
|
|
268
|
-
default=False,
|
|
269
|
-
help="Uninstall IBM Suite License Service from the target cluster",
|
|
270
|
-
)
|
|
271
|
-
depsArgGroup.add_argument(
|
|
272
|
-
'--uninstall-uds',
|
|
273
|
-
required=False,
|
|
274
|
-
action='store_true',
|
|
275
|
-
default=False,
|
|
276
|
-
help="Uninstall IBM User Data Services from the target cluster",
|
|
277
|
-
)
|
|
278
|
-
|
|
279
|
-
otherArgGroup = parser.add_argument_group('More')
|
|
280
|
-
otherArgGroup.add_argument(
|
|
281
|
-
'--no-confirm',
|
|
282
|
-
required=False,
|
|
283
|
-
action='store_true',
|
|
284
|
-
default=False,
|
|
285
|
-
help="Launch the upgrade without prompting for confirmation",
|
|
286
|
-
)
|
|
287
|
-
otherArgGroup.add_argument(
|
|
288
|
-
'-h', "--help",
|
|
289
|
-
action='help',
|
|
290
|
-
default=False,
|
|
291
|
-
help="Show this help message and exit",
|
|
292
|
-
)
|
|
293
|
-
|
|
294
|
-
args = parser.parse_args()
|
|
295
|
-
|
|
296
|
-
try:
|
|
297
|
-
app = App()
|
|
298
|
-
app.uninstall(args)
|
|
299
|
-
except KeyboardInterrupt as e:
|
|
300
|
-
pass
|
|
301
|
-
except ApiException as e:
|
|
302
|
-
logger.exception(e, stack_info=True)
|
|
303
|
-
app.fatalError(message=f"An error occured communicating with the target server: {e.reason} ({e.status})")
|
|
304
|
-
except MaxRetryError as e:
|
|
305
|
-
logger.exception(e, stack_info=True)
|
|
306
|
-
app.fatalError(message="Unable to connect to API server", exception=e)
|
|
307
|
-
except TemplateNotFound as e:
|
|
308
|
-
logger.exception(e, stack_info=True)
|
|
309
|
-
app.fatalError("Could not find template", exception=e)
|
|
310
|
-
except KubectlCommandError as e:
|
|
311
|
-
logger.exception(e, stack_info=True)
|
|
312
|
-
app.fatalError("Could not execute kubectl command", exception=e)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# *****************************************************************************
|
|
2
|
+
# Copyright (c) 2024 IBM Corporation and other Contributors.
|
|
3
|
+
#
|
|
4
|
+
# All rights reserved. This program and the accompanying materials
|
|
5
|
+
# are made available under the terms of the Eclipse Public License v1.0
|
|
6
|
+
# which accompanies this distribution, and is available at
|
|
7
|
+
# http://www.eclipse.org/legal/epl-v10.html
|
|
8
|
+
#
|
|
9
|
+
# *****************************************************************************
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
|
|
13
|
+
from .. import __version__ as packageVersion
|
|
14
|
+
from ..cli import getHelpFormatter
|
|
15
|
+
|
|
16
|
+
uninstallArgParser = argparse.ArgumentParser(
|
|
17
|
+
prog='mas uninstall',
|
|
18
|
+
description="\n".join([
|
|
19
|
+
f"IBM Maximo Application Suite Admin CLI v{packageVersion}",
|
|
20
|
+
"Uninstall MAS by configuring and launching the MAS Uninstall Tekton Pipeline.\n",
|
|
21
|
+
"Interactive Mode:",
|
|
22
|
+
"Omitting the --instance-id option will trigger an interactive prompt"
|
|
23
|
+
]),
|
|
24
|
+
epilog="Refer to the online documentation for more information: https://ibm-mas.github.io/cli/",
|
|
25
|
+
formatter_class=getHelpFormatter(),
|
|
26
|
+
add_help=False
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
masArgGroup = uninstallArgParser.add_argument_group('MAS Instance Selection')
|
|
30
|
+
masArgGroup.add_argument(
|
|
31
|
+
'--mas-instance-id',
|
|
32
|
+
required=False,
|
|
33
|
+
help="The MAS instance ID to be uninstalled"
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
depsArgGroup = uninstallArgParser.add_argument_group('MAS Dependencies Selection')
|
|
37
|
+
depsArgGroup.add_argument(
|
|
38
|
+
'--uninstall-all-deps',
|
|
39
|
+
required=False,
|
|
40
|
+
action='store_true',
|
|
41
|
+
default=False,
|
|
42
|
+
help="Uninstall all MAS-related dependencies from the target cluster",
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
depsArgGroup.add_argument(
|
|
46
|
+
'--uninstall-cert-manager',
|
|
47
|
+
required=False,
|
|
48
|
+
action='store_true',
|
|
49
|
+
default=False,
|
|
50
|
+
help="Uninstall Certificate Manager from the target cluster",
|
|
51
|
+
)
|
|
52
|
+
depsArgGroup.add_argument(
|
|
53
|
+
'--uninstall-common-services',
|
|
54
|
+
required=False,
|
|
55
|
+
action='store_true',
|
|
56
|
+
default=False,
|
|
57
|
+
help="Uninstall IBM Common Services from the target cluster",
|
|
58
|
+
)
|
|
59
|
+
depsArgGroup.add_argument(
|
|
60
|
+
'--uninstall-grafana',
|
|
61
|
+
required=False,
|
|
62
|
+
action='store_true',
|
|
63
|
+
default=False,
|
|
64
|
+
help="Uninstall Grafana from the target cluster",
|
|
65
|
+
)
|
|
66
|
+
depsArgGroup.add_argument(
|
|
67
|
+
'--uninstall-ibm-catalog',
|
|
68
|
+
required=False,
|
|
69
|
+
action='store_true',
|
|
70
|
+
default=False,
|
|
71
|
+
help="Uninstall the IBM Maximo Operator Catalog Source (ibm-operator-catalog) from the target cluster",
|
|
72
|
+
)
|
|
73
|
+
depsArgGroup.add_argument(
|
|
74
|
+
'--uninstall-mongodb',
|
|
75
|
+
required=False,
|
|
76
|
+
action='store_true',
|
|
77
|
+
default=False,
|
|
78
|
+
help="Uninstall MongoDb from the target cluster",
|
|
79
|
+
)
|
|
80
|
+
depsArgGroup.add_argument(
|
|
81
|
+
'--uninstall-sls',
|
|
82
|
+
required=False,
|
|
83
|
+
action='store_true',
|
|
84
|
+
default=False,
|
|
85
|
+
help="Uninstall IBM Suite License Service from the target cluster",
|
|
86
|
+
)
|
|
87
|
+
depsArgGroup.add_argument(
|
|
88
|
+
'--uninstall-uds',
|
|
89
|
+
required=False,
|
|
90
|
+
action='store_true',
|
|
91
|
+
default=False,
|
|
92
|
+
help="Uninstall IBM User Data Services from the target cluster",
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
otherArgGroup = uninstallArgParser.add_argument_group('More')
|
|
96
|
+
otherArgGroup.add_argument(
|
|
97
|
+
'--no-confirm',
|
|
98
|
+
required=False,
|
|
99
|
+
action='store_true',
|
|
100
|
+
default=False,
|
|
101
|
+
help="Launch the upgrade without prompting for confirmation",
|
|
102
|
+
)
|
|
103
|
+
otherArgGroup.add_argument(
|
|
104
|
+
'-h', "--help",
|
|
105
|
+
action='help',
|
|
106
|
+
default=False,
|
|
107
|
+
help="Show this help message and exit",
|
|
108
|
+
)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# *****************************************************************************
|
|
2
|
+
# Copyright (c) 2024 IBM Corporation and other Contributors.
|
|
3
|
+
#
|
|
4
|
+
# All rights reserved. This program and the accompanying materials
|
|
5
|
+
# are made available under the terms of the Eclipse Public License v1.0
|
|
6
|
+
# which accompanies this distribution, and is available at
|
|
7
|
+
# http://www.eclipse.org/legal/epl-v10.html
|
|
8
|
+
#
|
|
9
|
+
# *****************************************************************************
|
|
10
|
+
|
|
11
|
+
from ..cli import BaseApp
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env python
|
|
2
2
|
# *****************************************************************************
|
|
3
3
|
# Copyright (c) 2024 IBM Corporation and other Contributors.
|
|
4
4
|
#
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
#
|
|
10
10
|
# *****************************************************************************
|
|
11
11
|
|
|
12
|
-
import argparse
|
|
13
12
|
import sys
|
|
14
13
|
import logging
|
|
15
14
|
import logging.handlers
|
|
@@ -18,21 +17,25 @@ from prompt_toolkit.completion import WordCompleter
|
|
|
18
17
|
|
|
19
18
|
from halo import Halo
|
|
20
19
|
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
20
|
+
from ..cli import BaseApp, getHelpFormatter
|
|
21
|
+
from ..validators import InstanceIDValidator, YesNoValidator
|
|
22
|
+
from .argParser import upgradeArgParser
|
|
23
|
+
|
|
24
24
|
from mas.devops.ocp import createNamespace
|
|
25
25
|
from mas.devops.mas import listMasInstances, verifyMasInstance
|
|
26
26
|
from mas.devops.tekton import installOpenShiftPipelines, updateTektonDefinitions, launchUpgradePipeline
|
|
27
27
|
|
|
28
28
|
logger = logging.getLogger(__name__)
|
|
29
29
|
|
|
30
|
-
class
|
|
31
|
-
def upgrade(self,
|
|
30
|
+
class UpgradeApp(BaseApp):
|
|
31
|
+
def upgrade(self, argv):
|
|
32
32
|
"""
|
|
33
33
|
Upgrade MAS instance
|
|
34
34
|
"""
|
|
35
|
-
|
|
35
|
+
args = upgradeArgParser.parse_args(args=argv)
|
|
36
|
+
instanceId = args.mas_instance_id
|
|
37
|
+
self.noConfirm = args.no_confirm
|
|
38
|
+
self.skipPreCheck = args.skip_pre_check
|
|
36
39
|
|
|
37
40
|
if instanceId is None:
|
|
38
41
|
self.printH1("Set Target OpenShift Cluster")
|
|
@@ -71,7 +74,7 @@ class App(BaseApp):
|
|
|
71
74
|
|
|
72
75
|
self.printH1("Review Settings")
|
|
73
76
|
print_formatted_text(HTML(f"<LightSlateGrey>Instance ID ..................... {instanceId}</LightSlateGrey>"))
|
|
74
|
-
print_formatted_text(HTML(f"<LightSlateGrey>Skip Pre-Upgrade Checks ......... {skipPreCheck}</LightSlateGrey>"))
|
|
77
|
+
print_formatted_text(HTML(f"<LightSlateGrey>Skip Pre-Upgrade Checks ......... {self.skipPreCheck}</LightSlateGrey>"))
|
|
75
78
|
|
|
76
79
|
if not self.noConfirm:
|
|
77
80
|
print()
|
|
@@ -94,65 +97,10 @@ class App(BaseApp):
|
|
|
94
97
|
h.stop_and_persist(symbol=self.successIcon, text=f"Latest Tekton definitions are installed (v{self.version})")
|
|
95
98
|
|
|
96
99
|
with Halo(text='Submitting PipelineRun for {instanceId} upgrade', spinner=self.spinner) as h:
|
|
97
|
-
pipelineURL = launchUpgradePipeline(self.dynamicClient, instanceId, skipPreCheck)
|
|
100
|
+
pipelineURL = launchUpgradePipeline(self.dynamicClient, instanceId, self.skipPreCheck)
|
|
98
101
|
if pipelineURL is not None:
|
|
99
102
|
h.stop_and_persist(symbol=self.successIcon, text=f"PipelineRun for {instanceId} upgrade submitted")
|
|
100
103
|
print_formatted_text(HTML(f"\nView progress:\n <Cyan><u>{pipelineURL}</u></Cyan>\n"))
|
|
101
104
|
else:
|
|
102
105
|
h.stop_and_persist(symbol=self.failureIcon, text=f"Failed to submit PipelineRun for {instanceId} upgrade, see log file for details")
|
|
103
106
|
print()
|
|
104
|
-
|
|
105
|
-
if __name__ == '__main__':
|
|
106
|
-
parser = argparse.ArgumentParser(
|
|
107
|
-
prog='mas upgrade',
|
|
108
|
-
description="\n".join([
|
|
109
|
-
f"IBM Maximo Application Suite Admin CLI v{packageVersion}",
|
|
110
|
-
"Upgrade MAS by configuring and launching the MAS Upgrade Tekton Pipeline.\n",
|
|
111
|
-
"Interactive Mode:",
|
|
112
|
-
"Omitting the --instance-id option will trigger an interactive prompt"
|
|
113
|
-
]),
|
|
114
|
-
epilog="Refer to the online documentation for more information: https://ibm-mas.github.io/cli/",
|
|
115
|
-
formatter_class=getHelpFormatter(),
|
|
116
|
-
add_help=False
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
masArgGroup = parser.add_argument_group('MAS Instance Selection')
|
|
120
|
-
masArgGroup.add_argument(
|
|
121
|
-
'--instance-id',
|
|
122
|
-
required=False,
|
|
123
|
-
help="The MAS instance ID to be upgraded"
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
otherArgGroup = parser.add_argument_group('More')
|
|
127
|
-
otherArgGroup.add_argument(
|
|
128
|
-
'--skip-pre-check',
|
|
129
|
-
required=False,
|
|
130
|
-
action='store_true',
|
|
131
|
-
default=False,
|
|
132
|
-
help="Disable the 'pre-upgrade-check' and 'post-upgrade-verify' tasks in the upgrade pipeline"
|
|
133
|
-
)
|
|
134
|
-
otherArgGroup.add_argument(
|
|
135
|
-
'--no-confirm',
|
|
136
|
-
required=False,
|
|
137
|
-
action='store_true',
|
|
138
|
-
default=False,
|
|
139
|
-
help="Launch the upgrade without prompting for confirmation",
|
|
140
|
-
)
|
|
141
|
-
otherArgGroup.add_argument(
|
|
142
|
-
'-h', "--help",
|
|
143
|
-
action='help',
|
|
144
|
-
default=False,
|
|
145
|
-
help="Show this help message and exit",
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
args = parser.parse_args()
|
|
149
|
-
|
|
150
|
-
try:
|
|
151
|
-
app = App()
|
|
152
|
-
app.upgrade(
|
|
153
|
-
args.instance_id,
|
|
154
|
-
args.skip_pre_check,
|
|
155
|
-
args.no_confirm
|
|
156
|
-
)
|
|
157
|
-
except KeyboardInterrupt as e:
|
|
158
|
-
pass
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# *****************************************************************************
|
|
2
|
+
# Copyright (c) 2024 IBM Corporation and other Contributors.
|
|
3
|
+
#
|
|
4
|
+
# All rights reserved. This program and the accompanying materials
|
|
5
|
+
# are made available under the terms of the Eclipse Public License v1.0
|
|
6
|
+
# which accompanies this distribution, and is available at
|
|
7
|
+
# http://www.eclipse.org/legal/epl-v10.html
|
|
8
|
+
#
|
|
9
|
+
# *****************************************************************************
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
|
|
13
|
+
from .. import __version__ as packageVersion
|
|
14
|
+
from ..cli import getHelpFormatter
|
|
15
|
+
|
|
16
|
+
upgradeArgParser = argparse.ArgumentParser(
|
|
17
|
+
prog='mas upgrade',
|
|
18
|
+
description="\n".join([
|
|
19
|
+
f"IBM Maximo Application Suite Admin CLI v{packageVersion}",
|
|
20
|
+
"Upgrade MAS by configuring and launching the MAS Upgrade Tekton Pipeline.\n",
|
|
21
|
+
"Interactive Mode:",
|
|
22
|
+
"Omitting the --instance-id option will trigger an interactive prompt"
|
|
23
|
+
]),
|
|
24
|
+
epilog="Refer to the online documentation for more information: https://ibm-mas.github.io/cli/",
|
|
25
|
+
formatter_class=getHelpFormatter(),
|
|
26
|
+
add_help=False
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
masArgGroup = upgradeArgParser.add_argument_group('MAS Instance Selection')
|
|
30
|
+
masArgGroup.add_argument(
|
|
31
|
+
'--mas-instance-id',
|
|
32
|
+
required=False,
|
|
33
|
+
help="The MAS instance ID to be upgraded"
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
otherArgGroup = upgradeArgParser.add_argument_group('More')
|
|
37
|
+
otherArgGroup.add_argument(
|
|
38
|
+
'--skip-pre-check',
|
|
39
|
+
required=False,
|
|
40
|
+
action='store_true',
|
|
41
|
+
default=False,
|
|
42
|
+
help="Disable the 'pre-upgrade-check' and 'post-upgrade-verify' tasks in the upgrade pipeline"
|
|
43
|
+
)
|
|
44
|
+
otherArgGroup.add_argument(
|
|
45
|
+
'--no-confirm',
|
|
46
|
+
required=False,
|
|
47
|
+
action='store_true',
|
|
48
|
+
default=False,
|
|
49
|
+
help="Launch the upgrade without prompting for confirmation",
|
|
50
|
+
)
|
|
51
|
+
otherArgGroup.add_argument(
|
|
52
|
+
'-h', "--help",
|
|
53
|
+
action='help',
|
|
54
|
+
default=False,
|
|
55
|
+
help="Show this help message and exit",
|
|
56
|
+
)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!python
|
|
2
|
+
# *****************************************************************************
|
|
3
|
+
# Copyright (c) 2024 IBM Corporation and other Contributors.
|
|
4
|
+
#
|
|
5
|
+
# All rights reserved. This program and the accompanying materials
|
|
6
|
+
# are made available under the terms of the Eclipse Public License v1.0
|
|
7
|
+
# which accompanies this distribution, and is available at
|
|
8
|
+
# http://www.eclipse.org/legal/epl-v10.html
|
|
9
|
+
#
|
|
10
|
+
# *****************************************************************************
|
|
11
|
+
|
|
12
|
+
import logging
|
|
13
|
+
import logging.handlers
|
|
14
|
+
from sys import argv
|
|
15
|
+
|
|
16
|
+
from mas.cli import __version__ as VERSION
|
|
17
|
+
from mas.cli.install.app import InstallApp
|
|
18
|
+
from mas.cli.upgrade.app import UpgradeApp
|
|
19
|
+
from mas.cli.uninstall.app import UninstallApp
|
|
20
|
+
|
|
21
|
+
from prompt_toolkit import HTML, print_formatted_text
|
|
22
|
+
from urllib3.exceptions import MaxRetryError
|
|
23
|
+
from jinja2.exceptions import TemplateNotFound
|
|
24
|
+
from kubeconfig.exceptions import KubectlCommandError
|
|
25
|
+
from kubernetes.client.exceptions import ApiException
|
|
26
|
+
|
|
27
|
+
logger = logging.getLogger(__name__)
|
|
28
|
+
|
|
29
|
+
def usage():
|
|
30
|
+
print_formatted_text(HTML(""))
|
|
31
|
+
|
|
32
|
+
print_formatted_text(HTML(f"\n<u>IBM Maximo Application Suite Admin CLI v{VERSION}</u>"))
|
|
33
|
+
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>"))
|
|
34
|
+
print("")
|
|
35
|
+
print_formatted_text(HTML("Important Notice:\nThis standalone CLI (<ForestGreen>mas-cli</ForestGreen>) is still in beta state, not all functions supported by the <ForestGreen>mas</ForestGreen> function in quay.io/ibmmas/cli are supported yet"))
|
|
36
|
+
print("")
|
|
37
|
+
print_formatted_text(HTML(
|
|
38
|
+
"<b>MAS Management Actions:</b>\n"+
|
|
39
|
+
" - <ForestGreen>mas-cli install</ForestGreen> Install a MAS instance\n"+
|
|
40
|
+
" - <ForestGreen>mas-cli upgrade</ForestGreen> Upgrade a MAS instance\n"+
|
|
41
|
+
" - <ForestGreen>mas-cli uninstall</ForestGreen> Uninstall a MAS instance\n"
|
|
42
|
+
))
|
|
43
|
+
print_formatted_text(HTML("For usage information run <ForestGreen>mas-cli [action] --help</ForestGreen>\n"))
|
|
44
|
+
|
|
45
|
+
if __name__ == '__main__':
|
|
46
|
+
try:
|
|
47
|
+
function = argv[1]
|
|
48
|
+
|
|
49
|
+
if function == "install":
|
|
50
|
+
app = InstallApp()
|
|
51
|
+
app.install(argv[2:])
|
|
52
|
+
elif function == "uninstall":
|
|
53
|
+
app = UninstallApp()
|
|
54
|
+
app.uninstall(argv[2:])
|
|
55
|
+
elif function == "upgrade":
|
|
56
|
+
app = UpgradeApp()
|
|
57
|
+
app.upgrade(argv[2:])
|
|
58
|
+
elif function in ["-h", "--help"]:
|
|
59
|
+
usage()
|
|
60
|
+
exit(0)
|
|
61
|
+
else:
|
|
62
|
+
usage()
|
|
63
|
+
print_formatted_text(HTML(f"<Red>Unknown action: {function}</Red>\n"))
|
|
64
|
+
exit(1)
|
|
65
|
+
|
|
66
|
+
except KeyboardInterrupt as e:
|
|
67
|
+
pass
|
|
68
|
+
except ApiException as e:
|
|
69
|
+
app.fatalError(message=f"An error occured communicating with the target server: {e.reason} ({e.status})")
|
|
70
|
+
except MaxRetryError as e:
|
|
71
|
+
app.fatalError(message="Unable to connect to API server", exception=e)
|
|
72
|
+
except TemplateNotFound as e:
|
|
73
|
+
app.fatalError("Could not find template", exception=e)
|
|
74
|
+
except KubectlCommandError as e:
|
|
75
|
+
app.fatalError("Could not execute kubectl command", exception=e)
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
mas/cli/__init__.py,sha256=
|
|
2
|
-
mas/cli/cli.py,sha256=
|
|
1
|
+
mas/cli/__init__.py,sha256=b06fZAtucW_FysYTbMo5MjyJtfEAyDu0kfhQXt4a_G8,491
|
|
2
|
+
mas/cli/cli.py,sha256=hbeCvE6dKljR3u-C207RPmSGY5H-B4fY3sQrPohABz0,8521
|
|
3
3
|
mas/cli/displayMixins.py,sha256=aIpqoedzKJfaaE8C8FlEvxfWTVahL261rjzPZhdT5q8,5117
|
|
4
4
|
mas/cli/gencfg.py,sha256=57ik5x73gQBFXPl_8h2byXmV_vhCgxfeSDZk4Wg5-Pw,2102
|
|
5
5
|
mas/cli/validators.py,sha256=5QwiDQn2EIqJABJyDbHGGaSvlkE38IeJ98d1Czz682A,4550
|
|
6
|
-
mas/cli/install/__init__.py,sha256=
|
|
7
|
-
mas/cli/install/
|
|
6
|
+
mas/cli/install/__init__.py,sha256=tGH_qJ5ZqcSFpIlObRiye3Y-r4zU8rEplYFjwuHwBTY,494
|
|
7
|
+
mas/cli/install/app.py,sha256=JLoouIIIgvxNal7Yw3BWQmH7BTP358lERYXD3YgoyJ8,45771
|
|
8
|
+
mas/cli/install/argParser.py,sha256=1H3eQ_ng-q8XfMVRgmKDBHh0hSYOr0FPjWIVhNUy7DM,18764
|
|
8
9
|
mas/cli/install/summarizer.py,sha256=e5jPnitbFZJTjJJL0wPlWTSTCoNuBF-9jF08bDfgxy8,17775
|
|
9
10
|
mas/cli/install/settings/__init__.py,sha256=eGdNVHVALUxJlZyGYkBet8LbHvVfa-1UjL_8Zl3d-lY,953
|
|
10
11
|
mas/cli/install/settings/additionalConfigs.py,sha256=YNEISHlFNXnhX1gwFSVG3OBdHsuT9OJ5oZRTC7RqSVI,6800
|
|
@@ -12,7 +13,7 @@ mas/cli/install/settings/db2Settings.py,sha256=mR0XL81Talvwvm1bekw0o9VOwV42QkS0j
|
|
|
12
13
|
mas/cli/install/settings/kafkaSettings.py,sha256=bjAji5OZfSBpttiYHKM5B5Lvva8L8PUzi8QSs6opQcE,6997
|
|
13
14
|
mas/cli/install/settings/manageSettings.py,sha256=3HtyR6-DKiKQDFTWnnxAr5OmkfqKwjI4xnBaAcAjOCI,13229
|
|
14
15
|
mas/cli/install/settings/turbonomicSettings.py,sha256=OC-sn6_Z6MAq0kf33OC3c96gqT8FT4P7A51PenPiCXw,1368
|
|
15
|
-
mas/cli/templates/ibm-mas-tekton.yaml,sha256=
|
|
16
|
+
mas/cli/templates/ibm-mas-tekton.yaml,sha256=RoNmlyxE0hL_hc2lxp__iqBYIxiwtu-UCEi1wnOEKPg,337583
|
|
16
17
|
mas/cli/templates/jdbccfg.yml.j2,sha256=cANbwkUkKEPQp-P3_BB_Llbt94457Ciagah2hOdySIM,1644
|
|
17
18
|
mas/cli/templates/pod-templates/best-effort/ibm-data-dictionary-assetdatadictionary.yml,sha256=8VG_FDFcEjWNaAOZTcS58Pe0tWOXC10SJLloNqzEMC8,757
|
|
18
19
|
mas/cli/templates/pod-templates/best-effort/ibm-mas-bascfg.yml,sha256=rkq8c2pVJoskgict9tCZzCchGSE2MBC-dJ47JyMYm7A,1559
|
|
@@ -85,10 +86,14 @@ mas/cli/templates/pod-templates/guaranteed/ibm-mas-suite.yml,sha256=aB-buCWUAqD0
|
|
|
85
86
|
mas/cli/templates/pod-templates/guaranteed/ibm-mas-visualinspection.yml,sha256=NiXBlXKe3j2RvroEcx3kCSuD92G6WB-jcpNAYGAg3T0,1975
|
|
86
87
|
mas/cli/templates/pod-templates/guaranteed/ibm-sls-licenseservice.yml,sha256=CKt1yim4L3ClloVcQDHiXLD8EMvmKXIltmDxJTxNdDs,546
|
|
87
88
|
mas/cli/templates/pod-templates/saas-essentials/ibm-mas-visualinspection.yml,sha256=4skVNh-8HG55ik0O0QG4jAwiQBRxxrPSRaUwllPYZ_I,1270
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
mas_cli-10.
|
|
89
|
+
mas/cli/uninstall/__init__.py,sha256=tGH_qJ5ZqcSFpIlObRiye3Y-r4zU8rEplYFjwuHwBTY,494
|
|
90
|
+
mas/cli/uninstall/app.py,sha256=Sbv-xqUUdIOerkSw3pz8wo3u7_KmgmwwRFEB8UP3uFU,9934
|
|
91
|
+
mas/cli/uninstall/argParser.py,sha256=VO6_u8Qv_munelgZMxBw9mdJBwF_9j688b6nUxQD2RM,3298
|
|
92
|
+
mas/cli/upgrade/__init__.py,sha256=tGH_qJ5ZqcSFpIlObRiye3Y-r4zU8rEplYFjwuHwBTY,494
|
|
93
|
+
mas/cli/upgrade/app.py,sha256=lxMZYlO_sybzbOuZ4D7R0OCjGqnMg3MF1h2vSVZ1YmE,5328
|
|
94
|
+
mas/cli/upgrade/argParser.py,sha256=jl8SU0mXDMAkpfqXaKE4MPNUmVoD0LSsvMUSJjU1dbQ,1881
|
|
95
|
+
mas_cli-10.1.1.data/scripts/mas-cli,sha256=txiATjPf7E0yCW-2C7VdRA8HSv_SQ52osZkvt_z_QJc,3166
|
|
96
|
+
mas_cli-10.1.1.dist-info/METADATA,sha256=rRbVPda9HnZv9IJYZSS0rGKYWoMYSgReBxboEo_DANE,2076
|
|
97
|
+
mas_cli-10.1.1.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
|
98
|
+
mas_cli-10.1.1.dist-info/top_level.txt,sha256=_Hlsp7pvMvyV14LFg-vk1hULq30j61EILnnxMFIhhc8,4
|
|
99
|
+
mas_cli-10.1.1.dist-info/RECORD,,
|
|
File without changes
|