pyegeria 0.7.45.1__py3-none-any.whl → 0.8.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.
- examples/widgets/cat/list_cert_types.py +61 -43
- examples/widgets/cat/list_projects.py +1 -1
- examples/widgets/my/my_profile_actions.py +51 -32
- examples/widgets/ops/engine_actions.py +35 -23
- examples/widgets/ops/integration_daemon_actions.py +51 -32
- examples/widgets/tech/get_element_info.py +63 -38
- examples/widgets/tech/get_guid_info.py +50 -27
- examples/widgets/tech/list_asset_types.py +33 -23
- examples/widgets/tech/list_elements.py +44 -34
- examples/widgets/tech/list_elements_x.py +69 -49
- examples/widgets/tech/list_registered_services.py +44 -24
- examples/widgets/tech/list_related_specification.py +70 -45
- examples/widgets/tech/list_relationship_types.py +50 -31
- examples/widgets/tech/list_valid_metadata_values.py +57 -28
- examples/widgets/tech/x_list_related_elements.py +54 -34
- pyegeria/Xloaded_resources_omvs.py +43 -41
- pyegeria/__init__.py +5 -1
- pyegeria/_client.py +142 -102
- pyegeria/_deprecated_gov_engine.py +218 -167
- pyegeria/action_author_omvs.py +107 -88
- pyegeria/asset_catalog_omvs.py +467 -395
- pyegeria/automated_curation_omvs.py +2 -2
- pyegeria/classification_manager_omvs.py +3 -9
- pyegeria/collection_manager_omvs.py +1957 -1519
- pyegeria/core_omag_server_config.py +310 -192
- pyegeria/egeria_cat_client.py +88 -0
- pyegeria/egeria_config_client.py +37 -0
- pyegeria/egeria_my_client.py +47 -0
- pyegeria/egeria_ops_client.py +67 -0
- pyegeria/egeria_tech_client.py +77 -0
- pyegeria/feedback_manager_omvs.py +633 -631
- pyegeria/full_omag_server_config.py +330 -158
- pyegeria/glossary_browser_omvs.py +927 -474
- pyegeria/glossary_manager_omvs.py +1033 -543
- pyegeria/my_profile_omvs.py +714 -574
- pyegeria/platform_services.py +228 -176
- pyegeria/project_manager_omvs.py +1158 -903
- pyegeria/registered_info.py +76 -74
- pyegeria/runtime_manager_omvs.py +749 -670
- pyegeria/server_operations.py +123 -85
- pyegeria/valid_metadata_omvs.py +268 -168
- {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/METADATA +1 -1
- {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/RECORD +46 -42
- pyegeria/tech_guids_31-08-2024 14:33.py +0 -79
- {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/LICENSE +0 -0
- {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/WHEEL +0 -0
- {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/entry_points.txt +0 -0
pyegeria/platform_services.py
CHANGED
@@ -18,13 +18,11 @@ from pyegeria._exceptions import (
|
|
18
18
|
OMAGCommonErrorCode,
|
19
19
|
InvalidParameterException,
|
20
20
|
UserNotAuthorizedException,
|
21
|
-
PropertyServerException,
|
21
|
+
PropertyServerException,
|
22
|
+
print_exception_response,
|
22
23
|
)
|
23
24
|
|
24
25
|
|
25
|
-
# import requests
|
26
|
-
|
27
|
-
|
28
26
|
class Platform(Client):
|
29
27
|
"""
|
30
28
|
Client to operate Egeria Platforms - inherits from Server Ops
|
@@ -45,24 +43,22 @@ class Platform(Client):
|
|
45
43
|
admin_command_root: str
|
46
44
|
|
47
45
|
def __init__(
|
48
|
-
|
49
|
-
server_name: str,
|
50
|
-
platform_url: str,
|
51
|
-
user_id: str,
|
52
|
-
user_pwd: str = None,
|
53
|
-
verify_flag: bool = False,
|
54
|
-
|
46
|
+
self, server_name: str, platform_url: str, user_id: str, user_pwd: str = None
|
55
47
|
):
|
56
|
-
validate_user_id(
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
48
|
+
validate_user_id(
|
49
|
+
user_id
|
50
|
+
) # add this check since we aren't using bearer tokens in this class
|
51
|
+
|
52
|
+
Client.__init__(self, server_name, platform_url, user_id, user_pwd)
|
53
|
+
self.admin_command_root = (
|
54
|
+
self.platform_url
|
55
|
+
+ "/open-metadata/platform-services/users/"
|
56
|
+
+ user_id
|
57
|
+
+ "/server-platform"
|
58
|
+
)
|
63
59
|
|
64
60
|
def get_platform_origin(self) -> str:
|
65
|
-
"""
|
61
|
+
"""Get the version and origin of the platform software
|
66
62
|
|
67
63
|
/open-metadata/platform-services/users/{userId}/server-platform/origin
|
68
64
|
Response from this call is a string not JSON..
|
@@ -97,15 +93,22 @@ class Platform(Client):
|
|
97
93
|
try:
|
98
94
|
response = local_session.get(url)
|
99
95
|
if response.status_code != 200:
|
100
|
-
msg =
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
96
|
+
msg = (
|
97
|
+
OMAGCommonErrorCode.CLIENT_SIDE_REST_API_ERROR.value[
|
98
|
+
"message_template"
|
99
|
+
].format(
|
100
|
+
response.status_code,
|
101
|
+
caller_method,
|
102
|
+
class_name,
|
103
|
+
url,
|
104
|
+
OMAGCommonErrorCode.CLIENT_SIDE_REST_API_ERROR.value[
|
105
|
+
"message_id"
|
106
|
+
],
|
107
|
+
)
|
108
|
+
+ "==>System reports:'"
|
109
|
+
+ response.reason_phrase
|
110
|
+
+ "'"
|
111
|
+
)
|
109
112
|
exc_msg = json.dumps(
|
110
113
|
{
|
111
114
|
"class": "VoidResponse",
|
@@ -141,20 +144,25 @@ class Platform(Client):
|
|
141
144
|
raise
|
142
145
|
|
143
146
|
except (
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
147
|
+
httpx.NetworkError,
|
148
|
+
httpx.ProtocolError,
|
149
|
+
httpx.HTTPStatusError,
|
150
|
+
httpx.TimeoutException,
|
148
151
|
) as e:
|
149
|
-
msg =
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
152
|
+
msg = (
|
153
|
+
OMAGCommonErrorCode.CLIENT_SIDE_REST_API_ERROR.value[
|
154
|
+
"message_template"
|
155
|
+
].format(
|
156
|
+
e.args[0],
|
157
|
+
caller_method,
|
158
|
+
class_name,
|
159
|
+
url,
|
160
|
+
OMAGCommonErrorCode.CLIENT_SIDE_REST_API_ERROR.value["message_id"],
|
161
|
+
)
|
162
|
+
+ "==>System reports:'"
|
163
|
+
+ response.reason_phrase
|
164
|
+
+ "'"
|
165
|
+
)
|
158
166
|
exc_msg = json.dumps(
|
159
167
|
{
|
160
168
|
"class": "VoidResponse",
|
@@ -185,8 +193,10 @@ class Platform(Client):
|
|
185
193
|
)
|
186
194
|
raise InvalidParameterException(exc_msg)
|
187
195
|
|
188
|
-
async def _async_activate_server_stored_config(
|
189
|
-
|
196
|
+
async def _async_activate_server_stored_config(
|
197
|
+
self, server: str = None, timeout: int = 60
|
198
|
+
) -> None:
|
199
|
+
"""Activate a server on the associated platform with the stored configuration. Async version.
|
190
200
|
|
191
201
|
Parameters
|
192
202
|
----------
|
@@ -212,8 +222,10 @@ class Platform(Client):
|
|
212
222
|
|
213
223
|
await self._async_make_request("POST", url, time_out=timeout)
|
214
224
|
|
215
|
-
def activate_server_stored_config(
|
216
|
-
|
225
|
+
def activate_server_stored_config(
|
226
|
+
self, server: str = None, timeout: int = 90
|
227
|
+
) -> None:
|
228
|
+
"""Activate a server on the associated platform with the stored configuration.
|
217
229
|
|
218
230
|
Parameters
|
219
231
|
----------
|
@@ -234,12 +246,15 @@ class Platform(Client):
|
|
234
246
|
The principle specified by the user_id does not have authorization for the requested action
|
235
247
|
"""
|
236
248
|
loop = asyncio.get_event_loop()
|
237
|
-
response = loop.run_until_complete(
|
249
|
+
response = loop.run_until_complete(
|
250
|
+
self._async_activate_server_stored_config(server, timeout)
|
251
|
+
)
|
238
252
|
return response
|
239
253
|
|
240
|
-
async def _async_activate_server_supplied_config(
|
241
|
-
|
242
|
-
|
254
|
+
async def _async_activate_server_supplied_config(
|
255
|
+
self, config_body: dict, server: str = None, timeout: int = 60
|
256
|
+
) -> None:
|
257
|
+
"""Activate a server on the associated platform with the stored configuration. Async version.
|
243
258
|
|
244
259
|
Parameters
|
245
260
|
----------
|
@@ -269,55 +284,61 @@ class Platform(Client):
|
|
269
284
|
url = self.admin_command_root + "/servers/" + server + "/instance/configuration"
|
270
285
|
await self._async_make_request("POST", url, config_body, time_out=timeout)
|
271
286
|
|
272
|
-
def activate_server_supplied_config(
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
287
|
+
def activate_server_supplied_config(
|
288
|
+
self, config_body: dict, server: str = None, timeout: int = 60
|
289
|
+
) -> None:
|
290
|
+
"""Activate a server on the associated platform with the stored configuration.
|
291
|
+
|
292
|
+
Parameters
|
293
|
+
----------
|
294
|
+
config_body: str
|
295
|
+
Server configuration to use for activation.
|
296
|
+
server : str, optional
|
297
|
+
Use the server if specified. If None, use the default server associated with the Platform object.
|
298
|
+
timeout: int, optional
|
299
|
+
A request timeout in seconds
|
300
|
+
|
301
|
+
Returns
|
302
|
+
-------
|
303
|
+
None
|
304
|
+
|
305
|
+
Raises
|
306
|
+
------
|
307
|
+
InvalidParameterException
|
308
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
309
|
+
PropertyServerException
|
310
|
+
Raised by the server when an issue arises in processing a valid request
|
311
|
+
NotAuthorizedException
|
312
|
+
The principle specified by the user_id does not have authorization for the requested action
|
313
|
+
"""
|
297
314
|
loop = asyncio.get_event_loop()
|
298
|
-
loop.run_until_complete(
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
315
|
+
loop.run_until_complete(
|
316
|
+
self._async_activate_server_supplied_config(config_body, server, timeout)
|
317
|
+
)
|
318
|
+
|
319
|
+
async def _async_get_active_server_instance_status(
|
320
|
+
self, server: str = None
|
321
|
+
) -> dict | str:
|
322
|
+
"""Get the current status of all services running in the specified active server. Async version.
|
323
|
+
|
324
|
+
Parameters
|
325
|
+
----------
|
326
|
+
server : str, optional
|
327
|
+
The current active server we want to get status from.
|
328
|
+
If None, use the default server associated with the Platform object.
|
329
|
+
Returns
|
330
|
+
-------
|
331
|
+
List of server status.
|
332
|
+
|
333
|
+
Raises
|
334
|
+
------
|
335
|
+
InvalidParameterException
|
336
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
337
|
+
PropertyServerException
|
338
|
+
Raised by the server when an issue arises in processing a valid request
|
339
|
+
NotAuthorizedException
|
340
|
+
The principle specified by the user_id does not have authorization for the requested action
|
341
|
+
"""
|
321
342
|
if server is None:
|
322
343
|
server = self.server_name
|
323
344
|
|
@@ -326,32 +347,34 @@ class Platform(Client):
|
|
326
347
|
return response.json().get("serverStatus", "No status found")
|
327
348
|
|
328
349
|
def get_active_server_instance_status(self, server: str = None) -> dict | str:
|
329
|
-
"""
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
350
|
+
"""Get the current status of all services running in the specified active server.
|
351
|
+
|
352
|
+
Parameters
|
353
|
+
----------
|
354
|
+
server : str, optional
|
355
|
+
The current active server we want to get status from.
|
356
|
+
If None, use the default server associated with the Platform object.
|
357
|
+
Returns
|
358
|
+
-------
|
359
|
+
List of server status.
|
360
|
+
|
361
|
+
Raises
|
362
|
+
------
|
363
|
+
InvalidParameterException
|
364
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
365
|
+
PropertyServerException
|
366
|
+
Raised by the server when an issue arises in processing a valid request
|
367
|
+
NotAuthorizedException
|
368
|
+
The principle specified by the user_id does not have authorization for the requested action
|
369
|
+
"""
|
349
370
|
loop = asyncio.get_event_loop()
|
350
|
-
response = loop.run_until_complete(
|
371
|
+
response = loop.run_until_complete(
|
372
|
+
self._async_get_active_server_instance_status(server)
|
373
|
+
)
|
351
374
|
return response
|
352
375
|
|
353
376
|
async def _async_get_known_servers(self) -> list[str] | str:
|
354
|
-
"""
|
377
|
+
"""List all known servers on the associated platform. Async version.
|
355
378
|
|
356
379
|
Parameters
|
357
380
|
----------
|
@@ -374,7 +397,7 @@ class Platform(Client):
|
|
374
397
|
return response.json().get("serverList", "No servers found")
|
375
398
|
|
376
399
|
def get_known_servers(self) -> list[str] | str:
|
377
|
-
"""
|
400
|
+
"""List all known servers on the associated platform.
|
378
401
|
|
379
402
|
Parameters
|
380
403
|
----------
|
@@ -397,7 +420,7 @@ class Platform(Client):
|
|
397
420
|
return response
|
398
421
|
|
399
422
|
async def _async_is_server_known(self, server: str = None) -> bool:
|
400
|
-
"""
|
423
|
+
"""Is the server known? Async version.
|
401
424
|
|
402
425
|
Parameters
|
403
426
|
----------
|
@@ -424,31 +447,31 @@ class Platform(Client):
|
|
424
447
|
return response.json().get("flag")
|
425
448
|
|
426
449
|
def is_server_known(self, server: str = None) -> bool:
|
427
|
-
"""
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
450
|
+
"""Is the server known?
|
451
|
+
|
452
|
+
Parameters
|
453
|
+
----------
|
454
|
+
server : Use the server if specified. If None, use the default server associated with the Platform object.
|
455
|
+
|
456
|
+
Returns
|
457
|
+
-------
|
458
|
+
bool: Returns True if the server is known, False otherwise.
|
459
|
+
|
460
|
+
Raises
|
461
|
+
------
|
462
|
+
InvalidParameterException
|
463
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
464
|
+
PropertyServerException
|
465
|
+
Raised by the server when an issue arises in processing a valid request
|
466
|
+
NotAuthorizedException
|
467
|
+
The principle specified by the user_id does not have authorization for the requested action
|
468
|
+
"""
|
446
469
|
loop = asyncio.get_event_loop()
|
447
470
|
response = loop.run_until_complete(self._async_is_server_known(server))
|
448
471
|
return response
|
449
472
|
|
450
473
|
async def _async_is_server_configured(self, server: str = None) -> bool:
|
451
|
-
"""
|
474
|
+
"""is a server known and configured? Async version.
|
452
475
|
Parameters
|
453
476
|
----------
|
454
477
|
server : str, optional
|
@@ -466,13 +489,13 @@ class Platform(Client):
|
|
466
489
|
|
467
490
|
response = await self._async_make_request("GET", url)
|
468
491
|
config = response.json().get("omagserverConfig", "No configuration found")
|
469
|
-
if
|
492
|
+
if "auditTrail" in config:
|
470
493
|
return True
|
471
494
|
else:
|
472
495
|
return False
|
473
496
|
|
474
497
|
def is_server_configured(self, server: str = None) -> bool:
|
475
|
-
"""
|
498
|
+
"""is a server known and configured?
|
476
499
|
Parameters
|
477
500
|
----------
|
478
501
|
server : str, optional
|
@@ -489,7 +512,7 @@ class Platform(Client):
|
|
489
512
|
return response
|
490
513
|
|
491
514
|
async def _async_get_active_configuration(self, server: str = None) -> dict | str:
|
492
|
-
"""
|
515
|
+
"""Return the configuration of the server if it is running. Return invalidParameter Exception if not running.
|
493
516
|
Async version.
|
494
517
|
|
495
518
|
Parameters
|
@@ -514,7 +537,7 @@ class Platform(Client):
|
|
514
537
|
return response.json().get("omagserverConfig", "No active configuration found")
|
515
538
|
|
516
539
|
def get_active_configuration(self, server: str = None) -> dict | str:
|
517
|
-
"""
|
540
|
+
"""Return the configuration of the server if it is running. Return invalidParameter Exception if not running.
|
518
541
|
|
519
542
|
Parameters
|
520
543
|
----------
|
@@ -530,7 +553,7 @@ class Platform(Client):
|
|
530
553
|
return response
|
531
554
|
|
532
555
|
async def _async_check_server_active(self, server: str = None):
|
533
|
-
"""
|
556
|
+
"""Get status of the server specified. Async version.
|
534
557
|
|
535
558
|
Parameters
|
536
559
|
----------
|
@@ -550,7 +573,7 @@ class Platform(Client):
|
|
550
573
|
return response.json().get("active")
|
551
574
|
|
552
575
|
def check_server_active(self, server: str = None):
|
553
|
-
"""
|
576
|
+
"""Get status of the server specified.
|
554
577
|
|
555
578
|
Parameters
|
556
579
|
----------
|
@@ -588,7 +611,7 @@ class Platform(Client):
|
|
588
611
|
url = self.admin_command_root + "/servers/active"
|
589
612
|
|
590
613
|
response = await self._async_make_request("GET", url)
|
591
|
-
return response.json().get(
|
614
|
+
return response.json().get("serverList", "No servers active")
|
592
615
|
|
593
616
|
def get_active_server_list(self) -> list:
|
594
617
|
"""
|
@@ -615,7 +638,7 @@ class Platform(Client):
|
|
615
638
|
return response
|
616
639
|
|
617
640
|
async def _async_shutdown_platform(self) -> None:
|
618
|
-
"""
|
641
|
+
"""Shutdown the platform. Async version.
|
619
642
|
|
620
643
|
An exception is thrown if a problem occurs during the request.
|
621
644
|
|
@@ -641,7 +664,7 @@ class Platform(Client):
|
|
641
664
|
await self._async_make_request("DELETE", url)
|
642
665
|
|
643
666
|
def shutdown_platform(self) -> None:
|
644
|
-
"""
|
667
|
+
"""Shutdown the platform.
|
645
668
|
|
646
669
|
An exception is thrown if a problem occurs during the request.
|
647
670
|
|
@@ -665,7 +688,7 @@ class Platform(Client):
|
|
665
688
|
loop.run_until_complete(self._async_shutdown_platform())
|
666
689
|
|
667
690
|
async def _async_shutdown_server(self, server: str = None) -> None:
|
668
|
-
"""
|
691
|
+
"""Shutdown a server on the associated platform. Async version.
|
669
692
|
|
670
693
|
Parameters
|
671
694
|
----------
|
@@ -691,7 +714,7 @@ class Platform(Client):
|
|
691
714
|
await self._async_make_request("DELETE", url)
|
692
715
|
|
693
716
|
def shutdown_server(self, server: str = None) -> None:
|
694
|
-
"""
|
717
|
+
"""Shutdown a server on the associated platform.
|
695
718
|
|
696
719
|
Parameters
|
697
720
|
----------
|
@@ -812,8 +835,10 @@ class Platform(Client):
|
|
812
835
|
loop = asyncio.get_event_loop()
|
813
836
|
loop.run_until_complete(self._async_shutdown_all_servers())
|
814
837
|
|
815
|
-
async def _async_activate_server_if_down(
|
816
|
-
|
838
|
+
async def _async_activate_server_if_down(
|
839
|
+
self, server: str, verbose: bool = True, timeout: int = 60
|
840
|
+
) -> bool:
|
841
|
+
"""Activate server if it is down. Async version.
|
817
842
|
|
818
843
|
Parameters
|
819
844
|
----------
|
@@ -863,13 +888,19 @@ class Platform(Client):
|
|
863
888
|
print(f" OMAG Server {server} needs to be configured")
|
864
889
|
return False
|
865
890
|
|
866
|
-
except (
|
891
|
+
except (
|
892
|
+
InvalidParameterException,
|
893
|
+
PropertyServerException,
|
894
|
+
UserNotAuthorizedException,
|
895
|
+
) as e:
|
867
896
|
if verbose:
|
868
897
|
print_exception_response(e)
|
869
898
|
raise e
|
870
899
|
|
871
|
-
def activate_server_if_down(
|
872
|
-
|
900
|
+
def activate_server_if_down(
|
901
|
+
self, server: str, verbose: bool = True, timeout: int = 60
|
902
|
+
) -> bool:
|
903
|
+
"""Activate server if it is down.
|
873
904
|
|
874
905
|
Parameters
|
875
906
|
----------
|
@@ -894,11 +925,15 @@ class Platform(Client):
|
|
894
925
|
The principle specified by the user_id does not have authorization for the requested action
|
895
926
|
"""
|
896
927
|
loop = asyncio.get_event_loop()
|
897
|
-
response = loop.run_until_complete(
|
928
|
+
response = loop.run_until_complete(
|
929
|
+
self._async_activate_server_if_down(server, verbose, timeout)
|
930
|
+
)
|
898
931
|
return response
|
899
932
|
|
900
|
-
async def _async_activate_servers_on_platform(
|
901
|
-
|
933
|
+
async def _async_activate_servers_on_platform(
|
934
|
+
self, server_list: [str], verbose=False, timeout: int = 60
|
935
|
+
) -> bool:
|
936
|
+
"""Activate the servers from the list provided. Async version.
|
902
937
|
Parameters
|
903
938
|
----------
|
904
939
|
server_list : str
|
@@ -948,8 +983,10 @@ class Platform(Client):
|
|
948
983
|
print(f"\t\tServer list empty")
|
949
984
|
return False
|
950
985
|
|
951
|
-
def activate_servers_on_platform(
|
952
|
-
|
986
|
+
def activate_servers_on_platform(
|
987
|
+
self, server_list: [str], verbose=False, timeout: int = 60
|
988
|
+
) -> bool:
|
989
|
+
"""Activate the servers from the list provided.
|
953
990
|
Parameters
|
954
991
|
----------
|
955
992
|
server_list : str
|
@@ -981,12 +1018,17 @@ class Platform(Client):
|
|
981
1018
|
is successfully activated, otherwise it returns False.
|
982
1019
|
"""
|
983
1020
|
loop = asyncio.get_event_loop()
|
984
|
-
response = loop.run_until_complete(
|
985
|
-
|
1021
|
+
response = loop.run_until_complete(
|
1022
|
+
self._async_activate_servers_on_platform(
|
1023
|
+
server_list, verbose, timeout=timeout
|
1024
|
+
)
|
1025
|
+
)
|
986
1026
|
return response
|
987
1027
|
|
988
|
-
async def _async_activate_platform(
|
989
|
-
|
1028
|
+
async def _async_activate_platform(
|
1029
|
+
self, platform_name: str, hosted_server_names: [str], timeout: int = 60
|
1030
|
+
) -> None:
|
1031
|
+
"""Activate an OMAG Server Platform and start the servers requested. Async version.
|
990
1032
|
|
991
1033
|
Parameters
|
992
1034
|
----------
|
@@ -1017,25 +1059,33 @@ class Platform(Client):
|
|
1017
1059
|
try:
|
1018
1060
|
status = self.get_platform_origin()
|
1019
1061
|
if status:
|
1020
|
-
print(
|
1021
|
-
|
1062
|
+
print(
|
1063
|
+
f"\n\n\t Platform {platform_name} is active and running: \n\t\t{status}"
|
1064
|
+
)
|
1065
|
+
print(
|
1066
|
+
f"\tWill start the following servers if configured: {hosted_server_names}"
|
1067
|
+
)
|
1022
1068
|
for server in hosted_server_names:
|
1023
|
-
activated = await self._async_activate_server_if_down(
|
1069
|
+
activated = await self._async_activate_server_if_down(
|
1070
|
+
server, timeout=timeout
|
1071
|
+
)
|
1024
1072
|
if activated:
|
1025
1073
|
print(f"\t Started server: {server}")
|
1026
1074
|
return
|
1027
1075
|
else:
|
1028
1076
|
print(f" {platform_name}, is down - start it before proceeding")
|
1029
1077
|
except (
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1078
|
+
InvalidParameterException,
|
1079
|
+
PropertyServerException,
|
1080
|
+
UserNotAuthorizedException,
|
1033
1081
|
) as e:
|
1034
1082
|
print(f" {platform_name}, is down - start it before proceeding")
|
1035
1083
|
print_exception_response(e)
|
1036
1084
|
|
1037
|
-
def activate_platform(
|
1038
|
-
|
1085
|
+
def activate_platform(
|
1086
|
+
self, platform_name: str, hosted_server_names: [str], timeout: int = 60
|
1087
|
+
) -> None:
|
1088
|
+
"""Activate an OMAG Server Platform and start the servers requested
|
1039
1089
|
|
1040
1090
|
Parameters
|
1041
1091
|
----------
|
@@ -1064,11 +1114,13 @@ class Platform(Client):
|
|
1064
1114
|
while activating the platform or starting the servers, it prints an error message and the exception response.
|
1065
1115
|
"""
|
1066
1116
|
loop = asyncio.get_event_loop()
|
1067
|
-
loop.run_until_complete(
|
1117
|
+
loop.run_until_complete(
|
1118
|
+
self._async_activate_platform(platform_name, hosted_server_names, timeout)
|
1119
|
+
)
|
1068
1120
|
|
1069
1121
|
|
1070
1122
|
if __name__ == "__main__":
|
1071
|
-
p = Platform("meow", "https://127.0.0.1:9443", "garygeeke"
|
1123
|
+
p = Platform("meow", "https://127.0.0.1:9443", "garygeeke")
|
1072
1124
|
response = p.get_known_servers()
|
1073
1125
|
|
1074
1126
|
print(response)
|