diff sat/memory/sqla.py @ 3638:257135d5c5c2

core (memory/sqla): fix key/value inversion in self.profiles
author Goffi <goffi@goffi.org>
date Wed, 01 Sep 2021 15:24:59 +0200
parents 9e1a993ad1bf
children 9ae6ec74face
line wrap: on
line diff
--- a/sat/memory/sqla.py	Wed Sep 01 13:47:17 2021 +0200
+++ b/sat/memory/sqla.py	Wed Sep 01 15:24:59 2021 +0200
@@ -239,7 +239,7 @@
             profile = Profile(name=name)
             async with session.begin():
                 session.add(profile)
-            self.profiles[profile.id] = profile.name
+            self.profiles[profile.name] = profile.id
             if component_ep is not None:
                 async with session.begin():
                     component = Component(profile=profile, entry_point=component_ep)
@@ -258,7 +258,7 @@
             profile = result.scalar()
             await session.delete(profile)
             await session.commit()
-        del self.profiles[profile.id]
+        del self.profiles[profile.name]
         if profile.id in self.components:
             del self.components[profile.id]
         log.info(_("Profile {name!r} deleted").format(name = name))