Merge "use https for robot framework and vfw script"
[demo.git] / docker_upgrade_scripts / fabfile.py
1 from fabric.api import *
2 from fabric.context_managers import *
3
4 def uptime():
5     res = run('cat /proc/uptime')
6     print res
7
8 def host_type():
9         run('uname -s')
10
11 def upgrade_docker(server_name, my_env):
12         server_name=server_name.split("-")[1]
13         if server_name in "message-router":
14                 execute_file = "/opt/mr_vm_init.sh"
15         elif server_name in "dcae-controller":
16                 execute_file = "/opt/dcae2_vm_init.sh"
17         elif server_name in "multiserv-server":
18                 execute_file = "/opt/multiserv_all_serv.sh" 
19         elif server_name in "dns":
20                 execute_file = None
21         else:
22                 execute_file = "/opt/" + server_name + "_vm_init.sh"
23         print "Executing file %s" % execute_file
24         if execute_file:
25                 with settings( warn_only=True, key_filename=my_env['key_filename'], user=my_env['user']):
26                         sudo(execute_file)
27
28 def health_checks_robot(my_env):
29         with settings( warn_only=True, key_filename=my_env['key_filename'], user=my_env['user']):
30                 with cd('/opt'):
31                         sudo('./ete.sh health')
32