Skip to content

Commit

Permalink
Use default symbol theme if none is provided when loading appliances
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Jul 25, 2022
1 parent 72eb13d commit 6d0c375
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gns3server/api/routes/controller/appliances.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
@router.get("")
async def get_appliances(
update: Optional[bool] = False,
symbol_theme: Optional[str] = "Classic"
symbol_theme: Optional[str] = None
) -> List[schemas.Appliance]:
"""
Return all appliances known by the controller.
Expand All @@ -56,7 +56,7 @@ async def get_appliances(
controller = Controller.instance()
if update:
await controller.appliance_manager.download_appliances()
controller.appliance_manager.load_appliances(symbol_theme=symbol_theme)
controller.appliance_manager.load_appliances(symbol_theme)
return [c.asdict() for c in controller.appliance_manager.appliances.values()]


Expand Down
4 changes: 3 additions & 1 deletion gns3server/controller/appliance_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ async def install_appliance(
template_data = await self._appliance_to_template(appliance)
await self._create_template(template_data, templates_repo, rbac_repo, current_user)

def load_appliances(self, symbol_theme: str = "Classic") -> None:
def load_appliances(self, symbol_theme: str = None) -> None:
"""
Loads appliance files from disk.
"""
Expand Down Expand Up @@ -326,6 +326,8 @@ def _get_default_symbol(self, appliance: dict, symbol_theme: str) -> str:
from . import Controller

controller = Controller.instance()
if not symbol_theme:
symbol_theme = controller.symbols.theme
category = appliance["category"]
if category == "guest":
if "docker" in appliance:
Expand Down
2 changes: 1 addition & 1 deletion gns3server/controller/symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def get_default_symbol(self, symbol, symbol_theme):

theme = self._themes.get(symbol_theme, None)
if not theme:
log.warning(f"Could not find symbol theme '{self._current_theme}'")
log.warning(f"Could not find symbol theme '{symbol_theme}'")
return None
symbol_path = theme.get(symbol)
if symbol_path not in self._symbols_path:
Expand Down

0 comments on commit 6d0c375

Please sign in to comment.