mas-cli 10.1.0__py3-none-any.whl → 10.2.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.

@@ -120,7 +120,69 @@ class AdditionalConfigsMixin():
120
120
  logger.debug(podTemplatesSecret)
121
121
  self.podTemplatesSecret = podTemplatesSecret
122
122
 
123
- def addFilesToSecret(self, secretDict: dict, configPath: str, extension: str) -> dict:
123
+ def manualCertificates(self) -> None:
124
+
125
+ if self.getParam("mas_manual_cert_mgmt"):
126
+ certsSecret = {
127
+ "apiVersion": "v1",
128
+ "kind": "Secret",
129
+ "type": "Opaque",
130
+ "metadata": {
131
+ "name": "pipeline-certificates"
132
+ }
133
+ }
134
+
135
+ extensions = ["key", "crt"]
136
+
137
+ apps = {
138
+ "mas_app_channel_assist": {
139
+ "dir": self.getParam("mas_manual_cert_dir") + "/assist/",
140
+ "keyPrefix": "assist."
141
+ },
142
+ "mas_app_channel_manage": {
143
+ "dir": self.getParam("mas_manual_cert_dir") + "/manage/",
144
+ "keyPrefix": "manage."
145
+ },
146
+ "mas_app_channel_iot": {
147
+ "dir": self.getParam("mas_manual_cert_dir") + "/iot/",
148
+ "keyPrefix": "iot."
149
+ },
150
+ "mas_app_channel_monitor": {
151
+ "dir": self.getParam("mas_manual_cert_dir") + "/monitor/",
152
+ "keyPrefix": "monitor."
153
+ },
154
+ "mas_app_channel_predict": {
155
+ "dir": self.getParam("mas_manual_cert_dir") + "/predict/",
156
+ "keyPrefix": "predict."
157
+ },
158
+ "mas_app_channel_visualinspection": {
159
+ "dir": self.getParam("mas_manual_cert_dir") + "/visualinspection/",
160
+ "keyPrefix": "visualinspection."
161
+ },
162
+ "mas_app_channel_optimizer": {
163
+ "dir": self.getParam("mas_manual_cert_dir") + "/optimizer/",
164
+ "keyPrefix": "optimizer."
165
+ }
166
+ }
167
+
168
+ for file in ["ca.crt", "tls.crt", "tls.key"]:
169
+ if file not in map(path.basename, glob(f'{self.getParam("mas_manual_cert_dir")}/core/*')):
170
+ self.fatalError(f'{file} is not present in {self.getParam("mas_manual_cert_dir")}/core/')
171
+ for ext in extensions:
172
+ certsSecret = self.addFilesToSecret(certsSecret, self.getParam("mas_manual_cert_dir")+'/core/', ext, "core.")
173
+
174
+ for app in apps:
175
+ if self.getParam(app) != "":
176
+ for file in ["ca.crt", "tls.crt", "tls.key"]:
177
+ if file not in map(path.basename, glob(f'{apps[app]["dir"]}/*')):
178
+ self.fatalError(f'{file} is not present in {apps[app]["dir"]}')
179
+ for ext in extensions:
180
+ certsSecret = self.addFilesToSecret(certsSecret, apps[app]["dir"], ext, apps[app]["keyPrefix"])
181
+
182
+ self.certsSecret = certsSecret
183
+
184
+
185
+ def addFilesToSecret(self, secretDict: dict, configPath: str, extension: str, keyPrefix: str='') -> dict:
124
186
  """
125
187
  Add file (or files) to pipeline-additional-configs
126
188
  """
@@ -143,6 +205,6 @@ class AdditionalConfigsMixin():
143
205
  # Add/update an entry to the secret data
144
206
  if "data" not in secretDict:
145
207
  secretDict["data"] = {}
146
- secretDict["data"][fileName] = b64encode(data.encode('ascii')).decode("ascii")
208
+ secretDict["data"][keyPrefix + fileName] = b64encode(data.encode('ascii')).decode("ascii")
147
209
 
148
- return secretDict
210
+ return secretDict
@@ -72,6 +72,13 @@ class InstallSummarizerMixin():
72
72
  pass
73
73
  elif self.params['dns_provider'] == "":
74
74
  pass
75
+
76
+ if self.params["mas_manual_cert_mgmt"]:
77
+ print()
78
+ self.printParamSummary("Manual Certificates", "mas_manual_cert_dir")
79
+ else:
80
+ print()
81
+ self.printSummary("Manual Certificates", "Not Configured")
75
82
 
76
83
  print()
77
84
  self.printParamSummary("Catalog Version", "mas_catalog_version")