Description of problem: Several commands using subscription-manager from the CLI result in the error: "'NoneType' object is not subscriptable" This is on a machine with a Release Version of "". Version-Release number of selected component (if applicable): candlepin-0.5.26 subscription-manager-1.0.0-1.git.9.fc486b4 How reproducible: Always on certain commands Steps to Reproduce: 1a. Type in "subscription-manager release" or 1b. Type in "subscription-manager repos --list" Actual results: I see output of "'NoneType' object is not subscriptable" Expected results: I would expect to see the command carried out successfully Additional info: Log info for line callbacks involved - 2012-04-11 10:42:29,499 [DEBUG] @connection.py:147 - ContectConnection 2012-04-11 10:42:29,502 [INFO] @connection.py:487 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = True 2012-04-11 10:42:29,502 [INFO] @connection.py:498 - Connection Built: host: 10.10.77.151, port: 8443, handler: /candlepin 2012-04-11 10:42:29,503 [DEBUG] @connection.py:328 - Making request: GET /candlepin/consumers/94362281-b187-4835-b837-04726c601607/release 2012-04-11 10:42:29,875 [DEBUG] @connection.py:342 - Response status: 200 2012-04-11 10:42:29,875 [ERROR] @managercli.py:100 - exception caught in subscription-manager 2012-04-11 10:42:29,876 [ERROR] @managercli.py:101 - 'NoneType' object is not subscriptable Traceback (most recent call last): File "/usr/sbin/subscription-manager", line 79, in <module> sys.exit(abs(main() or 0)) File "/usr/sbin/subscription-manager", line 70, in main return managercli.CLI().main() File "/usr/share/rhsm/subscription_manager/managercli.py", line 1754, in main return cmd.main() File "/usr/share/rhsm/subscription_manager/managercli.py", line 276, in main return_code = self._do_command() File "/usr/share/rhsm/subscription_manager/managercli.py", line 1344, in _do_command repos = rl.get_repos() File "/usr/share/rhsm/subscription_manager/repolib.py", line 46, in get_repos action = UpdateAction(uep=self.uep) File "/usr/share/rhsm/subscription_manager/repolib.py", line 107, in __init__ self.release = result['releaseVer'] TypeError: 'NoneType' object is not subscriptable 2012-04-11 10:44:19,471 [DEBUG] @connection.py:147 - ContectConnection 2012-04-11 10:44:39,705 [DEBUG] @connection.py:147 - ContectConnection 2012-04-11 10:44:39,708 [INFO] @connection.py:487 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = True 2012-04-11 10:44:39,708 [INFO] @connection.py:498 - Connection Built: host: 10.10.77.151, port: 8443, handler: /candlepin 2012-04-11 10:44:39,710 [DEBUG] @connection.py:328 - Making request: GET /candlepin/consumers/94362281-b187-4835-b837-04726c601607/release 2012-04-11 10:44:40,051 [DEBUG] @connection.py:342 - Response status: 200 2012-04-11 10:44:40,052 [ERROR] @managercli.py:100 - exception caught in subscription-manager 2012-04-11 10:44:40,052 [ERROR] @managercli.py:101 - 'NoneType' object is not subscriptable Traceback (most recent call last): File "/usr/sbin/subscription-manager", line 79, in <module> sys.exit(abs(main() or 0)) File "/usr/sbin/subscription-manager", line 70, in main return managercli.CLI().main() File "/usr/share/rhsm/subscription_manager/managercli.py", line 1754, in main return cmd.main() File "/usr/share/rhsm/subscription_manager/managercli.py", line 276, in main return_code = self._do_command() File "/usr/share/rhsm/subscription_manager/managercli.py", line 1029, in _do_command self.show_current_release() File "/usr/share/rhsm/subscription_manager/managercli.py", line 1010, in show_current_release release = self._get_consumer_release() File "/usr/share/rhsm/subscription_manager/managercli.py", line 999, in _get_consumer_release return self.cp.getRelease(self.consumer['uuid'])['releaseVer'] TypeError: 'NoneType' object is not subscriptable
candlepin-0.5.26 seems to be the root of this. It really doesn't like None releases, and either throws NullPointerExceptions serverside, or causes later clients to fail because they expect a Release object to be returned (5.26 just returns a bare string).
I think the right fix is to rev candlepin to a version with this fix (.5.27) or to backport : commit cd1bfaead0063e2549e70ff00674f52b17771edc Author: Adrian Likins <alikins> Date: Thu Mar 22 14:36:25 2012 -0400 804227: add simple model for Release Fix cases where we could NPE with no release set To a the cp version we need. I think I might be able to work around and support the "old" broken cp and the current version, but it is going to be kind of uGly client side.
python-rhsm commit abc2190a6b386cee0122ff339bc50f6804feeb7a Author: Adrian Likins <alikins> Date: Fri Apr 13 14:47:46 2012 -0400 811638: Fix issues with release with candlepin 0.5.26 0.5.26 has an old version of the /consumer/*/release api, so try to handle that case as best as we can. The main issue is the getRelease just returns a bare string (and not a json encoded one). We don't have a great way to predict this, so just handle it if happens. subscription-manager commit d020040933001cb71cd7f6a0729b17f29c70478d Author: Adrian Likins <alikins> Date: Fri Apr 13 15:20:47 2012 -0400 811638: require latest python-rhsm for backcompat with cp 0.5.26 commit 351640473a25a5ee7c245aebf4ad43f154afabe9 Author: Adrian Likins <alikins> Date: Fri Apr 13 14:43:51 2012 -0400 811638: Fix issues with release with candlepin 0.5.26 0.5.26 has an old version of the /consumer/*/release api, so try to handle that case as best as we can. The main issue is the getRelease just returns a bare string (and not a json encoded one). We don't have a great way to predict this, so just handle it if happens.
This patch has been reverted, as the fix has been moved into candlepin. (subscription-manager) commit 3ee403248966265411293cacfbc7f7d5402d2fd3 Author: Adrian Likins <alikins> Date: Wed Apr 18 11:09:21 2012 -0400 Revert "811638: Fix issues with release with candlepin 0.5.26" This reverts commit 351640473a25a5ee7c245aebf4ad43f154afabe9. This workaround is not needed thanks to a candlepin fix. (python-rhsm) commit 5a4d14cebe718771ac0de00560a14465783f1c95 Author: Adrian Likins <alikins> Date: Wed Apr 18 10:28:32 2012 -0400 Revert "811638: Fix issues with release with candlepin 0.5.26" This reverts commit abc2190a6b386cee0122ff339bc50f6804feeb7a. This workaround is not needed thanks to a candlepin fix. The fix in candlepin: commit 782f0e1782898fcdc6bbcea07d7817b6ae661716 Author: Adrian Likins <alikins> Date: Fri Apr 20 10:49:15 2012 -0400 814385: fix releasever schema to be varchar instead of bytea Change Consumer.releasever back to a plain string and wrap get/set to use Release model.
There appears to have been a lot of second thoughts on how/where to fix this bug. With the offending candlepin 0.5.26 configured, I can reproduce the behavior in comment 2 with the latest brew builds of subscription-manager and python-rhsm... [root@jsefler-r63-server ~]# curl -k https://jsefler-f14-candlepin:8443/candlepin/status --stderr /dev/null | python -m simplejson.tool | grep version "version": "0.5.26" [root@jsefler-r63-server ~]# rpm -q subscription-manager python-rhsm subscription-manager-0.99.15-1.el6.x86_64 python-rhsm-0.99.8-1.el6.noarch [root@jsefler-r63-server ~]# subscription-manager register --username testuser1 --password password --org admin The system has been registered with id: 12344465-6585-45f5-b3e6-7edb84625dfa [root@jsefler-r63-server ~]# subscription-manager release Runtime Error null at org.candlepin.resource.ConsumerResource.getRelease:1,543 [root@jsefler-r63-server ~]# subscription-manager repos --list Runtime Error null at org.candlepin.resource.ConsumerResource.getRelease:1,543 [root@jsefler-r63-server ~]# With the candlepin 0.5.28 configured, the expected behavior is observed... [root@jsefler-r63-server ~]# curl -k https://jsefler-f14-candlepin:8443/candlepin/status --stderr /dev/null | python -m simplejson.tool | grep version "version": "0.5.28" [root@jsefler-r63-server ~]# rpm -q subscription-manager python-rhsmsubscription-manager-0.99.15-1.el6.x86_64 python-rhsm-0.99.8-1.el6.noarch [root@jsefler-r63-server ~]# subscription-manager register --username testuser1 --password password --org admin The system has been registered with id: 07395546-830b-4487-ac84-dc70ca602b39 [root@jsefler-r63-server ~]# subscription-manager release Release not set [root@jsefler-r63-server ~]# subscription-manager repos --list The system is not entitled to use any repositories. However, before I move this to VERIFIED, I'd like to know where Adrian's candlepin commit 782f0e1782898fcdc6bbcea07d7817b6ae661716 from comment 6 is located. I could not find it in the candlepin master branch.
For master branch: commit b196708d47d4ab0d158ae72af53e1b0d8ec8cabb Author: Adrian Likins <alikins> Date: Fri Apr 20 10:49:15 2012 -0400 814385: fix releasever schema to be varchar instead of bytea Change Consumer.releasever back to a plain string and wrap get/set to use Release model. Add liquibase schema migration scripts. Note we don't have a rollback here, since psql can't change a varchar to a bytea, and any existing content in releasever was busted anyway.
Final verification is against master candlepin with comment #9 deployed... [root@jsefler-f14-candlepin candlepin]# git branch * master [root@jsefler-f14-candlepin candlepin]# git show | head -n5 commit b196708d47d4ab0d158ae72af53e1b0d8ec8cabb Author: Adrian Likins <alikins> Date: Fri Apr 20 10:49:15 2012 -0400 814385: fix releasever schema to be varchar instead of bytea [root@jsefler-f14-candlepin candlepin]# [root@jsefler-r63-server ~]# subscription-manager register --username testuser1 --password password --org admin The system has been registered with id: a4a8713d-d2e9-427e-aded-a0f06e7a344e [root@jsefler-r63-server ~]# subscription-manager repos --list The system is not entitled to use any repositories. [root@jsefler-r63-server ~]# subscription-manager release Release not set [root@jsefler-r63-server ~]# subscription-manager release --set FOO Release set to: FOO [root@jsefler-r63-server ~]# subscription-manager release Release: FOO [root@jsefler-r63-server ~]# moving to VERIFIED
Marking all community bugs modified or beyong as closed.