mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-24 16:08:11 +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,6 +107,7 @@ 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:
|
||||||
|
try:
|
||||||
if len(os.listdir(os.path.join(self.configFolderPath))) == 0 :
|
if len(os.listdir(os.path.join(self.configFolderPath))) == 0 :
|
||||||
print("***************************************************")
|
print("***************************************************")
|
||||||
print(f"the config folder '{self.configFolderPath}' seems to be completely empty")
|
print(f"the config folder '{self.configFolderPath}' seems to be completely empty")
|
||||||
|
@ -117,6 +118,13 @@ class ConfigFolder:
|
||||||
print("of course you can also place your config files manually")
|
print("of course you can also place your config files manually")
|
||||||
print("***************************************************")
|
print("***************************************************")
|
||||||
return False
|
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"):
|
||||||
|
try:
|
||||||
self.copyDefaultFileIfNotExists("craftbeerpi.template")
|
self.copyDefaultFileIfNotExists("craftbeerpi.template")
|
||||||
return False
|
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