mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-25 00:18:17 +01:00
Added check for plugin addition
before plugin is added to the config, cli.py checks if the package does exist and if the name is correct (capital letters,...)
This commit is contained in:
parent
259f5abc78
commit
972c9dbf49
2 changed files with 25 additions and 14 deletions
|
@ -1 +1 @@
|
|||
__version__ = "4.0.1.15"
|
||||
__version__ = "4.0.1.16"
|
||||
|
|
11
cbpi/cli.py
11
cbpi/cli.py
|
@ -218,7 +218,18 @@ def plugins_add(package_name):
|
|||
return
|
||||
return
|
||||
|
||||
installation = True
|
||||
try:
|
||||
try:
|
||||
p_metadata= metadata(package_name)
|
||||
p_name=p_metadata['Name']
|
||||
if p_name != package_name:
|
||||
print("Error. Package name {} does not exist. Did you mean {}".format(package_name,p_name))
|
||||
installation = False
|
||||
except Exception as e:
|
||||
print("Error. Package {} cannot be found in installed packages".format(package_name))
|
||||
installation = False
|
||||
if installation:
|
||||
with open(os.path.join(".", 'config', "config.yaml"), 'rt') as f:
|
||||
data = yaml.load(f, Loader=yaml.FullLoader)
|
||||
if package_name in data["plugins"]:
|
||||
|
|
Loading…
Reference in a new issue