kvm: pin cns.recipe.symlink
[slapos.git] / software / test-slave-instance-deployment / parameter-check-promise.py.in
1 #!${buildout:executable}
2 import sys
3 import os
4 import json
5
6 json_file = '$${dump-connection-informations:json-output}'
7 connection_parameter_list = json.loads(open(json_file, 'r').read())
8 # XXX list all problems before exit
9 # XXX: factor in a clean dict loop
10 test_instance_guid = connection_parameter_list['test-instance-guid']
11 if not test_instance_guid == 'slappart1':
12 print 'Bad test-instance-guid connection parameter: %s' % test_instance_guid
13 sys.exit(1)
14 test_instance_state = connection_parameter_list['test-instance-state']
15 if not test_instance_state == 'started':
16 print 'Bad test-instance-state connection parameter: %s instead of started' % test_instance_state
17 sys.exit(1)
18 test_instance_slave_instance_list = connection_parameter_list['test-instance-slave-instance-list']
19 if test_instance_slave_instance_list == []:
20 print 'test-instance-slave-instance-list connection parameter is empty.'
21 sys.exit(1)
22 root_instance_slave_instance_list = connection_parameter_list['root-instance-slave-instance-list']
23 if root_instance_slave_instance_list != []:
24 print 'root-instance-slave-instance-list connection parameter is not empty.'
25 sys.exit(1)
26 slave_instance_parameter = connection_parameter_list['slave-instance-parameter']
27 if slave_instance_parameter != 'I am slave instance, and I am deployed!':
28 print 'parameter slave-instance-parameter is not correct.'
29 sys.exit(1)