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

:sparkles: more options can be expanded

parent 128401348e8f
No related branches found
No related tags found
1 merge request!22✨ more options can be expanded
......@@ -9,6 +9,8 @@
Push image to our registry too.
More options can be expanded.
7.0.3
-----
......
......@@ -125,6 +125,39 @@
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
):
"""Read from local version, or from expanded if value is found.
Raise an exception if more than one value is found."""
value = default_value
if toread(key):
found = False
for config in self._expanded_configuration.values():
if hasattr(config, key):
if found:
raise Exception(
"Key %s to read in several expanded "
"configurations" % key
)
else:
value = getattr(config, key)
found = True
if key in section:
local_value = section.get(key, default_value)
if (
found
and value != default_value
and local_value != value
):
raise Exception(
"Key %s in expanded configuration and locally set"
" with different values" % key
)
value = local_value
if toread(key) or always_set:
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))
......@@ -128,7 +161,7 @@
self.registry = section.get("registry", "registry.xcg.io")
project_path = os.path.realpath(".")
self.image = section.get("image", os.path.basename(project_path))
self.odoo_type = section.get("odoo_type", "odoo7")
read_expanded("odoo_type", "odoo7", always_set=True)
if self.odoo_type not in (
"odoo7",
"odoo8",
......@@ -137,7 +170,7 @@
"odoo13",
):
_logger.warning("Unexpected odoo_type: %s", self.odoo_type)
self.postgresql_version = section.get("postgresql_version", "9.6")
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