Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/util/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"__modules_to_skip_autoinstall": set(),
"__fix_fk_allowed_cascade": [],
"__no_model_data_delete": {},
"__force_installed_modules": set(),
}

NEARLYWARN = 25 # between info and warning; appear on runbot build page
Expand Down
12 changes: 12 additions & 0 deletions src/util/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ def module_installed(cr, module):
return modules_installed(cr, module)


def module_force_installed(cr, module):
"""
Return whether a module was marked for force installation.

:param str module: name of the module to check
:rtype: bool
"""
return module in ENVIRON["__force_installed_modules"] and module_installed(cr, module)


@_warn_usage_outside_base
def uninstall_module(cr, module):
"""
Expand Down Expand Up @@ -666,6 +676,8 @@ def _force_install_module(cr, module, if_installed=None, reason="it has been exp
states = dict(cr.fetchall())
toinstall = [m for m in states if states[m] == "to install"]

ENVIRON["__force_installed_modules"].update(toinstall)

if module in toinstall:
Comment on lines +679 to 681
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we track the module only if it has actually been marked as "to install"?

Suggested change
ENVIRON["__force_installed_modules"].update(toinstall)
if module in toinstall:
if module in toinstall:
ENVIRON["__force_installed_modules"].update(toinstall)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the toinstall list is a result of the previous query which set the state of the module and its dependencies. doesnt this mean they are actually marked as to install?

_logger.info(
"force install of module %r (and its dependencies) because %s%s",
Expand Down