diff options
Diffstat (limited to 'ipatests/test_integration/host.py')
-rw-r--r-- | ipatests/test_integration/host.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ipatests/test_integration/host.py b/ipatests/test_integration/host.py index 0d363f93a..5647e0dc2 100644 --- a/ipatests/test_integration/host.py +++ b/ipatests/test_integration/host.py @@ -160,11 +160,21 @@ class Host(object): self._command_index = 0 + self.log_collectors = [] + def __repr__(self): template = ('<{s.__module__}.{s.__class__.__name__} ' '{s.hostname} ({s.role})>') return template.format(s=self) + def add_log_collector(self, collector): + """Register a log collector for this host""" + self.log_collectors.append(collector) + + def remove_log_collector(self, collector): + """Unregister a log collector""" + self.log_collectors.remove(collector) + @classmethod def from_env(cls, env, domain, hostname, role, index): ip = env.get('BEAKER%s%s_IP_env%s' % @@ -319,3 +329,7 @@ class Host(object): def put_file(self, localpath, remotepath): self.log.info('PUT %s', remotepath) self.sftp.put(localpath, remotepath) + + def collect_log(self, filename): + for collector in self.log_collectors: + collector(self, filename) |