Skip to content
Snippets Groups Projects
Commit 8be72e2a authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:ambulance: Fix reading odoo_type when using expansion.

parent ef395bd8
No related branches found
No related tags found
1 merge request!24Fix odoo type expanded
......@@ -13,6 +13,8 @@
Fix reading configuration value in python 2.7.
Fix reading odoo_type when using expansion.
7.0.3
-----
......
......@@ -64,7 +64,9 @@
if blacklist and re.match(blacklist, value["path"]):
_logger.info(
"Ignoring directory '%s' due to blacklisting",
value["path"],
os.path.join(path, value["path"])
if path
else value["path"],
)
else:
if path:
......@@ -125,9 +127,7 @@
for key in ("db_user", "db_password", "load-language"):
setattr(self, key_format(key), section.get(key, None))
def read_expanded(
key: str, default_value=None, always_set: bool = False
):
def read_expanded(key: str, default_value=None):
"""Read from local version, or from expanded if value is found.
Raise an exception if more than one value is found."""
value = default_value
......@@ -155,9 +155,9 @@
" with different values" % key
)
value = local_value
if toread(key) or always_set:
if toread(key):
setattr(self, key, value)
self.registry = section.get("registry", "registry.xcg.io")
project_path = os.path.realpath(".")
self.image = section.get("image", os.path.basename(project_path))
......@@ -159,13 +159,18 @@
setattr(self, key, value)
self.registry = section.get("registry", "registry.xcg.io")
project_path = os.path.realpath(".")
self.image = section.get("image", os.path.basename(project_path))
read_expanded("odoo_type", "odoo7", always_set=True)
if self.odoo_type not in (
read_expanded("odoo_type", "odoo7")
if not hasattr(self, "odoo_type"):
# if path is set, odoo_type might not be in the values to read
# so no message
if not path:
_logger.warning("Missing odoo_type")
elif self.odoo_type not in (
"odoo7",
"odoo8",
"odoo10",
"odoo11",
"odoo13",
):
......@@ -166,11 +171,17 @@
"odoo7",
"odoo8",
"odoo10",
"odoo11",
"odoo13",
):
_logger.warning("Unexpected odoo_type: %s", self.odoo_type)
read_expanded("postgresql_version", "9.6")
if path:
_logger.info(
"Unexpected odoo_type: %s in %s",
(self.odoo_type, self.path),
)
else:
_logger.warning("Unexpected odoo_type: %s", self.odoo_type)
read_expanded("postgresql_version", "9.6")
self.start_py3o = section.get("start_py3o", "no") in ("yes", "true")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment