Description of problem:Error on registering duplicate consumer .Error should be caught and handled with proper error message Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1.Register a consumer 2. Register same consumer again. 3. Actual results: Expected results: Additional info: [root@shveta ~]# pulp consumer register --id=10.65.193.89 Traceback (most recent call last): File "/usr/bin/pulp", line 26, in <module> pulpcli.PulpCore().main() File "/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/pulptools/pulpcli.py", line 102, in main cmd.main() File "/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/pulptools/core/basecore.py", line 43, in main self._do_core() File "/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/pulptools/core/core_consumer.py", line 122, in _do_core self._create() File "/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/pulptools/core/core_consumer.py", line 144, in _create consumer = self.cconn.create(self.options.id, self.options.description) File "/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/pulptools/connection.py", line 188, in create return self.conn.request_put(method, params=consumerdata) File "/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/pulptools/connection.py", line 85, in request_put return self._request("PUT", method, params) File "/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/pulptools/connection.py", line 64, in _request self.validateResponse(response) File "/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/pulptools/connection.py", line 72, in validateResponse raise RestlibException(response.status, response.read()) pulptools.connection.RestlibException: "Traceback (most recent call last):\n File \"/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/juicer/controllers/base.py\", line 49, in report_error\n return method(self, *args, **kwargs)\n File \"/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/juicer/controllers/consumers.py\", line 54, in PUT\n consumer = API.create(consumer_data['id'], consumer_data['description'])\n File \"/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/pulp/api/consumer.py\", line 46, in create\n self.insert(c)\n File \"/usr/lib/python2.6/site-packages/pulp-0.0.6-py2.6.egg/pulp/api/base.py\", line 63, in insert\n self.objectdb.insert(object, check_keys=check_keys, safe=True)\n File \"/usr/lib64/python2.6/site-packages/pymongo/collection.py\", line 245, in insert\n message.insert(self.__full_name, docs, check_keys, safe), safe)\n File \"/usr/lib64/python2.6/site-packages/pymongo/connection.py\", line 570, in _send_message\n return self.__check_response_to_last_error(response)\n File \"/usr/lib64/python2.6/site-packages/pymongo/connection.py\", line 540, in __check_response_to_last_error\n raise DuplicateKeyError(error[\"err\"])\nDuplicateKeyError: E11000 duplicate key error index: _database.consumers.$_id_ dup key: { : \"10.65.193.89\" }\n"
[root@shveta ~]# pulp consumer register --id=10.65.193.75 "Consumer with id: 10.65.193.75, already exists" [root@shveta ~]# pulp consumer register --id=10.65.193.26 [root@shveta ~]# pulp consumer register --id=10.65.193.26 "Consumer with id: 10.65.193.26, already exists" verified , However it registers even if i do not provide a proper hostname or IP like below , abc is not a hostname or IP . Can it check for proper hostname . [root@shveta ~]# pulp consumer register --id=abc [root@shveta ~]# pulp repo delete --label=abc Deleted operation failed on Repo [ abc ]
Closing with Community Release 15 pulp-0.0.223-4.