Mariusz Wagner | cfd26b9 | 2018-06-13 14:30:27 +0200 | [diff] [blame] | 1 | import docker |
| 2 | |
| 3 | class PrhLibrary(object): |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 4 | |
Mariusz Wagner | cfd26b9 | 2018-06-13 14:30:27 +0200 | [diff] [blame] | 5 | def __init__(self): |
| 6 | pass |
| 7 | |
Mariusz Wagner | a2a6c98 | 2018-06-14 15:53:56 +0200 | [diff] [blame] | 8 | def check_for_log(self, search_for): |
Mariusz Wagner | cfd26b9 | 2018-06-13 14:30:27 +0200 | [diff] [blame] | 9 | client = docker.from_env() |
| 10 | container = client.containers.get('prh') |
| 11 | for line in container.logs(stream=True): |
Mariusz Wagner | a2a6c98 | 2018-06-14 15:53:56 +0200 | [diff] [blame] | 12 | if search_for in line.strip(): |
Mariusz Wagner | cfd26b9 | 2018-06-13 14:30:27 +0200 | [diff] [blame] | 13 | return True |
| 14 | else: |
Mariusz Wagner | a2a6c98 | 2018-06-14 15:53:56 +0200 | [diff] [blame] | 15 | return False |