From 502f5495e6b1ae67dae5d775ace6df6c6fa0eab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0smail=20Ba=C5=9Faran?= Date: Wed, 16 Aug 2017 00:09:28 +0300 Subject: [PATCH] addded scopy from remote --- opt/ahenk/base/util/util.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/opt/ahenk/base/util/util.py b/opt/ahenk/base/util/util.py index b8a9fda..243ef35 100644 --- a/opt/ahenk/base/util/util.py +++ b/opt/ahenk/base/util/util.py @@ -154,6 +154,16 @@ class Util: except Exception as e: return 1, 'Could not execute command: {0}. Error Message: {1}'.format(command, str(e)), '' + @staticmethod + def scopy_from_remote(source_path, destination_path, ip): + command = 'scp -r root@' + ip + ':' + source_path + ' ' + destination_path + process = subprocess.Popen(command, stderr=subprocess.PIPE,stdout=subprocess.PIPE, shell=True) + result_code = process.wait() + p_out = process.stdout.read().decode("unicode_escape") + p_err = process.stderr.read().decode("unicode_escape") + + return result_code, p_out, p_err + @staticmethod def execute_script(script_path, parameters=None): command = []