[Pulp-list] Be careful when deleting from the database

Jason Dobies jason.dobies at redhat.com
Thu Sep 16 14:47:38 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I just fixed an issue in consumer delete, and after quickly poking
around the API it exists in other places as well. Here's the diff:

- -        self.objectdb.remove(consumer, safe=True)
+        self.objectdb.remove({'id' : id}, safe=True)

The pymongo remove call doesn't take the document object, it takes a
dict spec (or ObjectId instance) describing which documents to delete.
So while the old code didn't throw an error, it didn't do anything
either. The same issue stands for deleting repos as well (I'll fix that
one too).

A little more scary is why don't we have unit tests for our basic CRUD APIs
would have shown this earlier?  :)

- -- 
Jason Dobies
RHCE# 805008743336126
Freenode: jdob
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMki4KAAoJEOMmcTqOSQHCiFwH/jxKR9HbYEYwUtRK77H5o5LD
zJildYWAnd93y+VTgJDcnsgORBWKS5fxWCcCd5UtaCtDr0V6MgiYmC4M8khTC1dG
BamsDmNmDV0fO6zp2Wng/w8AZofP2tMrHM5zQQH7x0I/jGLkJecYc8WSLPzsrmVu
vf+olk88qz9zAcZExgJ4FlGnKWHcxoEKkkbUigWiSvWZCKZylemoF/BStXG7XDDh
AVEPa3qT4ZWS56l39otqHo6T9/v8ro+rn1PHwuFo8fF6YcFsFYXOTjyMqyFf3OXE
z3WJTrpxjP9fGFdwcc8IksSkGXaMjZsvgPUxssOO1S2WnnpD7Uq3RyIM9/Lq+nE=
=/6NX
-----END PGP SIGNATURE-----




More information about the Pulp-list mailing list