blob: 5d3a48de32bc2a65b37c841708f9ef7300bd348d [file] [log] [blame]
Alex Savatieiev5118de02019-02-20 15:50:42 -06001from cfg_checker.common import logger
Alex3ebc5632019-04-18 16:47:18 -05002from cfg_checker.common.salt_utils import SaltRemote
Alex9a4ad212020-10-01 18:04:25 -05003from cfg_checker.common.kube_utils import KubeRemote
4
Alex Savatieiev5118de02019-02-20 15:50:42 -06005
6# instance of the salt client
7salt = None
Alex9a4ad212020-10-01 18:04:25 -05008kube = None
Alex Savatieiev5118de02019-02-20 15:50:42 -06009
10
11def get_salt_remote(config):
12 """Singleton-like creation of instance
13
14 Arguments:
15 config {base_config} -- an instance to base_config
16 with creds and params
17
18 Returns:
19 SaltRemote -- instance of salt client
20 """
21
22 global salt
23 logger.info("Creating salt remote instance")
24 # create it once
25 if salt is None:
Alex9a4ad212020-10-01 18:04:25 -050026 salt = SaltRemote(config)
Alex Savatieiev5118de02019-02-20 15:50:42 -060027 # return once required
28 return salt
Alex9a4ad212020-10-01 18:04:25 -050029
30
31def get_kube_remote(config):
32 """Singleton-like creation of instance
33
34 Arguments:
35 config {base_config} -- an instance to base_config
36 with creds and params
37
38 Returns:
39 KubeRemote -- instance of kube client
40 """
41 global kube
42 logger.info("Creating kube remote client instance")
43 # Create it once
44 if kube is None:
45 kube = KubeRemote(config)
46 return kube