Coverage for ocp_resources/hostpath_provisioner.py: 0%
22 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
1# -*- coding: utf-8 -*-
2from ocp_resources.utils.constants import TIMEOUT_4MINUTES
3from ocp_resources.resource import Resource
6class HostPathProvisioner(Resource):
7 """
8 HostPathProvisioner Custom Resource Object.
9 """
11 api_group = Resource.ApiGroup.HOSTPATHPROVISIONER_KUBEVIRT_IO
13 class Name:
14 HOSTPATH_PROVISIONER = "hostpath-provisioner"
16 def __init__(
17 self,
18 name=None,
19 path=None,
20 image_pull_policy=None,
21 client=None,
22 teardown=True,
23 yaml_file=None,
24 delete_timeout=TIMEOUT_4MINUTES,
25 **kwargs,
26 ):
27 super().__init__(
28 name=name,
29 client=client,
30 teardown=teardown,
31 yaml_file=yaml_file,
32 delete_timeout=delete_timeout,
33 **kwargs,
34 )
35 self.path = path
36 self.image_pull_policy = image_pull_policy
38 def to_dict(self) -> None:
39 super().to_dict()
40 if not self.kind_dict and not self.yaml_file:
41 spec = self.res.setdefault("spec", {})
42 path_config = spec.setdefault("pathConfig", {})
43 if self.path:
44 path_config["path"] = self.path
45 if self.image_pull_policy:
46 spec["imagePullPolicy"] = self.image_pull_policy
48 @property
49 def volume_path(self):
50 return self.instance.spec.pathConfig.path