Coverage for src/susi/db/remote_connection.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2025-06-13 14:15 +0000

1#!/usr/bin/env python3 

2# -*- coding: utf-8 -*- 

3""" 

4Provides remote DB connection information 

5 

6@author: hoelken 

7""" 

8 

9from dataclasses import dataclass 

10 

11 

12@dataclass 

13class RemoteConnection: 

14 """ 

15 Configuration to access a remote database (e.g. to bypass slow net i/o when working on remotely mounted devices) 

16 

17 Sets the base directory (e.g., '/data') for searching files in a remote database via ssh (e.g., 'ssh': ). 

18 """ 

19 

20 ssh: str = None 

21 """ 

22 The SSH user@host to use, e.g. 'sunrise@sunstore-sl21'. 

23 A password-less SSH tunnle must be available (e.g. via a password-less rsa-id) 

24 """ 

25 

26 base: str = None 

27 """ 

28 Remote base directory of the database. 

29 """ 

30 

31 def __bool__(self) -> bool: 

32 """Allows `if RemoteConnection():` calls.""" 

33 return self.base is not None and self.ssh is not None