Commit a526e777 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

updated. rocko - py 3.5.2, jethro - py 2.7.12

parent 5127c1fa
...@@ -40,10 +40,13 @@ python do_target_scp () { ...@@ -40,10 +40,13 @@ python do_target_scp () {
cmd = "ping "+REMOTE_IP+" -c 1" cmd = "ping "+REMOTE_IP+" -c 1"
print("cmd: "+cmd) print("cmd: "+cmd)
try: try:
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) subprocess.run(cmd,stderr=subprocess.STDOUT,shell=True)
except subprocess.CalledProcessError: except subprocess.CalledProcessError as e:
print("MOST EPIC FAIL 1: "+str(e.output))
print("MOST EPIC FAIL 2: "+str(e.cmd))
raise Exception("No route to target "+REMOTE_IP) raise Exception("No route to target "+REMOTE_IP)
nandboot = command_over_ssh(d,"'if [ -d /tmp/rootfs.ro ]; then echo 1; else echo 0;fi'") nandboot = command_over_ssh(d,"'if [ -d /tmp/rootfs.ro ]; then echo 1; else echo 0;fi'")
...@@ -56,7 +59,7 @@ python do_target_scp () { ...@@ -56,7 +59,7 @@ python do_target_scp () {
#copy archive #copy archive
cmd = "scp -i "+IDENTITY_FILE+" -p "+WORKDIR+"/image.tar.gz "+REMOTE_USER+"@"+REMOTE_IP+":/" cmd = "scp -i "+IDENTITY_FILE+" -p "+WORKDIR+"/image.tar.gz "+REMOTE_USER+"@"+REMOTE_IP+":/"
print("cmd: "+cmd) print("cmd: "+cmd)
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) subprocess.run(cmd,stderr=subprocess.STDOUT,shell=True)
#unpack archive to / #unpack archive to /
command_over_ssh(d,"'tar -C / -xzpf /image.tar.gz; sync'") command_over_ssh(d,"'tar -C / -xzpf /image.tar.gz; sync'")
#unpack archive to /tmp/rootfs.ro #unpack archive to /tmp/rootfs.ro
...@@ -86,7 +89,7 @@ python do_target_scp () { ...@@ -86,7 +89,7 @@ python do_target_scp () {
#copy archive #copy archive
print("Copy archive") print("Copy archive")
cmd = "scp -i "+IDENTITY_FILE+" -p "+WORKDIR+"/image.tar.gz "+REMOTE_USER+"@"+REMOTE_IP+":/" cmd = "scp -i "+IDENTITY_FILE+" -p "+WORKDIR+"/image.tar.gz "+REMOTE_USER+"@"+REMOTE_IP+":/"
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) subprocess.run(cmd,stderr=subprocess.STDOUT,shell=True)
#unpack archive to mountpoint #unpack archive to mountpoint
print("Unpack archive then delete") print("Unpack archive then delete")
...@@ -101,7 +104,7 @@ python do_target_scp () { ...@@ -101,7 +104,7 @@ python do_target_scp () {
#copy archive #copy archive
cmd = "scp -i "+IDENTITY_FILE+" -p "+WORKDIR+"/image.tar.gz "+REMOTE_USER+"@"+REMOTE_IP+":/" cmd = "scp -i "+IDENTITY_FILE+" -p "+WORKDIR+"/image.tar.gz "+REMOTE_USER+"@"+REMOTE_IP+":/"
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) subprocess.run(cmd,stderr=subprocess.STDOUT,shell=True)
#unpack archive to / #unpack archive to /
command_over_ssh(d,"'tar -C / -xzpf /image.tar.gz; rm -f /image.tar.gz; sync'") command_over_ssh(d,"'tar -C / -xzpf /image.tar.gz; rm -f /image.tar.gz; sync'")
......
...@@ -8,8 +8,9 @@ def command_over_ssh(d,command): ...@@ -8,8 +8,9 @@ def command_over_ssh(d,command):
cmd = "ssh -i "+id+" "+user+"@"+ip+" "+command cmd = "ssh -i "+id+" "+user+"@"+ip+" "+command
print("cmd: "+cmd) print("cmd: "+cmd)
try: try:
ret = subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True) ret = subprocess.run(cmd,stderr=subprocess.STDOUT,shell=True)
except subprocess.CalledProcessError: except subprocess.CalledProcessError as e:
print("Error code: "+e.returncode)
raise Exception("Copying to target requires access by public key. Run: \033[1;37mssh-copy-id "+REMOTE_USER+"@"+REMOTE_IP+"\033[0m") raise Exception("Copying to target requires access by public key. Run: \033[1;37mssh-copy-id "+REMOTE_USER+"@"+REMOTE_IP+"\033[0m")
return ret.strip() return str(ret).strip()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment