diff options
author | Petr Viktorin <pviktori@redhat.com> | 2013-06-05 18:30:39 +0200 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2013-07-15 15:49:11 +0200 |
commit | 846ae2b3f4807f2b1897811b9fe9978103c2451a (patch) | |
tree | 29613e865d58f298029d89bad22116ed90ce4a5e /ipatests/test_integration/host.py | |
parent | d84e10347eb42ffca7d5d761e0f7af447f3e2ef7 (diff) | |
download | freeipa-846ae2b3f4807f2b1897811b9fe9978103c2451a.tar.gz freeipa-846ae2b3f4807f2b1897811b9fe9978103c2451a.tar.xz freeipa-846ae2b3f4807f2b1897811b9fe9978103c2451a.zip |
tests: Configure/unconfigure remote hosts
Set up the hostname, /etc/resolv.conf, and /etc/hosts on remote
hosts in the test setup.
Undo the changes in test teardown.
Part of the work for https://fedorahosted.org/freeipa/ticket/3621
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 b4d736cd6..404e5eec8 100644 --- a/ipatests/test_integration/host.py +++ b/ipatests/test_integration/host.py @@ -23,6 +23,7 @@ import os import socket import threading import subprocess +import errno import paramiko @@ -122,6 +123,7 @@ class Host(object): self.index = index shortname, dot, ext_domain = hostname.partition('.') + self.shortname = shortname self.hostname = shortname + '.' + self.domain.name self.external_hostname = hostname @@ -279,3 +281,15 @@ class Host(object): self.log.info('WRITE %s', filename) with self.sftp.open(filename, 'w') as f: return f.write(contents) + + def file_exists(self, filename): + """Return true if the named remote file exists""" + self.log.info('STAT %s', filename) + try: + self.sftp.stat(filename) + except IOError, e: + if e.errno == errno.ENOENT: + return False + else: + raise + return True |