cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
s006_configure_cm.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 cm_config = open('%s/cm.config.diff' % SERVICES_TMP, 'w')
27 cm_config.write('''18c18
28 < LOG_LEVEL = logging.ERROR
29 ---
30 > LOG_LEVEL = logging.INFO
31 134c134
32 < CM_ADDRESS = ('127.0.0.1', 8001)
33 ---
34 > CM_ADDRESS = ('%(CM_NET_CLM_CM)s', 8001)
35 140c140
36 < RMI_ADDRESS = ('127.0.0.1', 8003)
37 ---
38 > RMI_ADDRESS = ('%(CM_NET_CM_CLUSTER)s', 8003)
39 151c151
40 < CLM_ADDRESS = ('127.0.0.1', 8000)
41 ---
42 > CLM_ADDRESS = ('%(CLM_NET_CLM_CM)s', 8000)
43 154c154
44 < RM_ADDRESS = ('127.0.0.1', 8004)
45 ---
46 > RM_ADDRESS = ('%(RM)s', 8004)
47 157c157
48 < VNC_ADDRESS = '127.0.0.1'
49 ---
50 > VNC_ADDRESS = '%(RM)s'
51 ''' % {'CM_NET_CLM_CM': cm_net_clm_cm,
52  'CM_NET_CM_CLUSTER': cm_net_cm_cluster,
53  'CLM_NET_CLM_CM': clm_net_clm_cm,
54  'RM': rm})
55 cm_config.close()
56 
57 # Definvncvncve actions
58 actions = []
59 
60 actions.append({'type': 'exec',
61  'command': 'scp',
62  'args': ['-i',
63  '%s/id_test' % SERVICES_TMP,
64  '%s/cm.config.diff' % SERVICES_TMP,
65  'root@%s:/tmp/' % cm_net_clm_cm]})
66 actions.append({'type': 'exec',
67  'command': 'ssh',
68  'args': ['-i',
69  '%s/id_test' % SERVICES_TMP,
70  'root@%s' % cm_net_clm_cm,
71  'patch /etc/cc1/cm/settings.py < /tmp/cm.config.diff']})
72 actions.append({'type': 'exec',
73  'command': 'ssh',
74  'args': ['-i',
75  '%s/id_test' % SERVICES_TMP,
76  'root@%s' % cm_net_clm_cm,
77  '/etc/init.d/cc1-cm restart']})
78