diff --git a/ocp_resources/catalog_source.py b/ocp_resources/catalog_source.py index ae896c67c2..1e03861c98 100644 --- a/ocp_resources/catalog_source.py +++ b/ocp_resources/catalog_source.py @@ -1,34 +1,32 @@ -from ocp_resources.constants import TIMEOUT_4MINUTES from ocp_resources.resource import NamespacedResource class CatalogSource(NamespacedResource): + """ + https://olm.operatorframework.io/docs/concepts/crds/catalogsource/ + """ + api_group = NamespacedResource.ApiGroup.OPERATORS_COREOS_COM def __init__( self, - name=None, - namespace=None, - client=None, source_type=None, image=None, display_name=None, publisher=None, - teardown=True, - yaml_file=None, - delete_timeout=TIMEOUT_4MINUTES, update_strategy_registry_poll_interval=None, **kwargs, ): - super().__init__( - name=name, - namespace=namespace, - client=client, - teardown=teardown, - yaml_file=yaml_file, - delete_timeout=delete_timeout, - **kwargs, - ) + """ + Args: + source_type (str): Name of the source type. + image (str): Image index for the catalog. + display_name (str): Display name for the catalog in the web console and CLI. + publisher (str): Name of the publisher. + update_strategy_registry_poll_interval (str, optional): Time interval between checks of the latest + catalog_source version. + """ + super().__init__(**kwargs) self.source_type = source_type self.image = image self.display_name = display_name @@ -40,6 +38,13 @@ def __init__( def to_dict(self): super().to_dict() if not self.yaml_file: + if not all( + [self.source_type, self.image, self.display_name, self.publisher] + ): + raise ValueError( + "Passing yaml_file or all parameters 'source_type', 'image'," + " 'display_name' and 'publisher' is required." + ) self.res.update( { "spec": { @@ -50,7 +55,6 @@ def to_dict(self): } } ) - if self.update_strategy_registry_poll_interval: self.res["spec"].update( {