mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-21 22:48:16 +01:00
add checks for config folder
This commit is contained in:
parent
10d76bc398
commit
99f37fcbfa
2 changed files with 24 additions and 13 deletions
|
@ -1,3 +1,3 @@
|
||||||
__version__ = "4.3.2.a4"
|
__version__ = "4.3.2.a5"
|
||||||
__codename__ = "Winter Storm"
|
__codename__ = "Winter Storm"
|
||||||
|
|
||||||
|
|
|
@ -107,16 +107,24 @@ class ConfigFolder:
|
||||||
for checking in required_config_content:
|
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])):
|
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 folder may 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 :
|
try:
|
||||||
print("***************************************************")
|
if len(os.listdir(os.path.join(self.configFolderPath))) == 0 :
|
||||||
print(f"the config folder '{self.configFolderPath}' seems to be completely empty")
|
print("***************************************************")
|
||||||
print("you might want to run 'cbpi setup'.print")
|
print(f"the config folder '{self.configFolderPath}' seems to be completely empty")
|
||||||
print("but you could also place your zipped config backup named")
|
print("you might want to run 'cbpi setup'.print")
|
||||||
print("'restored_config.zip' inside the mentioned config folder for")
|
print("but you could also place your zipped config backup named")
|
||||||
print("cbpi4 to automatically unpack it")
|
print("'restored_config.zip' inside the mentioned config folder for")
|
||||||
print("of course you can also place your config files manually")
|
print("cbpi4 to automatically unpack it")
|
||||||
print("***************************************************")
|
print("of course you can also place your config files manually")
|
||||||
return False
|
print("***************************************************")
|
||||||
|
return False
|
||||||
|
except:
|
||||||
|
print("***************************************************")
|
||||||
|
print("Cannot find config folder!")
|
||||||
|
print("Please navigate to path where you did run 'cbpi setup'.")
|
||||||
|
print("Or run 'cbpi setup' before starting the server.")
|
||||||
|
print("***************************************************")
|
||||||
|
return False
|
||||||
|
|
||||||
# if cbpi_dashboard_1.json does'nt 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.
|
# we move every cbpi_dashboard_n.json file from the old location (configFolderPath) there.
|
||||||
|
@ -145,8 +153,11 @@ class ConfigFolder:
|
||||||
# Starting with cbpi 4.2.0, the craftbeerpi.service file will be created dynamically from the template file based on the user id.
|
# 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
|
# Therefore, the service file is replaced with a template file in the config folder
|
||||||
if whatsmissing.find("craftbeerpi.template"):
|
if whatsmissing.find("craftbeerpi.template"):
|
||||||
self.copyDefaultFileIfNotExists("craftbeerpi.template")
|
try:
|
||||||
return False
|
self.copyDefaultFileIfNotExists("craftbeerpi.template")
|
||||||
|
return False
|
||||||
|
except:
|
||||||
|
pass
|
||||||
print("***************************************************")
|
print("***************************************************")
|
||||||
print(f"CraftBeerPi config content not found: {whatsmissing}")
|
print(f"CraftBeerPi config content not found: {whatsmissing}")
|
||||||
print("Please run 'cbpi setup' before starting the server ")
|
print("Please run 'cbpi setup' before starting the server ")
|
||||||
|
|
Loading…
Reference in a new issue