update_manager: fix initial name parsing
This fixes an issue where a configuration name with spaces may not match the reported name. Signed-off-by: Eric Callahan <arksine.code>
This commit is contained in:
parent
5f43536612
commit
2ef4dc4d8e
|
@ -23,10 +23,7 @@ class BaseDeploy:
|
|||
cfg_hash: Optional[str] = None
|
||||
) -> None:
|
||||
if name is None:
|
||||
name = config.get_name().split(maxsplit=1)[-1]
|
||||
if name.startswith("client "):
|
||||
# allow deprecated [update_manager client app] style names
|
||||
name = name[7:]
|
||||
name = self.parse_name(config)
|
||||
self.name = name
|
||||
if prefix:
|
||||
prefix = f"{prefix} {self.name}: "
|
||||
|
@ -41,6 +38,14 @@ class BaseDeploy:
|
|||
cfg_hash = config.get_hash().hexdigest()
|
||||
self.cfg_hash = cfg_hash
|
||||
|
||||
@staticmethod
|
||||
def parse_name(config: ConfigHelper) -> str:
|
||||
name = config.get_name().split(maxsplit=1)[-1]
|
||||
if name.startswith("client "):
|
||||
# allow deprecated [update_manager client app] style names
|
||||
name = name[7:]
|
||||
return name
|
||||
|
||||
async def initialize(self) -> Dict[str, Any]:
|
||||
umdb = self.cmd_helper.get_umdb()
|
||||
storage: Dict[str, Any] = await umdb.get(self.name, {})
|
||||
|
|
|
@ -107,7 +107,7 @@ class UpdateManager:
|
|||
client_sections = config.get_prefix_sections("update_manager ")
|
||||
for section in client_sections:
|
||||
cfg = config[section]
|
||||
name = section.split()[-1]
|
||||
name = BaseDeploy.parse_name(cfg)
|
||||
if name in self.updaters:
|
||||
if name not in ["klipper", "moonraker"]:
|
||||
self.server.add_warning(
|
||||
|
|
Loading…
Reference in New Issue