cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
s005_configure_clm.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 
24 # Generate patches
25 clm_config = open('%s/clm.config.diff' % SERVICES_TMP, 'w')
26 clm_config.write('''52c52
27 < CLM_ADDRESS = ('127.0.0.1', 8000)
28 ---
29 > CLM_ADDRESS = ('0.0.0.0', 8000)
30 55c55
31 < AUTOACTIVATION = False
32 ---
33 > AUTOACTIVATION = True
34 ''')
35 clm_config.close()
36 
37 # Definvncvncve actions
38 actions = []
39 
40 actions.append({'type': 'exec',
41  'command': 'scp',
42  'args': ['-i',
43  '%s/id_test' % SERVICES_TMP,
44  '%s/clm.config.diff' % SERVICES_TMP,
45  'root@%s:/tmp/' % clm_net_wi_clm]})
46 actions.append({'type': 'exec',
47  'command': 'ssh',
48  'args': ['-i',
49  '%s/id_test' % SERVICES_TMP,
50  'root@%s' % clm_net_wi_clm,
51  'patch /etc/cc1/clm/settings.py < /tmp/clm.config.diff']})
52 actions.append({'type': 'exec',
53  'command': 'ssh',
54  'args': ['-i',
55  '%s/id_test' % SERVICES_TMP,
56  'root@%s' % clm_net_wi_clm,
57  '/etc/init.d/cc1-clm restart']})
58