From 758c73e1493d8499f346c1fb7e3ca1e18ec1454e Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Tue, 17 Sep 2013 12:24:40 +0200 Subject: test_integration.host: Move transport-related functionality to a new module This will make it possible to use a different mechanism for cases like - Paramiko is not available - Hosts without SSH servers (e.g. Windows) Add BaseHost, Transport & Command base classes that define the interface and common functionality, and Host, ParamikoTransport & SSHCommand with specific details. The {get,put}_file_contents methods are left on Host for convenience; all other Transport methods must be now accessed through the transport. Part of the work for https://fedorahosted.org/freeipa/ticket/3890 --- ipatests/test_integration/tasks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ipatests/test_integration/tasks.py') diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py index 69a34a28..7ea0ce4f 100644 --- a/ipatests/test_integration/tasks.py +++ b/ipatests/test_integration/tasks.py @@ -40,7 +40,7 @@ log = log_mgr.get_logger(__name__) def prepare_host(host): env_filename = os.path.join(host.config.test_dir, 'env.sh') host.collect_log(env_filename) - host.mkdir_recursive(host.config.test_dir) + host.transport.mkdir_recursive(host.config.test_dir) host.put_file_contents(env_filename, env_to_script(host.to_env())) @@ -51,10 +51,10 @@ def apply_common_fixes(host): def backup_file(host, filename): - if host.file_exists(filename): + if host.transport.file_exists(filename): backupname = os.path.join(host.config.test_dir, 'file_backup', filename.lstrip('/')) - host.mkdir_recursive(os.path.dirname(backupname)) + host.transport.mkdir_recursive(os.path.dirname(backupname)) host.run_command(['cp', '-af', filename, backupname]) return True else: @@ -63,7 +63,7 @@ def backup_file(host, filename): ipautil.shell_quote(filename), ipautil.shell_quote(rmname))) contents = host.get_file_contents(rmname) - host.mkdir_recursive(os.path.dirname(rmname)) + host.transport.mkdir_recursive(os.path.dirname(rmname)) return False -- cgit