Add executeMachineScpCommand method
Change-Id: I3326dcfff7c8afaf9e2375d75a895d008efe0bd2
Related-Prod: PRODX-0000
diff --git a/src/com/mirantis/mk/Ssh.groovy b/src/com/mirantis/mk/Ssh.groovy
index c07aa26..703f81e 100644
--- a/src/com/mirantis/mk/Ssh.groovy
+++ b/src/com/mirantis/mk/Ssh.groovy
@@ -85,4 +85,25 @@
runSshAgentCommand("ssh-add ~/.ssh/id_rsa_${credentialsId}")
}
+/**
+ * Copy files via SCP
+ *
+ * @param source source file
+ * @param destination desination file
+ * @param options additional scp options
+
+ */
+def executeMachineScpCommand(source, destination, options=null){
+ if (!options){
+ options = ['StrictHostKeyChecking': 'no', 'UserKnownHostsFile': '/dev/null']
+ }
+ String optionsString = ''
+ options.each { k,v ->
+ optionsString += "-o ${k}=${v} "
+ }
+
+ agentSh("scp ${optionsString} ${source} ${destination}")
+}
+
+
return this;