summaryrefslogtreecommitdiffstats
path: root/ipatests/test_integration/host.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipatests/test_integration/host.py')
-rw-r--r--ipatests/test_integration/host.py14
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