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:
Eric Callahan 2023-06-27 12:26:58 -04:00
parent 5f43536612
commit 2ef4dc4d8e
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
2 changed files with 10 additions and 5 deletions

View File

@ -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, {})

View File

@ -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(