# HG changeset patch # User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr> # Date 1698328383 -7200 # Thu Oct 26 15:53:03 2023 +0200 # Node ID ba3ca3addac43f5162c2af8521dbbca630fc9731 # Parent b337d2a9a094a7b6700e86025db19f289a33ff11 🚑 fix issue with secretstorage when docker section is not installed diff --git a/NEWS.rst b/NEWS.rst --- a/NEWS.rst +++ b/NEWS.rst @@ -2,6 +2,11 @@ History ======= +20.12.2 +------- + +Fix issue with secretstorage when docker section is not installed. + 20.12.1 ------- diff --git a/odoo_scripts/docker_build_copy.py b/odoo_scripts/docker_build_copy.py --- a/odoo_scripts/docker_build_copy.py +++ b/odoo_scripts/docker_build_copy.py @@ -486,8 +486,7 @@ f"--index-url=https://__token__:{token}@orus.io/api/v4/groups/9/-/packages/" f"pypi/simple" ) - else: - return "--extra-index-url=https://pypi.xcg.io/simple" + return "--extra-index-url=https://pypi.xcg.io/simple" def base_cache_dir() -> str: diff --git a/odoo_scripts/storage.py b/odoo_scripts/storage.py --- a/odoo_scripts/storage.py +++ b/odoo_scripts/storage.py @@ -4,7 +4,14 @@ from getpass import getpass from typing import Optional -import secretstorage +# Only available if docker section is installed +try: + import secretstorage + + __secretstorage_available = True +except ModuleNotFoundError: + __secretstorage_available = False + __version__ = "1.0.0" __date__ = "2023-10-23" @@ -22,6 +29,8 @@ """Retrieve Orus API token from secret service. :return: None if there is no token""" + if not __secretstorage_available: + return None with closing(secretstorage.dbus_init()) as conn: collection = secretstorage.get_default_collection(conn) for item in collection.search_items(__orus_api_token_attributes):