From 7dc3b5086d4c1d19c9ef315369f3fd7c4dd2889e Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Fri, 28 Jul 2017 11:57:20 +0200 Subject: Model & ssh: ssh-related methods renaming --- rumba/model.py | 12 ++++++------ rumba/prototypes/irati.py | 2 +- rumba/ssh_support.py | 14 ++++++-------- rumba/testbeds/emulab.py | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/rumba/model.py b/rumba/model.py index ca35647..1adc3b0 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -343,24 +343,24 @@ class Node: time_out ) - def copy_file_to_testbed(self, text, file_name): - ssh_support.copy_file_to_testbed( + def write_text_to_file(self, text, file_name): + ssh_support.write_text_to_file( self.ssh_config, self.ssh_config, text, file_name ) - def copy_path_to_testbed(self, path, destination): - ssh_support.copy_path_to_testbed( + def copy_file(self, path, destination): + ssh_support.copy_file_to_testbed( self.ssh_config, self.ssh_config, path, destination ) - def copy_paths_to_testbed(self, paths, destination): - ssh_support.copy_paths_to_testbed( + def copy_files(self, paths, destination): + ssh_support.copy_files_to_testbed( self.ssh_config, self.ssh_config, paths, diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index 57901fc..14d4c27 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -146,7 +146,7 @@ class Experiment(mod.Experiment): 'ipcmcomps': ipcm_components} logger.info('Copying configuration files to node %s', node.name) - ssh.copy_paths_to_testbed(self.testbed, + ssh.copy_files_to_testbed(self.testbed, node.ssh_config, gen_files, '') diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py index e785f33..53d81a1 100644 --- a/rumba/ssh_support.py +++ b/rumba/ssh_support.py @@ -150,7 +150,7 @@ def execute_command(testbed, ssh_config, command, time_out=3): return o -def copy_file_to_testbed(testbed, ssh_config, text, file_name): +def write_text_to_file(testbed, ssh_config, text, file_name): """ Write a string to a given remote file. Overwrite the complete file if it already exists! @@ -193,10 +193,9 @@ def copy_file_to_testbed(testbed, ssh_config, text, file_name): logger.error(str(e)) -def copy_paths_to_testbed(testbed, ssh_config, paths, destination): +def copy_files_to_testbed(testbed, ssh_config, paths, destination): """ - Write a string to a given remote file. - Overwrite the complete file if it already exists! + Copies local files to a remote node. @param testbed: testbed info @param ssh_config: ssh config of the node @@ -237,17 +236,16 @@ def copy_paths_to_testbed(testbed, ssh_config, paths, destination): logger.error(str(e)) -def copy_path_to_testbed(testbed, ssh_config, path, destination): +def copy_file_to_testbed(testbed, ssh_config, path, destination): """ - Write a string to a given remote file. - Overwrite the complete file if it already exists! + Copies a local file to a remote node. @param testbed: testbed info @param ssh_config: ssh config of the node @param path: source path (local) @param destination: destination folder name (remote) """ - copy_paths_to_testbed(testbed, ssh_config, [path], destination) + copy_files_to_testbed(testbed, ssh_config, [path], destination) def setup_vlan(testbed, node, vlan_id, int_name): diff --git a/rumba/testbeds/emulab.py b/rumba/testbeds/emulab.py index 9b90e68..53eebe5 100644 --- a/rumba/testbeds/emulab.py +++ b/rumba/testbeds/emulab.py @@ -131,7 +131,7 @@ class Testbed(mod.Testbed): ns = self.generate_ns_script(experiment) dest_file_name = '/users/' + self.username + \ '/temp_ns_file.%s.ns' % os.getpid() - ssh.copy_file_to_testbed(self, self.ops_ssh_config, ns, dest_file_name) + ssh.write_text_to_file(self, self.ops_ssh_config, ns, dest_file_name) cmd = '/usr/testbed/bin/sslxmlrpc_client.py startexp ' + \ 'batch=false wait=true proj="' + proj_name + \ -- cgit v1.2.3