SLS Module
The sls module provides functions for Suite License Service integration.
sls
Functions:
listSLSInstances(dynClient)
Retrieve all Suite License Service (SLS) instances from the OpenShift cluster.
This function queries the cluster for LicenseService custom resources and returns a list of all SLS instances found. It handles various error conditions gracefully, including missing CRDs and authorization failures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dynClient
|
DynamicClient
|
OpenShift dynamic client for cluster API interactions. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
A list of dictionaries representing SLS LicenseService instances. Returns an empty list if no instances are found, the CRD doesn't exist, or authorization fails. |
Source code in src/mas/devops/sls.py
findSLSByNamespace(namespace, instances=None, dynClient=None)
Check if an SLS instance exists in a specific namespace.
This function searches for Suite License Service instances in the specified namespace. It can work with either a pre-fetched list of instances or dynamically query the cluster using the provided DynamicClient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str
|
The OpenShift namespace to search for SLS instances. |
required |
instances
|
list
|
Pre-fetched list of SLS instance dictionaries. If None, dynClient must be provided. Defaults to None. |
None
|
dynClient
|
DynamicClient
|
OpenShift dynamic client for querying instances. Required if instances is None. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
True if an SLS instance is found in the specified namespace, False otherwise. Also returns False if neither instances nor dynClient is provided. |
Source code in src/mas/devops/sls.py
getSLSRegistrationDetails(namespace, name, dynClient)
Retrieve registration details like licenseId and registrationKey from the LicenseService instance's CR status
This function gets the LicenseService instance of a specified name in a specified namespace. It retrieves licenseId and registrationKey keys in CR status and returns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str
|
The OpenShift namespace to search for SLS instances. |
required |
name
|
str
|
Name of SLS(LicenseService) instance. |
required |
dynClient
|
DynamicClient
|
OpenShift dynamic client for querying instances. Required if instances is None. Defaults to None. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict with 'licenseId' and 'registrationKey' when details are found. Empty if not found. |