cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
s004_configure_wi.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 wi_config = open('%s/wi.config.diff' % SERVICES_TMP, 'w')
26 wi_config.write('''
27 12c12
28 < CLOUD_MANAGER_ADDRESS = 'http://127.0.0.1:8000'
29 ---
30 > CLOUD_MANAGER_ADDRESS = 'http://%(CLM_ADDRESS)s:8000'
31 25c25
32 < DEBUG = False
33 ---
34 > DEBUG = True
35 28c28
36 < CAPTCHA = True
37 ---
38 > CAPTCHA = False
39 ''' % {'VERSION': SYSTEM_VERSION,
40  'CLM_ADDRESS': clm_net_wi_clm})
41 wi_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/wi.config.diff' % SERVICES_TMP,
51  'root@%s:/tmp/' % wi_net_wi_clm]})
52 actions.append({'type': 'exec',
53  'command': 'ssh',
54  'args': ['-i',
55  '%s/id_test' % SERVICES_TMP,
56  'root@%s' % wi_net_wi_clm,
57  'patch /etc/cc1/wi/settings.py < /tmp/wi.config.diff']})
58 actions.append({'type': 'exec',
59  'command': 'ssh',
60  'args': ['-i',
61  '%s/id_test' % SERVICES_TMP,
62  'root@%s' % wi_net_wi_clm,
63  '/etc/init.d/apache2 restart']})
64