Skip to content

Commit

Permalink
core: kraken: keep track of version id for extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Sep 25, 2023
1 parent 73982ef commit 3f96de9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions core/services/kraken/kraken.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ async def install_extension(self, extension: Any) -> AsyncGenerator[bytes, None]
except Exception as e:
# this will fail if the container is not installed, we don't mind it
logger.info(e)

new_extension = Extension(
identifier=extension.identifier,
name=extension.name,
Expand All @@ -126,7 +127,7 @@ async def install_extension(self, extension: Any) -> AsyncGenerator[bytes, None]
permissions=extension.permissions,
enabled=extension.enabled,
user_permissions=extension.user_permissions,
uuid=extension.uuid,
id=extension.id,
)
self.settings.extensions.append(new_extension)
self.manager.save()
Expand Down Expand Up @@ -198,7 +199,7 @@ async def update_extension_to_version(self, identifier: str, version: str) -> As
enabled=True,
# TODO: handle user permissions on updates
user_permissions="",
uuid=extension.uuid,
id=extension.id,
)

# Remove older entry if it exists
Expand Down
4 changes: 2 additions & 2 deletions core/services/kraken/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Extension(BaseModel):
enabled: bool
identifier: str
user_permissions: str
uuid: Optional[str] = None
id: Optional[str] = None

def is_valid(self) -> bool:
return all([self.name, self.docker, self.tag, any([self.permissions, self.user_permissions]), self.identifier])
Expand Down Expand Up @@ -67,7 +67,7 @@ async def get_installed_extensions() -> Any:
permissions=extension.permissions,
enabled=extension.enabled,
user_permissions=extension.user_permissions,
uuid=extension.uuid,
id=extension.id,
)
for extension in extensions
]
Expand Down
2 changes: 1 addition & 1 deletion core/services/kraken/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Extension(JsonObject):
permissions = StringField()
enabled = BooleanField()
user_permissions = StringField()
uuid = StringField(null=True)
id = StringField(null=True)

def settings(self) -> Any:
if self.user_permissions:
Expand Down

0 comments on commit 3f96de9

Please sign in to comment.