summaryrefslogtreecommitdiffstats
path: root/docker_upgrade_scripts/fabfile.py
blob: 72e3e61a040fc8ad10decdbe9e78b11f12d3ff25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from fabric.api import *
from fabric.context_managers import *

def uptime():
    res = run('cat /proc/uptime')
    print res

def host_type():
	run('uname -s')

def upgrade_docker(server_name, my_env):
	server_name=server_name.split("-")[1]
	if server_name in "message-router":
		execute_file = "/opt/mr_vm_init.sh"
	elif server_name in "dcae-controller":
		execute_file = "/opt/dcae2_vm_init.sh"
    	elif server_name in "openo-server":
		execute_file = "/opt/openo_all_serv.sh" 
	elif server_name in "dns":
		execute_file = None
	else:
		execute_file = "/opt/" + server_name + "_vm_init.sh"
	print "Executing file %s" % execute_file
	if execute_file:
		with settings( warn_only=True, key_filename=my_env['key_filename'], user=my_env['user']):
			sudo(execute_file)

def health_checks_robot(my_env):
	with settings( warn_only=True, key_filename=my_env['key_filename'], user=my_env['user']):
		with cd('/opt'):
			sudo('./ete.sh health')