Skip to content

Commit

Permalink
[IMP] Add try-except on branch analyze action (OCA#26)
Browse files Browse the repository at this point in the history
* [IMP] Add try-except on branch analyze action

Add try-except statements on analyze actions that could
potentially crash the analyze process.

* [REF] Fix error logging

Changes include:
 - fix error values
 - use error instead of warning

* [IMP] Fix error in analyze call

Fix a programming mistake in the analyze call.
By @RoelAdriaans

* [IMP] Bump version number of github_connector

Bump the version number of github_connector to '11.0.1.1.1'.

* [IMP] Bump version number of github_connector

Bump the version number of github_connector_odoo to
'11.0.1.1.1'.
  • Loading branch information
StephanRozendaal authored and carolinafernandez-tecnativa committed Mar 7, 2024
1 parent 59096a0 commit 41e7a56
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion github_connector_odoo/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
'name': 'Github Connector - Odoo',
'summary': 'Analyze Odoo modules information from Github repositories',
'version': '11.0.1.1.0',
'version': '11.0.1.1.1',
'category': 'Connector',
'license': 'AGPL-3',
'author': 'Odoo Community Association (OCA), Sylvain LE GAL, GRAP',
Expand Down
27 changes: 17 additions & 10 deletions github_connector_odoo/models/github_repository_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,7 @@ def analyze_code_one(self, branch):
# Analyze folders and create module versions
_logger.info("Analyzing repository %s ..." % path)
for module_name in self.listdir(path):
full_module_path = os.path.join(path, module_name)
module_info = load_information_from_description_file(
module_name, full_module_path)

# Create module version, if the module is installable
# in the serie
if module_info.get('installable', False):
module_info['technical_name'] = module_name
module_version_obj.create_or_update_from_manifest(
module_info, branch, full_module_path)
self._analyze_module_name(path, module_name, branch)
finally:
# Reset Original level for module logger
logger1.setLevel(currentLevel1)
Expand All @@ -141,3 +132,19 @@ def is_really_module(name):
return True

return map(clean, filter(is_really_module, os.listdir(dir)))

def _analyze_module_name(self, path, module_name, branch):
module_version_obj = self.env['odoo.module.version']
try:
full_module_path = os.path.join(path, module_name)
module_info = load_information_from_description_file(
module_name, full_module_path)
# Create module version, if the module is installable
# in the serie
if module_info.get('installable', False):
module_info['technical_name'] = module_name
module_version_obj.create_or_update_from_manifest(
module_info, branch, full_module_path)
except Exception as e:
_logger.error('Cannot process module with name %s, error '
'is: %s' % (module_name, e))

0 comments on commit 41e7a56

Please sign in to comment.