Commit a824449a authored by Hamza Dely's avatar Hamza Dely

[majswitchs2] s/os.system/subprocess.call/g

parent fdf7ae8e
......@@ -22,6 +22,7 @@ Gabriel Detraz 2017
from __future__ import print_function
import sys
import subprocess
from annuaires_pg import all_switchs
import hptools2
import pexpect
......@@ -113,7 +114,7 @@ def do_upgrade(switch, destination='primary'):
print("Firmware %s introuvable !" % normal_firm)
return
print('sudo scp %s root@%s:os/%s' % (firmware_long_path, switch, destination))
os.system('sudo scp %s root@%s:os/%s' % (firmware_long_path, switch, destination))
subprocess.call(['/usr/bin/sudo', '/usr/bin/scp', firmware_long_path, 'root@%s:os/%s' % (switch, destination)])
else:
return
......@@ -128,8 +129,8 @@ def do_reflash(switch):
query = raw_input('Rechargement de la conf de %s (Y pour confirmer)' % switch)
if query == "Y":
sw = switch.split('.')[0]
os.system('/usr/scripts/gestion/gen_confs/switchs2.py %s > /tmp/%s.conf' % (sw, sw))
os.system('sudo scp /tmp/%s.conf root@%s:cfg/startup-config' % (sw, switch))
subprocess.call(['/usr/scripts/gestion/gen_confs/switchs2.py', sw,], stdout=open('/tmp/%s.conf' % sw, "w"))
subprocess.call(['/usr/bin/sudo', '/usr/bin/scp', '/tmp/%s.conf' % sw, 'root@%s:cfg/startup-config' % switch])
parser = argparse.ArgumentParser()
parser.add_argument('--stats', action="store_true", help="Affiche des statistiques générales sur les switchs et leur état de mise à jour")
......
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