Merge lp:~cv.clearcorp/oerptools/oerptools into lp:oerptools
- oerptools
- Merge into 2.0
Proposed by
Carlos Vásquez (ClearCorp)
Status: | Merged |
---|---|
Merged at revision: | 428 |
Proposed branch: | lp:~cv.clearcorp/oerptools/oerptools |
Merge into: | lp:oerptools |
Diff against target: |
683 lines (+99/-105) 2 files modified
oerptools/lib/apache.py (+4/-7) oerptools/oerp/server.py (+95/-98) |
To merge this branch: | bzr merge lp:~cv.clearcorp/oerptools/oerptools |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ClearCorp drivers | Pending | ||
Review via email:
|
Commit message
[FIX] default.conf was change by 000-default.conf in apache2 updates
Description of the change
default.conf was change by 000-default.conf in apache2 updates
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'oerptools/lib/apache.py' |
2 | --- oerptools/lib/apache.py 2014-02-17 18:02:21 +0000 |
3 | +++ oerptools/lib/apache.py 2014-04-14 22:23:09 +0000 |
4 | @@ -16,7 +16,7 @@ |
5 | # Affero General Public License for more details. |
6 | # |
7 | # You should have received a copy of the GNU Affero General Public |
8 | -# License along with this program. If not, see |
9 | +# License along with this program. If not, see |
10 | # <http://www.gnu.org/licenses/>. |
11 | # |
12 | ######################################################################## |
13 | @@ -34,16 +34,13 @@ |
14 | def apache_install(): |
15 | os_version = tools.get_os() |
16 | if os_version['os'] == 'Linux': |
17 | - string = '' |
18 | if (os_version['version'][0] == 'Ubuntu') or (os_version['version'][0] == 'LinuxMint'): |
19 | - if os_version['version'][0] == 'LinuxMint': |
20 | - string = '000-' |
21 | - return ubuntu_apache_install(string) |
22 | + return ubuntu_apache_install() |
23 | elif os_version['version'][0] == 'arch': |
24 | return arch_apache_install() |
25 | return False |
26 | |
27 | -def ubuntu_apache_install(string): |
28 | +def ubuntu_apache_install(): |
29 | _logger.info('Installing Apache web server') |
30 | if not tools.ubuntu_install_package(['apache2']): |
31 | _logger.error('Failed to install apache package. Exiting.') |
32 | @@ -59,7 +56,7 @@ |
33 | if tools.exec_command('a2enmod ssl rewrite suexec include proxy proxy_http proxy_connect proxy_ftp headers', as_root=True): |
34 | _logger.error('Failed to enable Apache modules. Exiting.') |
35 | return False |
36 | - if tools.exec_command('a2ensite '+string+'default default-ssl', as_root=True): |
37 | + if tools.exec_command('a2ensite 000-default default-ssl', as_root=True): |
38 | _logger.error('Failed to enable Apache sites. Exiting.') |
39 | return False |
40 | if tools.exec_command('/etc/init.d/apache2 restart', as_root=True): |
41 | |
42 | === modified file 'oerptools/oerp/server.py' |
43 | --- oerptools/oerp/server.py 2014-02-17 18:02:21 +0000 |
44 | +++ oerptools/oerp/server.py 2014-04-14 22:23:09 +0000 |
45 | @@ -16,7 +16,7 @@ |
46 | # Affero General Public License for more details. |
47 | # |
48 | # You should have received a copy of the GNU Affero General Public |
49 | -# License along with this program. If not, see |
50 | +# License along with this program. If not, see |
51 | # <http://www.gnu.org/licenses/>. |
52 | # |
53 | ######################################################################## |
54 | @@ -45,7 +45,7 @@ |
55 | self._postgresql_version = '9.1' |
56 | elif self._os_info['os'] == 'Linux' and self._os_info['version'][0] == 'arch': |
57 | self._postgresql_version = '9.1' |
58 | - |
59 | + |
60 | if instance: |
61 | _logger.debug('Server initialized with instance: %s' % instance) |
62 | _logger.debug('Branch: %s' % instance._branch) |
63 | @@ -55,53 +55,53 @@ |
64 | self._branch = config.params['branch'] or '7.0' |
65 | self._installation_type = config.params[self._branch+'_installation_type'] or config.params['installation_type'] or 'dev' |
66 | self._user = config.params[self._branch+'_user'] or config.params['user'] or None |
67 | - |
68 | + |
69 | if 'install_openobject_addons' in config.params: |
70 | self._install_openobject_addons = config.params['install_openobject_addons'] |
71 | elif self._branch+'_install_openobject_addons' in config.params: |
72 | self._install_openobject_addons = config.params[self._branch+'_install_openobject_addons'] |
73 | else: |
74 | - self._install_openobject_addons = True |
75 | - |
76 | + self._install_openobject_addons = True |
77 | + |
78 | if 'install_openerp_ccorp_addons' in config.params: |
79 | self._install_openerp_ccorp_addons = config.params['install_openerp_ccorp_addons'] |
80 | elif self._branch+'_install_openerp_ccorp_addons' in config.params: |
81 | self._install_openerp_ccorp_addons = config.params[self._branch+'_install_openerp_ccorp_addons'] |
82 | else: |
83 | self._install_openerp_ccorp_addons = True |
84 | - |
85 | + |
86 | if 'install_openerp_costa_rica' in config.params: |
87 | self._install_openerp_costa_rica = config.params['install_openerp_costa_rica'] |
88 | elif self._branch+'_install_openerp_costa_rica' in config.params: |
89 | self._install_openerp_costa_rica = config.params[self._branch+'_install_openerp_costa_rica'] |
90 | else: |
91 | self._install_openerp_costa_rica = True |
92 | - |
93 | + |
94 | if self._branch+'_update_postgres_hba' in config.params: |
95 | self._update_postgres_hba = config.params[self._branch+'_update_postgres_hba'] |
96 | elif 'update_postgres_hba' in config.params: |
97 | self._update_postgres_hba = config.params['update_postgres_hba'] |
98 | else: |
99 | self._update_postgres_hba = True |
100 | - |
101 | + |
102 | if self._branch+'_create_postgres_user' in config.params: |
103 | self._create_postgres_user = config.params[self._branch+'_create_postgres_user'] |
104 | elif 'create_postgres_user' in config.params: |
105 | self._create_postgres_user = config.params['create_postgres_user'] |
106 | else: |
107 | self._create_postgres_user = True |
108 | - |
109 | + |
110 | if self._branch+'_install_apache' in config.params: |
111 | self._install_apache = config.params[self._branch+'_install_apache'] |
112 | elif 'install_apache' in config.params: |
113 | self._install_apache = config.params['install_apache'] |
114 | else: |
115 | self._install_apache = True |
116 | - |
117 | + |
118 | self._admin_password = config.params[self._branch+'_admin_password'] or config.params['admin_password'] or None |
119 | self._postgresql_password = config.params[self._branch+'_postgresql_password'] or config.params['postgresql_password'] or None |
120 | return super(oerpServer, self).__init__() |
121 | - |
122 | + |
123 | def _add_openerp_user(self): |
124 | try: |
125 | group = grp.getgrnam('openerp') |
126 | @@ -112,7 +112,7 @@ |
127 | group = False |
128 | else: |
129 | _logger.debug('openerp group already exists.') |
130 | - |
131 | + |
132 | try: |
133 | pw = pwd.getpwnam(self._user) |
134 | except: |
135 | @@ -121,9 +121,9 @@ |
136 | else: |
137 | _logger.info('User %s already exists, adding to openerp group.' % self._user) |
138 | tools.exec_command('adduser %s openerp' % self._user, as_root=True) |
139 | - |
140 | + |
141 | return True |
142 | - |
143 | + |
144 | def get_packages_distro_match(self, distro): |
145 | match = { |
146 | 'ubuntu': { |
147 | @@ -170,7 +170,7 @@ |
148 | 'tinymce': 'tinymce', |
149 | 'wget': 'wget', |
150 | }, |
151 | - |
152 | + |
153 | 'arch': { |
154 | 'repo': { |
155 | 'ghostscript': 'ghostscript', |
156 | @@ -201,7 +201,7 @@ |
157 | 'python-reportlab': 'python2-reportlab', |
158 | 'python-setuptools': 'python2-distribute', |
159 | 'python-simplejson': 'python2-simplejson', |
160 | - 'python-tz': 'python2-pytz', |
161 | + 'python-tz': 'python2-pytz', |
162 | 'python-vobject': 'python2-vobject', |
163 | 'python-werkzeug': 'python2-werkzeug', |
164 | 'python-yaml': 'python2-yaml', |
165 | @@ -220,21 +220,21 @@ |
166 | } |
167 | } |
168 | } |
169 | - |
170 | + |
171 | if distro in match: |
172 | return match[distro] |
173 | else: |
174 | return False |
175 | - |
176 | + |
177 | def _install_python_libs(self): |
178 | _logger.info('Installing the required packages and python libraries for OpenERP.') |
179 | - |
180 | + |
181 | packages = [] |
182 | - |
183 | + |
184 | # Packages need by the installer |
185 | packages.append('python-setuptools') |
186 | packages.append('wget') |
187 | - |
188 | + |
189 | # Packages for 6.1 |
190 | if self._branch == '6.1': |
191 | packages += [ |
192 | @@ -277,7 +277,7 @@ |
193 | 'python-pyparsing', |
194 | # Recommended |
195 | ] |
196 | - |
197 | + |
198 | # Packages for 7.0 |
199 | if self._branch == '7.0' or self._branch == 'trunk': |
200 | packages += [ |
201 | @@ -310,14 +310,14 @@ |
202 | 'python-xlwt', #Excel spreadsheets |
203 | 'python-yaml', |
204 | 'python-zsi', |
205 | - |
206 | + |
207 | # Recomended |
208 | 'graphviz', |
209 | 'ghostscript', |
210 | 'python-imaging', |
211 | 'python-matplotlib', |
212 | ] |
213 | - |
214 | + |
215 | # Test distro and call appropriate function |
216 | if self._os_info and self._os_info['os'] == 'Linux': |
217 | if (self._os_info['version'][0] == 'Ubuntu') or (self._os_info['version'][0] == 'LinuxMint'): |
218 | @@ -326,11 +326,11 @@ |
219 | return self._arch_install_python_libs(packages) |
220 | _logger.error('Can\'t install python libraries in this OS: %s. Exiting.' % self._os_info['version'][0]) |
221 | return False |
222 | - |
223 | + |
224 | def _ubuntu_install_python_libs(self, packages): |
225 | #Initialize packages match |
226 | distro_match_packages = self.get_packages_distro_match('ubuntu') |
227 | - |
228 | + |
229 | #Build definitive package list |
230 | distro_packages = [] |
231 | for package in packages: |
232 | @@ -342,14 +342,14 @@ |
233 | _logger.warning('No installable package for %s in Ubuntu. Please install it manually.' % package) |
234 | else: |
235 | _logger.warning('Package unknown: %s. Exiting.' % package) |
236 | - |
237 | + |
238 | # Install packages |
239 | return tools.ubuntu_install_package(distro_packages) |
240 | - |
241 | + |
242 | def _arch_install_python_libs(self, packages): |
243 | #Initialize packages match |
244 | distro_match_packages = self.get_packages_distro_match('arch') |
245 | - |
246 | + |
247 | #Build definitive package list |
248 | distro_packages = [] |
249 | aur_packages = [] |
250 | @@ -368,7 +368,7 @@ |
251 | _logger.warning('No installable package for %s in Arch. Please install it manually.' % package) |
252 | else: |
253 | _logger.warning('Package unknown: %s. Exiting.' % package) |
254 | - |
255 | + |
256 | # Install packages |
257 | _logger.info('Installing packages with pacman.') |
258 | _logger.debug('Packages: %s' % str(distro_packages)) |
259 | @@ -376,15 +376,15 @@ |
260 | if not tools.arch_install_repo_package(distro_packages): |
261 | _logger.warning('Failed to install some repo packages. This can render the OpenERP installation unusable.') |
262 | error = True |
263 | - |
264 | + |
265 | _logger.info('Installing packages from AUR.') |
266 | _logger.debug('Packages: %s' % str(aur_packages)) |
267 | if not tools.arch_install_repo_package(aur_packages): |
268 | _logger.warning('Failed to install some AUR packages. This can render the OpenERP installation unusable.') |
269 | error = True |
270 | - |
271 | + |
272 | return not error |
273 | - |
274 | + |
275 | def _install_postgresql(self): |
276 | _logger.info('Installing PostgreSQL.') |
277 | # Test distro and call appropriate function |
278 | @@ -395,16 +395,16 @@ |
279 | return self._arch_install_postgresql() |
280 | _logger.error('Can\'t install python libraries in this OS: %s. Exiting.' % self._os_info['version'][0]) |
281 | return False |
282 | - |
283 | + |
284 | def _ubuntu_install_postgresql(self): |
285 | return tools.ubuntu_install_package(['postgresql']) |
286 | - |
287 | + |
288 | def _arch_install_postgresql(self): |
289 | #TODO: change some of this calls with a python way to do it (because of perms) |
290 | if os.path.isdir('/var/lib/postgres/data'): |
291 | _logger.info('PostgreSQL appears to be already configured. Skipping.') |
292 | return False |
293 | - |
294 | + |
295 | if tools.arch_install_package(['postgresql']): |
296 | _logger.error('Failed to install PostgreSQL. Exiting.') |
297 | return False |
298 | @@ -427,7 +427,7 @@ |
299 | _logger.error('Failed to start PostgreSQL. Exiting.') |
300 | return False |
301 | return True |
302 | - |
303 | + |
304 | def _do_update_postgres_hba(self): |
305 | _logger.info('Updating PostgreSQL pg_hba.conf file.') |
306 | # Test distro and call appropriate function |
307 | @@ -438,7 +438,7 @@ |
308 | return self._arch_do_update_postgres_hba() |
309 | _logger.error('Can\'t update PostgreSQL pg_hba.conf in this OS: %s. Exiting.' % self._os_info['version'][0]) |
310 | return False |
311 | - |
312 | + |
313 | def _ubuntu_do_update_postgres_hba(self): |
314 | #TODO: change sed command with python lib to do the change (be carefull with the user perms) |
315 | if tools.exec_command("sed -i 's/\(local[[:space:]]*all[[:space:]]*all[[:space:]]*\)\(ident[[:space:]]*sameuser\)/\1md5/g' /etc/postgresql/%s/main/pg_hba.conf" % self._postgresql_version, as_root=True): |
316 | @@ -448,7 +448,7 @@ |
317 | _logger.error('Failed to start PostgreSQL. Exiting.') |
318 | return False |
319 | return True |
320 | - |
321 | + |
322 | def _arch_do_update_postgres_hba(self): |
323 | #TODO: lp:1133383 change sed command with python lib to do the change (be carefull with the user perms) |
324 | #if tools.exec_command("sed -i 's/\(local[[:space:]]*all[[:space:]]*all[[:space:]]*\)\(ident[[:space:]]*sameuser\)/\1md5/g' /etc/postgresql/%s/main/pg_hba.conf" % self._postgresql_version, as_root=True): |
325 | @@ -458,7 +458,7 @@ |
326 | # _logger.error('Failed to start PostgreSQL. Exiting.') |
327 | # return False |
328 | return True |
329 | - |
330 | + |
331 | def _add_postgresql_user(self): |
332 | _logger.info('Adding PostgreSQL user: %s.' % self._user) |
333 | if tools.exec_command('sudo -u postgres createuser %s --superuser --createdb --no-createrole' % self._user): |
334 | @@ -468,14 +468,14 @@ |
335 | _logger.error('Failed to set PostgreSQL user password. Exiting.') |
336 | return False |
337 | return True |
338 | - |
339 | + |
340 | def _change_postgresql_admin_password(self): |
341 | _logger.info('Changing PostgreSQL admin password.') |
342 | if tools.exec_command('sudo -u postgres psql template1 -U postgres -c "alter user postgres with password \'%s\'"' % self._postgresql_password): |
343 | _logger.error('Failed to set PostgreSQL admin password. Exiting.') |
344 | return False |
345 | return True |
346 | - |
347 | + |
348 | def change_perms(self): |
349 | _logger.debug('User: %s' % self._user) |
350 | if os.path.isdir('/srv/openerp'): |
351 | @@ -496,15 +496,15 @@ |
352 | if os.path.isdir('/etc/openerp'): |
353 | if tools.exec_command('chown -R %s:openerp /etc/openerp' % self._user, as_root=True): |
354 | _logger.warning('Failed to set /etc/openerp owner. Skipping.') |
355 | - |
356 | + |
357 | return True |
358 | - |
359 | + |
360 | def _download_openerp_repo(self): |
361 | bzr.bzr_initialize() |
362 | if os.path.isdir('/srv/openerp'): |
363 | _logger.warning('/srv/openerp already exists. Not downloading repo.') |
364 | return False |
365 | - |
366 | + |
367 | _logger.info('Downloading latest OpenERP bzr repository.') |
368 | temp_dir = tempfile.mkdtemp(suffix='-oerptools') |
369 | if tools.exec_command('mkdir -p /usr/local/src/oerptools/oerp', as_root=True): |
370 | @@ -522,25 +522,25 @@ |
371 | return False |
372 | else: |
373 | _logger.info('Repo file already exists, skipping download.') |
374 | - |
375 | + |
376 | os.chdir('/srv') |
377 | if tools.exec_command('tar xzf /usr/local/src/oerptools/oerp/openerp.tgz', as_root=True): |
378 | _logger.error('Failed to extract repo tgz file. Exiting.') |
379 | return False |
380 | if os.path.exists('/srv/openerp/.bzr/repository/no-working-trees'): |
381 | os.remove('/srv/openerp/.bzr/repository/no-working-trees') |
382 | - |
383 | + |
384 | os.chdir(cwd) |
385 | return True |
386 | - |
387 | + |
388 | def _download_openerp_lp_branch(self, repo_downloaded, name, lp_project, lp_branch): |
389 | bzr.bzr_initialize() |
390 | _logger.info('Downloading %s latest %s release.' % (name, self._branch)) |
391 | - |
392 | + |
393 | if tools.exec_command('mkdir -p /srv/openerp/%s/src' % self._branch): |
394 | _logger.error('Failed to make branch directory. Exiting.') |
395 | return False |
396 | - |
397 | + |
398 | if os.path.exists('/srv/openerp/%s/src/%s' % (self._branch, name)): |
399 | _logger.info('%s/%s exists. Updating.' % (name, self._branch)) |
400 | bzr.bzr_pull('/srv/openerp/%s/src/%s' % (self._branch, name)) |
401 | @@ -563,7 +563,7 @@ |
402 | bzr.bzr_set_parent('/srv/openerp/%s/src/%s' % (self._branch, name), 'http://bazaar.launchpad.net/~clearcorp-drivers/%s/%s' % (lp_project, lp_branch)) |
403 | bzr.bzr_pull('/srv/openerp/%s/src/%s' % (self._branch, name)) |
404 | return True |
405 | - |
406 | + |
407 | def _download_other_lp_branch(self, name, lp_project, lp_branch): |
408 | bzr.bzr_initialize() |
409 | _logger.info('Downloading %s latest %s release.' % (name, self._branch)) |
410 | @@ -576,7 +576,7 @@ |
411 | else: |
412 | bzr.bzr_branch('lp:%s/%s' % (lp_project, lp_branch), '/srv/openerp/%s/src/%s' % (self._branch, name)) |
413 | return True |
414 | - |
415 | + |
416 | def _download_openerp(self, modules_to_install): |
417 | _logger.info('Downloading latest OpenERP %s release.' % self._branch) |
418 | if os.path.isdir('/srv/openerp'): |
419 | @@ -584,9 +584,9 @@ |
420 | repo_downloaded = True |
421 | else: |
422 | repo_downloaded = self._download_openerp_repo() |
423 | - |
424 | + |
425 | self.change_perms() |
426 | - |
427 | + |
428 | self._download_openerp_lp_branch(repo_downloaded, 'openobject-server', 'openobject-server', '%s-ccorp' % self._branch) |
429 | self._download_openerp_lp_branch(repo_downloaded, 'openerp-web', 'openerp-web', '%s-ccorp' % self._branch) |
430 | if 'openobject-addons' in modules_to_install and modules_to_install['openobject-addons']: |
431 | @@ -597,11 +597,11 @@ |
432 | self._download_other_lp_branch('openerp-costa-rica', 'openerp-costa-rica', '%s' % self._branch) |
433 | self.change_perms() |
434 | return True |
435 | - |
436 | + |
437 | def _config_openerp_version(self): |
438 | _logger.info('Configuring OpenERP %s' % self._branch) |
439 | cwd = os.getcwd() |
440 | - |
441 | + |
442 | # OpenERP Server bin |
443 | _logger.debug('Copy bin script skeleton to /etc') |
444 | if tools.exec_command('mkdir -p /etc/openerp/%s/server/' % self._branch, as_root=True): |
445 | @@ -613,7 +613,7 @@ |
446 | if tools.exec_command('sed -i "s#@BRANCH@#%s#g" /etc/openerp/%s/server/bin-skeleton' % (self._branch, self._branch), as_root=True): |
447 | _logger.error('Failed to config bin skeleton. Exiting.') |
448 | return False |
449 | - |
450 | + |
451 | # OpenERP Server init |
452 | if tools.exec_command('cp %s/oerptools/oerp/static/init/server-init-%s-skeleton /etc/openerp/%s/server/init-skeleton' % (config.params['oerptools_path'], self._branch, self._branch), as_root=True): |
453 | _logger.error('Failed to copy init skeleton. Exiting.') |
454 | @@ -650,26 +650,23 @@ |
455 | if tools.exec_command('sed -i "s#@INTERFACE@#localhost#g" /etc/openerp/%s/server/conf-skeleton' % self._branch, as_root=True): |
456 | _logger.error('Failed to set interface in config skeleton. Exiting.') |
457 | return False |
458 | - |
459 | + |
460 | if tools.exec_command('mkdir -p /var/run/openerp', as_root=True): |
461 | _logger.error('Failed to create /var/run/openerp. Exiting.') |
462 | return False |
463 | - |
464 | + |
465 | return True |
466 | |
467 | def _do_install_apache(self): |
468 | os_version = tools.get_os() |
469 | if os_version['os'] == 'Linux': |
470 | - string = '' |
471 | if (os_version['version'][0] == 'Ubuntu') or (os_version['version'][0] == 'LinuxMint'): |
472 | - if os_version['version'][0] == 'LinuxMint': |
473 | - string = '000-' |
474 | - return self._ubuntu_do_install_apache(string) |
475 | + return self._ubuntu_do_install_apache() |
476 | elif os_version['version'][0] == 'arch': |
477 | return self._arch_do_install_apache() |
478 | return False |
479 | - |
480 | - def _ubuntu_do_install_apache(self, string): |
481 | + |
482 | + def _ubuntu_do_install_apache(self): |
483 | if not apache.apache_install(): |
484 | _logger.error('Failed to install Apache. Exiting.') |
485 | return False |
486 | @@ -687,7 +684,7 @@ |
487 | if not apache.apache_restart(): |
488 | _logger.warning('Failed restart Apache.') |
489 | return True |
490 | - |
491 | + |
492 | def _arch_do_install_apache(self): |
493 | if not apache.apache_install(): |
494 | _logger.error('Failed to install Apache. Exiting.') |
495 | @@ -707,20 +704,20 @@ |
496 | if apache.apache_restart(): |
497 | _logger.warning('Failed restart Apache.') |
498 | return True |
499 | - |
500 | + |
501 | def _set_logrotation(self): |
502 | if tools.exec_command('cp %s/oerptools/oerp/static/log/openerp.logrotate /etc/logrotate.d/' % config.params['oerptools_path'], as_root=True): |
503 | _logger.error('Failed to copy logrotate. Exiting.') |
504 | return False |
505 | return True |
506 | - |
507 | + |
508 | def install(self): |
509 | _logger.info('OpenERP server installation started.') |
510 | - |
511 | + |
512 | _logger.info('') |
513 | _logger.info('Please check the following information before continuing.') |
514 | _logger.info('=========================================================') |
515 | - |
516 | + |
517 | _logger.info('') |
518 | _logger.info('System info') |
519 | _logger.info('-----------') |
520 | @@ -731,16 +728,16 @@ |
521 | _logger.warning('FQDN unknown, he hostname may not be properly set.') |
522 | else: |
523 | _logger.info('FQDN: %s' % hostname[1]) |
524 | - |
525 | + |
526 | _logger.info('Time and date: %s' % datetime.datetime.today().strftime('%Y/%m/%d %H:%M:%S')) |
527 | #TODO: lp:1133388 list installed and default locale |
528 | - |
529 | + |
530 | _logger.info('') |
531 | _logger.info('Installation info') |
532 | _logger.info('-----------------') |
533 | - |
534 | + |
535 | _logger.info('OpenERP version (branch) to install: %s' % self._branch) |
536 | - |
537 | + |
538 | if self._installation_type == 'dev': |
539 | _logger.info('Installation type: development station') |
540 | elif self._installation_type == 'server': |
541 | @@ -748,7 +745,7 @@ |
542 | else: |
543 | _logger.error('Installation type unknown: %s' % self._installation_type) |
544 | return False |
545 | - |
546 | + |
547 | if self._installation_type == 'dev': |
548 | if not self._user: |
549 | self._user = pwd.getpwuid(os.getuid()).pw_name |
550 | @@ -765,10 +762,10 @@ |
551 | return False |
552 | else: |
553 | _logger.info('User: %s' % self._user) |
554 | - |
555 | + |
556 | elif not self._user and self._installation_type == 'server': |
557 | self._user = 'openerp' |
558 | - |
559 | + |
560 | if not self._user: |
561 | _logger.error('User unknown. Exiting.') |
562 | return False |
563 | @@ -781,11 +778,11 @@ |
564 | except: |
565 | _logger.error('Your user must be the user of installation (%s), root, or be part of openerp group. Exiting.') |
566 | return False |
567 | - |
568 | + |
569 | _logger.info('') |
570 | _logger.info('Addons installation:') |
571 | _logger.info('--------------------') |
572 | - |
573 | + |
574 | if self._install_openobject_addons: |
575 | _logger.info('Install openobject-addons: YES') |
576 | else: |
577 | @@ -798,7 +795,7 @@ |
578 | _logger.info('Install openerp-costa-rica: YES') |
579 | else: |
580 | _logger.info('Install openerp-costa-rica: NO') |
581 | - |
582 | + |
583 | _logger.info('') |
584 | _logger.info('Please review the values above and confirm accordingly.') |
585 | answer = False |
586 | @@ -812,7 +809,7 @@ |
587 | return False |
588 | else: |
589 | answer = False |
590 | - |
591 | + |
592 | _logger.info('Setting the OpenERP admin password.') |
593 | # Get admin password |
594 | while not self._admin_password: |
595 | @@ -820,7 +817,7 @@ |
596 | if not self._admin_password == getpass.getpass('Confirm OpenERP admin password: '): |
597 | _logger.error('Passwords don\'t match. Try again.') |
598 | self._admin_password = False |
599 | - |
600 | + |
601 | _logger.info('Setting the PostgreSQL admin password.') |
602 | # Set postgres admin password |
603 | if not self._postgresql_password and self._installation_type == 'dev': |
604 | @@ -841,7 +838,7 @@ |
605 | if not self._postgresql_password == getpass.getpass('Confirm PostgreSQL\'s admin password: '): |
606 | _logger.error('Passwords don\'t match. Try again.') |
607 | self._postgresql_password = False |
608 | - |
609 | + |
610 | #Update config file with new values |
611 | values = { |
612 | 'oerp-install': { |
613 | @@ -854,55 +851,55 @@ |
614 | self._branch+'_postgresql_password': self._postgresql_password, |
615 | }, |
616 | } |
617 | - |
618 | + |
619 | config_file_path = config.params.update_config_file_values(values) |
620 | if config_file_path: |
621 | _logger.info('Updated config file with installation values: %s' % config_file_path) |
622 | else: |
623 | _logger.warning('Failed to update config file with installation values.') |
624 | - |
625 | - |
626 | + |
627 | + |
628 | # Preparing installation |
629 | _logger.info('') |
630 | _logger.info('Preparing OpenERP installation') |
631 | _logger.info('==============================') |
632 | _logger.info('') |
633 | - |
634 | + |
635 | self._add_openerp_user() |
636 | self._install_python_libs() |
637 | - |
638 | + |
639 | if not bzr.bzr_install(): |
640 | _logger.error('Failed to install bzr (Bazaar VCS). Exiting.') |
641 | return False |
642 | - |
643 | + |
644 | if not self._install_postgresql(): |
645 | _logger.error('Failed to install PostgreSQL. Exiting.') |
646 | return False |
647 | - |
648 | + |
649 | if self._update_postgres_hba: |
650 | self._do_update_postgres_hba() |
651 | - |
652 | + |
653 | if self._create_postgres_user: |
654 | self._add_postgresql_user() |
655 | - |
656 | + |
657 | if self._postgresql_password: |
658 | self._change_postgresql_admin_password() |
659 | - |
660 | + |
661 | modules_to_install = { |
662 | 'openobject-addons': self._install_openobject_addons, |
663 | 'openerp-ccorp-addons': self._install_openerp_ccorp_addons, |
664 | 'openerp-costa-rica': self._install_openerp_costa_rica, |
665 | } |
666 | self._download_openerp(modules_to_install) |
667 | - |
668 | + |
669 | self._config_openerp_version() |
670 | - |
671 | + |
672 | self.change_perms() |
673 | - |
674 | + |
675 | if self._install_apache: |
676 | self._do_install_apache() |
677 | phppgadmin.phppgadmin_install() |
678 | - |
679 | + |
680 | self._set_logrotation() |
681 | - |
682 | + |
683 | return True |