diff --git a/plugins/lookup/supported.py b/plugins/lookup/supported.py index 9c56a2fc..dfe0fff1 100644 --- a/plugins/lookup/supported.py +++ b/plugins/lookup/supported.py @@ -53,6 +53,13 @@ - cloudera_manager - cloudera_runtime - cloudera_data_services + raw_filters: + description: + - Additional raw filters to add to the support matrix URL. + - Each filter will be appended to the URL, delimited by colons (C(;)). + type: list + elements: str + required: false timeout: description: Query timeout (seconds) type: int @@ -97,8 +104,11 @@ def run(self, terms, variables=None, **kwargs): product = self.get_option("product") version = self.get_option("version") timeout = self.get_option("timeout") + raw_filters = self.get_option("raw_filters") + if raw_filters is None: + raw_filters = [] - matrix_url, filters = support_matrix_url({product: version}) + matrix_url, filters = support_matrix_url({product: version}, raw_filters) display.v(f"[DEBUG] Support Matrix URL: {matrix_url}") diff --git a/plugins/module_utils/cldr_supported.py b/plugins/module_utils/cldr_supported.py index 2bd201a7..2d76c9fc 100644 --- a/plugins/module_utils/cldr_supported.py +++ b/plugins/module_utils/cldr_supported.py @@ -29,7 +29,10 @@ } -def support_matrix_url(product_versions: dict[str, str]) -> Tuple[str, dict[str, str]]: +def support_matrix_url( + product_versions: dict[str, str], + raw_filters: list[str] = [], +) -> Tuple[str, dict[str, str]]: """Construct the URL to the Support Matrix server. Args: @@ -59,6 +62,10 @@ def support_matrix_url(product_versions: dict[str, str]) -> Tuple[str, dict[str, product_condition = f"PRODUCT={','.join(products)}" conditions.append(product_condition) + # Example of additional filters + # ?condition=PRODUCT=CDP%20Private%20Cloud%20Base-7.1.9%20SP1,Cloudera%20Manager-7.13.1;OPERATING_SYSTEM=RHEL-9.2; + conditions.extend(raw_filters) + if conditions: # Add trailing semicolon as shown in the curl example # Don't URL encode the entire condition string, only spaces are encoded diff --git a/plugins/modules/supported.py b/plugins/modules/supported.py index 9b6e1081..9a30cbf6 100755 --- a/plugins/modules/supported.py +++ b/plugins/modules/supported.py @@ -44,6 +44,14 @@ - Mutually exclusive with the O(cloudera_manager) and O(cloudera_runtime) parameters. type: str required: false + raw_filters: + description: + - Additional raw filters to add to the support matrix URL. + - Each filter will be appended to the URL, delimited by colons (C(;)). + type: list + elements: str + required: false + default: [] timeout: description: - HTTP request timeout in seconds. @@ -72,6 +80,13 @@ cloudera.exe.supported: cloudera_data_services: "1.5.4" register: ds_support + +- name: Get support matrix for Cloudera Manager version and OS + cloudera.exe.supported: + cloudera_manager: "7.13.1" + raw_filters: + - OPERATING_SYSTEMS=RHEL-9.2 + register: ds_support """ RETURN = r""" @@ -302,7 +317,8 @@ def __init__(self, module): if version: self.product_versions[param_name] = version - self.timeout = module.params.get("timeout", 30) + self.raw_filters = module.params.get("raw_filters") + self.timeout = module.params.get("timeout") # Initialize return values self.support_matrix_data = {} @@ -318,7 +334,10 @@ def process(self): try: # Build the API URL - api_url, self.filters = support_matrix_url(self.product_versions) + api_url, self.filters = support_matrix_url( + self.product_versions, + raw_filters=self.raw_filters, + ) # Prepare headers headers = { @@ -387,6 +406,7 @@ def main(): cloudera_manager=dict(type="str", required=False), cloudera_runtime=dict(type="str", required=False), cloudera_data_services=dict(type="str", required=False), + raw_filters=dict(type="list", elements="str", required=False, default=[]), timeout=dict(type="int", default=30), ), mutually_exclusive=[