Hide Forgot
Description of problem: Given some pending_ops are present in datastore, when trying to clean them up with oo-admin-clear-pending-ops, the admin tool is broken with error undefined method `op_type', see the details below. Version-Release number of selected component (if applicable): On devenv_3810 How reproducible: Always Steps to Reproduce: 1. Edit /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-controller-1.15.0/app/models/cloud_user.rb, comment out lines to delete pending_op when the job is complete eg: #op.close_op #op.delete 2. Add an ssh key to current account, pending operations will be created in cloud_users collection: <snip> "pending_ops" : [ { "_id" : ObjectId("523e97cbcdcfb1ea01000001"), "_type" : "RemoveSshKeysUserOp", "completed_domain_ids" : [ ], "created_at" : ISODate("2013-09-22T07:10:03.109Z"), "keys_attrs" : [ { "name" : "key1", "type" : "ssh-rsa", "content" : "AAAAB3NzaC1yc2EAAAADAQABAAABAQDN4zT4pk10pQdIsjXHGLbR3ks8JdRSvtubUTWAW9ERat0GHlxAOpQ1kDzzsjAK0T8s1fwRUEBPyKaGeu7iD6oBANlxel1ZXmg66E2aEmYDTK7MVU/riJCR3CG7jaN+NYdBPZaGYJK3XnBKPk9no30WocOKPdxeCIFARrrbCicQODznsGlX72Ceb47gXur4fUSUsf8Cs2IevIw+oQhtBxhazqgqTQ3cesS9KJougKiVgPZhs3gWqinU8tjtf3e2S014csoZYe1WVV67VOU+SFk8W2CIaI1KrOE1Ue7TxJI8cFok5bUxCmndUGNBjOCrPQoFJqfVKvjeGDRrSz9DRSRX", "_type" : "UserSshKey" } ], "on_completion_method" : null, "on_domain_ids" : [ ], "state" : "queued", "updated_at" : ISODate("2013-09-22T07:10:03.109Z") }, { "_id" : ObjectId("523e97d9cdcfb1ea01000002"), "_type" : "AddSshKeysUserOp", "completed_domain_ids" : [ ], "created_at" : ISODate("2013-09-22T07:10:17.599Z"), "keys_attrs" : [ { "name" : "key1", "type" : "ssh-rsa", "content" : "AAAAB3NzaC1yc2EAAAADAQABAAABAQDN4zT4pk10pQdIsjXHGLbR3ks8JdRSvtubUTWAW9ERat0GHlxAOpQ1kDzzsjAK0T8s1fwRUEBPyKaGeu7iD6oBANlxel1ZXmg66E2aEmYDTK7MVU/riJCR3CG7jaN+NYdBPZaGYJK3XnBKPk9no30WocOKPdxeCIFARrrbCicQODznsGlX72Ceb47gXur4fUSUsf8Cs2IevIw+oQhtBxhazqgqTQ3cesS9KJougKiVgPZhs3gWqinU8tjtf3e2S014csoZYe1WVV67VOU+SFk8W2CIaI1KrOE1Ue7TxJI8cFok5bUxCmndUGNBjOCrPQoFJqfVKvjeGDRrSz9DRSRX", "_type" : "UserSshKey" } ], "on_completion_method" : null, "on_domain_ids" : [ ], "state" : "queued", "updated_at" : ISODate("2013-09-22T07:10:17.599Z") } ], </snip> 3. Clear them with oo-admin-clear-pending-ops oo-admin-clear-pending-ops -t 0 Actual results: After step 3 [root@ip-10-46-105-231 ~]# oo-admin-clear-pending-ops -t 0 undefined method `op_type' for #<RemoveSshKeysUserOp:0x000000084b8130> /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/attributes.rb:249:in `method_missing' /usr/sbin/oo-admin-clear-pending-ops:151:in `block in clean_user' /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/relations/proxy.rb:143:in `select' /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/relations/proxy.rb:143:in `method_missing' /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/relations/embedded/many.rb:396:in `method_missing' /usr/sbin/oo-admin-clear-pending-ops:151:in `clean_user' /usr/sbin/oo-admin-clear-pending-ops:195:in `block in <main>' /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/contextual/mongo.rb:577:in `yield_document' /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/contextual/mongo.rb:133:in `block (2 levels) in each' /opt/rh/ruby193/root/usr/share/gems/gems/moped-1.3.2/lib/moped/query.rb:78:in `block in each' /opt/rh/ruby193/root/usr/share/gems/gems/moped-1.3.2/lib/moped/cursor.rb:26:in `block in each' /opt/rh/ruby193/root/usr/share/gems/gems/moped-1.3.2/lib/moped/cursor.rb:26:in `each' /opt/rh/ruby193/root/usr/share/gems/gems/moped-1.3.2/lib/moped/cursor.rb:26:in `each' /opt/rh/ruby193/root/usr/share/gems/gems/moped-1.3.2/lib/moped/query.rb:77:in `each' /opt/rh/ruby193/root/usr/share/gems/gems/moped-1.3.2/lib/moped/query.rb:77:in `each' /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/contextual/mongo.rb:132:in `block in each' /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/contextual/mongo.rb:556:in `selecting' /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/contextual/mongo.rb:131:in `each' /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/contextual.rb:18:in `each' /usr/sbin/oo-admin-clear-pending-ops:193:in `<main>' 0 applications were cleaned up. 1 users were cleaned up. 0 domains were cleaned up. Expected results: The pending_ops can be cleared successfully. Additional info:
Fixed with --> https://github.com/openshift/origin-server/pull/3682
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/6a2e381f36fa47fc60759de6a1b1379e739d643a Fix for bug 1010632
Verified on devenv_3817 Steps are exactly same as description, when deleting a pending operation, the error is not seen any more. Will move to verified when it's on_qa
This bug is verified according to comment 3