mas-cli 10.0.5__py3-none-any.whl → 10.1.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 +1 -1
- mas/cli/cli.py +4 -3
- mas/cli/displayMixins.py +3 -2
- mas/cli/install/__init__.py +2 -0
- mas_cli-10.0.5.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 +53 -53
- mas/cli/uninstall/__init__.py +11 -0
- mas/cli/uninstall/app.py +192 -0
- mas/cli/uninstall/argParser.py +108 -0
- mas/cli/upgrade/__init__.py +11 -0
- mas_cli-10.0.5.data/scripts/mas-upgrade → mas/cli/upgrade/app.py +13 -65
- mas/cli/upgrade/argParser.py +56 -0
- mas_cli-10.1.0.data/scripts/mas-cli +75 -0
- {mas_cli-10.0.5.dist-info → mas_cli-10.1.0.dist-info}/METADATA +1 -1
- {mas_cli-10.0.5.dist-info → mas_cli-10.1.0.dist-info}/RECORD +18 -13
- {mas_cli-10.0.5.dist-info → mas_cli-10.1.0.dist-info}/WHEEL +1 -1
- mas_cli-10.0.5.data/scripts/mas-uninstall +0 -284
- {mas_cli-10.0.5.dist-info → mas_cli-10.1.0.dist-info}/top_level.txt +0 -0
mas/cli/uninstall/app.py
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
#!/usr/bin/env 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 halo import Halo
|
|
15
|
+
from prompt_toolkit import print_formatted_text, HTML
|
|
16
|
+
from prompt_toolkit.completion import WordCompleter
|
|
17
|
+
|
|
18
|
+
from openshift.dynamic.exceptions import NotFoundError, ResourceNotFoundError
|
|
19
|
+
|
|
20
|
+
from ..cli import BaseApp
|
|
21
|
+
from ..validators import InstanceIDValidator
|
|
22
|
+
from .argParser import uninstallArgParser
|
|
23
|
+
|
|
24
|
+
from mas.devops.ocp import createNamespace
|
|
25
|
+
from mas.devops.mas import listMasInstances, verifyMasInstance
|
|
26
|
+
from mas.devops.tekton import installOpenShiftPipelines, updateTektonDefinitions, launchUninstallPipeline
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
logger = logging.getLogger(__name__)
|
|
30
|
+
|
|
31
|
+
class UninstallApp(BaseApp):
|
|
32
|
+
def uninstall(self, argv):
|
|
33
|
+
"""
|
|
34
|
+
Uninstall MAS instance
|
|
35
|
+
"""
|
|
36
|
+
args = uninstallArgParser.parse_args(args=argv)
|
|
37
|
+
instanceId = args.mas_instance_id
|
|
38
|
+
self.noConfirm = args.no_confirm
|
|
39
|
+
|
|
40
|
+
if args.uninstall_all_deps:
|
|
41
|
+
uninstallGrafana = True
|
|
42
|
+
uninstallIBMCatalog = True
|
|
43
|
+
uninstallCommonServices = True
|
|
44
|
+
uninstallCertManager = True
|
|
45
|
+
uninstallUDS = True
|
|
46
|
+
uninstallMongoDb = True
|
|
47
|
+
uninstallSLS = True
|
|
48
|
+
else:
|
|
49
|
+
uninstallGrafana = args.uninstall_grafana
|
|
50
|
+
uninstallIBMCatalog = args.uninstall_ibm_catalog
|
|
51
|
+
uninstallCommonServices = args.uninstall_common_services
|
|
52
|
+
uninstallCertManager = args.uninstall_cert_manager
|
|
53
|
+
uninstallUDS = args.uninstall_uds
|
|
54
|
+
uninstallMongoDb = args.uninstall_mongodb
|
|
55
|
+
uninstallSLS = args.uninstall_sls
|
|
56
|
+
|
|
57
|
+
if instanceId is None:
|
|
58
|
+
self.printH1("Set Target OpenShift Cluster")
|
|
59
|
+
# Connect to the target cluster
|
|
60
|
+
self.connect()
|
|
61
|
+
else:
|
|
62
|
+
logger.debug("MAS instance ID is set, so we assume already connected to the desired OCP")
|
|
63
|
+
|
|
64
|
+
if self.dynamicClient is None:
|
|
65
|
+
self.fatalError("The Kubernetes dynamic Client is not available. See log file for details")
|
|
66
|
+
|
|
67
|
+
if instanceId is None:
|
|
68
|
+
# Interactive mode
|
|
69
|
+
self.printH1("Instance Selection")
|
|
70
|
+
self.printDescription(["Select a MAS instance to uninstall from the list below:"])
|
|
71
|
+
|
|
72
|
+
suiteOptions = []
|
|
73
|
+
try:
|
|
74
|
+
suites = listMasInstances(self.dynamicClient)
|
|
75
|
+
for suite in suites:
|
|
76
|
+
self.printDescription([f"- <u>{suite['metadata']['name']}</u> v{suite['status']['versions']['reconciled']}"])
|
|
77
|
+
suiteOptions.append(suite['metadata']['name'])
|
|
78
|
+
except ResourceNotFoundError as e:
|
|
79
|
+
self.fatalError("No MAS instances were detected on the cluster (Suite.core.mas.ibm.com/v1 API is not available). See log file for details")
|
|
80
|
+
|
|
81
|
+
if len(suiteOptions) == 0:
|
|
82
|
+
self.fatalError("No MAS instances were detected on the cluster (No instances of Suite.core.mas.ibm.com/v1 found). See log file for details")
|
|
83
|
+
|
|
84
|
+
suiteCompleter = WordCompleter(suiteOptions)
|
|
85
|
+
print()
|
|
86
|
+
instanceId = self.promptForString("MAS instance ID", completer=suiteCompleter, validator=InstanceIDValidator())
|
|
87
|
+
|
|
88
|
+
self.printH1("Uninstall MAS Dependencies")
|
|
89
|
+
self.printDescription([
|
|
90
|
+
"If you choose to uninstall Certificate Manager, all other options will be automatically set to uninstall",
|
|
91
|
+
"Other workload on the cluster may be dependant on the Certificate Manager installation, so proceed with caution when choosing 'Yes'"
|
|
92
|
+
])
|
|
93
|
+
uninstallCertManager = self.yesOrNo("Uninstall Certificate Manager")
|
|
94
|
+
if uninstallCertManager:
|
|
95
|
+
# If you choose to uninstall Cert-Manager, everything will be uninstalled
|
|
96
|
+
uninstallGrafana = True
|
|
97
|
+
uninstallIBMCatalog = True
|
|
98
|
+
uninstallCommonServices = True
|
|
99
|
+
uninstallUDS = True
|
|
100
|
+
uninstallMongoDb = True
|
|
101
|
+
uninstallSLS = True
|
|
102
|
+
else:
|
|
103
|
+
self.printDescription(["If you choose to uninstall MongoDb, IBM Suite License Service will be automatically set to uninstall as well"])
|
|
104
|
+
uninstallMongoDb = self.yesOrNo("Uninstall MongoDb")
|
|
105
|
+
if uninstallMongoDb:
|
|
106
|
+
# If you are removing MongoDb then SLS needs to be uninstalled too
|
|
107
|
+
uninstallSLS = True
|
|
108
|
+
else:
|
|
109
|
+
uninstallSLS = self.yesOrNo("Uninstall IBM Suite Licensing Service")
|
|
110
|
+
|
|
111
|
+
uninstallGrafana = self.yesOrNo("Uninstall Grafana")
|
|
112
|
+
self.printDescription(["If you choose to uninstall the IBM Operator Catalog, IBM Common Services, IBM User Data Services, & IBM Suite License Service will be automatically set to uninstall as well"])
|
|
113
|
+
uninstallIBMCatalog = self.yesOrNo("Uninstall IBM operator Catalog")
|
|
114
|
+
if uninstallIBMCatalog:
|
|
115
|
+
# If you choose to uninstall IBM Operator Catalog, everything from the catalog will be uninstalled
|
|
116
|
+
uninstallCommonServices = True
|
|
117
|
+
uninstallUDS = True
|
|
118
|
+
uninstallSLS = True
|
|
119
|
+
else:
|
|
120
|
+
uninstallCommonServices = self.yesOrNo("Uninstall IBM Common Services")
|
|
121
|
+
uninstallUDS = self.yesOrNo("Uninstall IBM User Data Services")
|
|
122
|
+
|
|
123
|
+
else:
|
|
124
|
+
# Non-interactive mode
|
|
125
|
+
if not verifyMasInstance(self.dynamicClient, instanceId):
|
|
126
|
+
self.fatalError(f"MAS Instance {instanceId} not found on this cluster</Red>")
|
|
127
|
+
|
|
128
|
+
# Default to Red Hat Cert-Manager, and check if IBM cert-manager is installed
|
|
129
|
+
certManagerProvider="redhat"
|
|
130
|
+
try:
|
|
131
|
+
# Check if 'ibm-common-services' namespace exist, this will throw NotFoundError exception when not found.
|
|
132
|
+
namespaceAPI = self.dynamicClient.resources.get(api_version="v1", kind="Namespace")
|
|
133
|
+
namespaceAPI.get(name="ibm-common-services")
|
|
134
|
+
|
|
135
|
+
podsAPI = self.dynamicClient.resources.get(api_version="v1", kind="Pod")
|
|
136
|
+
podsList = podsAPI.get(namespace="ibm-common-services")
|
|
137
|
+
for pod in podsList.items:
|
|
138
|
+
if pod is not None and "cert-manager-cainjector" in pod.metadata.name:
|
|
139
|
+
certManagerProvider = "ibm"
|
|
140
|
+
except NotFoundError:
|
|
141
|
+
print()
|
|
142
|
+
# ibm cert manager not found, proceed with default redhat.
|
|
143
|
+
|
|
144
|
+
self.printH1("Review Settings")
|
|
145
|
+
self.printSummary("Instance ID", instanceId)
|
|
146
|
+
self.printSummary("Uninstall Cert-Manager", f"{uninstallCertManager} ({certManagerProvider})")
|
|
147
|
+
self.printSummary("Uninstall Grafana", uninstallGrafana)
|
|
148
|
+
self.printSummary("Uninstall IBM Operator Catalog", uninstallIBMCatalog)
|
|
149
|
+
self.printSummary("Uninstall IBM Common Services", uninstallCommonServices)
|
|
150
|
+
self.printSummary("Uninstall UDS", uninstallUDS)
|
|
151
|
+
self.printSummary("Uninstall MongoDb", uninstallMongoDb)
|
|
152
|
+
self.printSummary("Uninstall SLS", uninstallSLS)
|
|
153
|
+
|
|
154
|
+
if not self.noConfirm:
|
|
155
|
+
print()
|
|
156
|
+
continueWithUninstall = self.yesOrNo("Proceed with these settings")
|
|
157
|
+
|
|
158
|
+
if self.noConfirm or continueWithUninstall:
|
|
159
|
+
self.printH1("Launch uninstall")
|
|
160
|
+
pipelinesNamespace = f"mas-{instanceId}-pipelines"
|
|
161
|
+
|
|
162
|
+
with Halo(text='Validating OpenShift Pipelines installation', spinner=self.spinner) as h:
|
|
163
|
+
installOpenShiftPipelines(self.dynamicClient)
|
|
164
|
+
h.stop_and_persist(symbol=self.successIcon, text=f"OpenShift Pipelines Operator is installed and ready to use")
|
|
165
|
+
|
|
166
|
+
with Halo(text=f'Preparing namespace ({pipelinesNamespace})', spinner=self.spinner) as h:
|
|
167
|
+
createNamespace(self.dynamicClient, pipelinesNamespace)
|
|
168
|
+
h.stop_and_persist(symbol=self.successIcon, text=f"Namespace is ready ({pipelinesNamespace})")
|
|
169
|
+
|
|
170
|
+
with Halo(text=f'Installing latest Tekton definitions (v{self.version})', spinner=self.spinner) as h:
|
|
171
|
+
updateTektonDefinitions(pipelinesNamespace, self.tektonDefsPath)
|
|
172
|
+
h.stop_and_persist(symbol=self.successIcon, text=f"Latest Tekton definitions are installed (v{self.version})")
|
|
173
|
+
|
|
174
|
+
with Halo(text=f'Submitting PipelineRun for {instanceId} uninstall', spinner=self.spinner) as h:
|
|
175
|
+
pipelineURL = launchUninstallPipeline(
|
|
176
|
+
dynClient = self.dynamicClient,
|
|
177
|
+
instanceId = instanceId,
|
|
178
|
+
certManagerProvider = "redhat",
|
|
179
|
+
uninstallCertManager = uninstallCertManager,
|
|
180
|
+
uninstallGrafana = uninstallGrafana,
|
|
181
|
+
uninstallCatalog = uninstallCommonServices,
|
|
182
|
+
uninstallCommonServices = uninstallCommonServices,
|
|
183
|
+
uninstallUDS = uninstallUDS,
|
|
184
|
+
uninstallMongoDb = uninstallMongoDb,
|
|
185
|
+
uninstallSLS = uninstallSLS
|
|
186
|
+
)
|
|
187
|
+
if pipelineURL is not None:
|
|
188
|
+
h.stop_and_persist(symbol=self.successIcon, text=f"PipelineRun for {instanceId} uninstall submitted")
|
|
189
|
+
print_formatted_text(HTML(f"\nView progress:\n <Cyan><u>{pipelineURL}</u></Cyan>\n"))
|
|
190
|
+
else:
|
|
191
|
+
h.stop_and_persist(symbol=self.failureIcon, text=f"Failed to submit PipelineRun for {instanceId} uninstall, see log file for details")
|
|
192
|
+
print()
|
|
@@ -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=
|
|
3
|
-
mas/cli/displayMixins.py,sha256=
|
|
1
|
+
mas/cli/__init__.py,sha256=p_AG07T6oWD53gJ4uygQIEx5-nA7w2ZVRlaTArVsMaI,491
|
|
2
|
+
mas/cli/cli.py,sha256=hbeCvE6dKljR3u-C207RPmSGY5H-B4fY3sQrPohABz0,8521
|
|
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=5j4dHu0k_DRfM2UzJfKFhDnTAGJYObEGbXXIHUI1D3Q,335567
|
|
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.0.
|
|
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.0.data/scripts/mas-cli,sha256=txiATjPf7E0yCW-2C7VdRA8HSv_SQ52osZkvt_z_QJc,3166
|
|
96
|
+
mas_cli-10.1.0.dist-info/METADATA,sha256=4Y30bVkxNOeY7-95uaa454mGQXnWqCM033AkOWI_wKE,2076
|
|
97
|
+
mas_cli-10.1.0.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
|
98
|
+
mas_cli-10.1.0.dist-info/top_level.txt,sha256=_Hlsp7pvMvyV14LFg-vk1hULq30j61EILnnxMFIhhc8,4
|
|
99
|
+
mas_cli-10.1.0.dist-info/RECORD,,
|