You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.2 KiB

  1. # -*- coding: utf-8 -*-
  2. import os
  3. from odoo.addons.galicea_environment_checkup import \
  4. custom_check, CheckWarning, CheckSuccess, CheckFail
  5. from odoo import http
  6. @custom_check
  7. def check_single_db(env):
  8. if not http.request:
  9. raise CheckWarning('Could not detect DB settings.')
  10. dbs = http.db_list(True, http.request.httprequest)
  11. if len(dbs) == 1:
  12. return CheckSuccess('Odoo runs in a single-DB mode.')
  13. details = (
  14. '<p>Odoo runs in a multi-DB mode, which will cause Git HTTP requests to fail.</p>'
  15. '<p>Run Odoo with <tt>--dbfilter</tt> or <tt>--database</tt> flag.</p>'
  16. )
  17. return CheckFail(
  18. 'Odoo runs in a multi-DB mode.',
  19. details=details
  20. )
  21. @custom_check
  22. def check_http_backend(env):
  23. backend_path = env['ir.config_parameter'].sudo().get_param(
  24. 'galicea_git.git_http_backend'
  25. )
  26. if not os.access(backend_path, os.X_OK):
  27. raise CheckFail(
  28. 'Git HTTP backend not found',
  29. details='<a href="http://galicea.mw-odoo:8080/web#action=galicea_git.config_settings_action">Check the configuration here</a>'
  30. )
  31. return CheckSuccess('Git HTTP backend was found')