From bead2b30aedba5a53481062d1d8c8602d6827526 Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Wed, 18 Oct 2023 19:43:26 +0200 Subject: [PATCH] copy craftbeerpi.template file to config folder if not existing after upgrade --- cbpi/__init__.py | 2 +- cbpi/configFolder.py | 11 ++++++++--- requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cbpi/__init__.py b/cbpi/__init__.py index 218a3d5..8b2bf2b 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1,3 +1,3 @@ -__version__ = "4.2.0.a3" +__version__ = "4.2.0.a4" __codename__ = "Indian Summer" diff --git a/cbpi/configFolder.py b/cbpi/configFolder.py index 2cffc16..198bf29 100644 --- a/cbpi/configFolder.py +++ b/cbpi/configFolder.py @@ -106,7 +106,7 @@ class ConfigFolder: ] for checking in required_config_content: if self.inform_missing_content(self.check_for_file_or_folder(os.path.join(self.configFolderPath, checking[0]), checking[1])): - # since there is no complete config we now check if the config folde rmay be completely empty to show hints: + # since there is no complete config we now check if the config folder may be completely empty to show hints: if len(os.listdir(os.path.join(self.configFolderPath))) == 0 : print("***************************************************") print(f"the config folder '{self.configFolderPath}' seems to be completely empty") @@ -118,7 +118,7 @@ class ConfigFolder: print("***************************************************") return False - # if cbpi_dashboard_1.json doesnt exist at the new location (configFolderPath/dashboard) + # if cbpi_dashboard_1.json does'nt exist at the new location (configFolderPath/dashboard) # we move every cbpi_dashboard_n.json file from the old location (configFolderPath) there. # this could be a config zip file restore from version 4.0.7.a4 or prior. dashboard_1_path = os.path.join(self.configFolderPath, 'dashboard', 'cbpi_dashboard_1.json') @@ -132,7 +132,7 @@ class ConfigFolder: try: with open(dashboard_1_path, 'r') as f: data = json.load(f) - if (len(data['elements']) == 0): # there may exist some pathes but pathes without elements in dashboard is not very likely + if (len(data['elements']) == 0): # there may exist some paths but paths without elements in dashboard is not very likely return True else: return False @@ -142,6 +142,11 @@ class ConfigFolder: def inform_missing_content(self, whatsmissing : str): if whatsmissing == "": return False + # Starting with cbpi 4.2.0, the craftbeerpi.service file will be created dynamically from the template file based on the user id. + # Therefore, the service file is replaced with a template file in the config folder + if whatsmissing.find("craftbeerpi.template"): + self.copyDefaultFileIfNotExists("craftbeerpi.template") + return False print("***************************************************") print(f"CraftBeerPi config content not found: {whatsmissing}") print("Please run 'cbpi setup' before starting the server ") diff --git a/requirements.txt b/requirements.txt index 0b8e3b7..5102103 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ aiohttp-session==2.12.0 aiohttp-swagger==1.0.16 aiojobs==1.1.0 aiosqlite==0.17.0 -cryptography==41.0.3 +cryptography==41.0.4 pyopenssl==23.2.0 requests==2.31.0 voluptuous==0.13.1 diff --git a/setup.py b/setup.py index 2f745e6..36cb773 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ setup(name='cbpi4', "aiohttp-swagger==1.0.16", "aiojobs==1.1.0 ", "aiosqlite==0.17.0", - "cryptography==41.0.3", + "cryptography==41.0.4", "pyopenssl==23.2.0", "requests==2.31.0", "voluptuous==0.13.1",