cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
s007_configure_rm.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # @COPYRIGHT_begin
3 #
4 # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # @COPYRIGHT_end
19 
20 from settings import SERVICES_TMP, BASIC_IMAGE, SSH_KEY, SYSTEM_VERSION, DEB_REPO
21 
22 from scripts.s003_install_services import wi_net_wi_clm, clm_net_wi_clm, ssh_key,\
23  cm_net_clm_cm, cm_net_cm_cluster, clm_net_clm_cm, rm
24 
25 # Generate patches
26 rm_config = open('%s/rm.config.diff' % SERVICES_TMP, 'w')
27 rm_config.write('''14c14
28 < RM_ADDRESS=('127.0.0.1', 8004)
29 ---
30 > RM_ADDRESS=('%(RM)s', 8004)
31 17c17
32 < CM_RMI=('127.0.0.1', 8003)
33 ---
34 > CM_RMI=('%(CM)s', 8003)
35 20c20
36 < PUBLIC_IP = '127.0.0.1'
37 ---
38 > PUBLIC_IP = '%(RM)s''
39 ''' % {'CM': cm_net_cm_cluster,
40  'RM': rm})
41 rm_config.close()
42 
43 # Definvncvncve actions
44 actions = []
45 
46 actions.append({'type': 'exec',
47  'command': 'scp',
48  'args': ['-i',
49  '%s/id_test' % SERVICES_TMP,
50  '%s/rm.config.diff' % SERVICES_TMP,
51  'root@%s:/tmp/' % rm]})
52 actions.append({'type': 'exec',
53  'command': 'ssh',
54  'args': ['-i',
55  '%s/id_test' % SERVICES_TMP,
56  'root@%s' % rm,
57  'patch /etc/cc1/rm/settings.py < /tmp/rm.config.diff']})
58 actions.append({'type': 'exec',
59  'command': 'ssh',
60  'args': ['-i',
61  '%s/id_test' % SERVICES_TMP,
62  'root@%s' % rm,
63  '/etc/init.d/cc1-rm restart']})
64