Coverage for ocp_resources/ocs_initialization.py: 0%

11 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-01-30 10:48 +0200

1from ocp_resources.utils.constants import TIMEOUT_4MINUTES 

2from ocp_resources.resource import NamespacedResource 

3 

4 

5class OCSInitialization(NamespacedResource): 

6 api_group = NamespacedResource.ApiGroup.OCS_OPENSHIFT_IO 

7 

8 def __init__( 

9 self, 

10 name=None, 

11 namespace=None, 

12 client=None, 

13 teardown=False, 

14 yaml_file=None, 

15 delete_timeout=TIMEOUT_4MINUTES, 

16 enable_ceph_tools=None, 

17 **kwargs, 

18 ): 

19 """ 

20 OCSInitialization object. 

21 API reference (source code linked here due to lack of API doc for this resource): 

22 https://github.com/red-hat-storage/ocs-operator/blob/main/api/v1/ocsinitialization_types.go 

23 

24 Args: 

25 enable_ceph_tools (bool): When True, creates a Deployment named "rook-ceph-tools" in the "openshift-storage" 

26 namespace. More information about the Rook Ceph Toolbox can be found here: 

27 https://rook.io/docs/rook/v1.10/Troubleshooting/ceph-toolbox/ 

28 """ 

29 

30 super().__init__( 

31 name=name, 

32 namespace=namespace, 

33 client=client, 

34 teardown=teardown, 

35 yaml_file=yaml_file, 

36 delete_timeout=delete_timeout, 

37 **kwargs, 

38 ) 

39 self.enable_ceph_tools = enable_ceph_tools 

40 

41 def to_dict(self) -> None: 

42 super().to_dict() 

43 if not self.yaml_file and self.enable_ceph_tools is not None: 

44 self.res.update({ 

45 "spec": { 

46 "enableCephTools": self.enable_ceph_tools, 

47 } 

48 })