Bug 857550

Summary: ReST calls appear to be failing on Environment specific requests with 'NoneType' object has no attribute '__getitem__'
Product: Red Hat Satellite Reporter: Eric Sammons <esammons>
Component: APIAssignee: Jordan OMara <jomara>
Status: CLOSED ERRATA QA Contact: Og Maciel <omaciel>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 6.0.1CC: achan, asettle, athomas, dmacpher, inecas, jlaska, jomara, mmccune, omaciel
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
When attempting to get the ID attribute of an environment from within the API, the script failed to receive the ID attribute. This was caused by a bug in non-English locales when subscribing and unsubscribing systems. This fix rectifies the bug and the environment ID from the API now works correctly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-04 19:53:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Eric Sammons 2012-09-14 19:52:27 UTC
Description of problem:
When running calls that are in the environment.py library, these calls are failing against the latest nightly build.

[Error] Failed to find and create requested environment.
'NoneType' object has no attribute '__getitem__'

Version-Release number of selected component (if applicable):
katello-common-1.1.12-1.git.29.d796c20.fc16.noarch
katello-cli-common-1.1.8-1.git.2.a0908e7.fc16.noarch

Steps to Reproduce:
In [24]: from katello.client.api.environment import EnvironmentAPI
In [25]: from katello.client.api.organization import OrganizationAPI
In [26]: from katello.client import server
         s = server.KatelloServer('headpin.example.com', 443, 'https', '/headpin')
In [27]: s.set_auth_method(BasicAuthentication('admin','admin'))
In [28]: server.set_active_server(s)
In [29]: lockerid = env.environment_by_name('ACME_Corporation', 'Library')['id']
  
Actual results:
----> 1 lockerid = env.environment_by_name('ACME_Corporation', 'Library')['id']

TypeError: 'NoneType' object has no attribute '__getitem__'


Expected results:
lockerid should have a valid id.

Additional info:
I have tested using the same katello-cli-common, pointing at a cfse-1.1 puddle install and it works.

In [31]: s = server.KatelloServer('cfse.example.com', 443, 'https', '/headpin')
In [32]: s.set_auth_method(BasicAuthentication('admin','admin'))
In [33]: server.set_active_server(s)
In [34]: lockerid = env.environment_by_name('ACME_Corporation', 'Library')['id']

Comment 2 Jordan OMara 2012-09-17 20:48:15 UTC
https://github.com/Katello/katello/pull/670

Comment 6 Og Maciel 2012-10-02 23:00:33 UTC
For posterity, here's the full script:

>>> from katello.client.api.environment import EnvironmentAPI
>>> from katello.client.api.organization import OrganizationAPI
>>> from katello.client import server
>>> from katello.client.server import BasicAuthentication

>>> s = server.KatelloServer('CFSE-server-goes-here', 443, 'https', '/cfse')

>>> s.set_auth_method(BasicAuthentication('admin','admin'))
>>> server.set_active_server(s)
>>> environment_api = EnvironmentAPI()
>>> lockerid = environment_api.environment_by_name('ACME_Corporation', 'Library')['id']
>>> lockerid
1

Comment 7 Og Maciel 2012-10-02 23:01:28 UTC
Verified using:

* candlepin-0.7.8-1.el6cf.noarch
* candlepin-selinux-0.7.8-1.el6cf.noarch
* candlepin-tomcat6-0.7.8-1.el6cf.noarch
* katello-1.1.12-12.el6cf.noarch
* katello-all-1.1.12-12.el6cf.noarch
* katello-candlepin-cert-key-pair-1.0-1.noarch
* katello-certs-tools-1.1.8-1.el6cf.noarch
* katello-cli-1.1.8-6.el6cf.noarch
* katello-cli-common-1.1.8-6.el6cf.noarch
* katello-common-1.1.12-12.el6cf.noarch
* katello-configure-1.1.9-6.el6cf.noarch
* katello-glue-candlepin-1.1.12-12.el6cf.noarch
* katello-glue-pulp-1.1.12-12.el6cf.noarch
* katello-qpid-broker-key-pair-1.0-1.noarch
* katello-qpid-client-key-pair-1.0-1.noarch
* katello-selinux-1.1.1-1.el6cf.noarch
* pulp-1.1.12-1.el6cf.noarch
* pulp-common-1.1.12-1.el6cf.noarch
* pulp-selinux-server-1.1.12-1.el6cf.noarch

Comment 9 errata-xmlrpc 2012-12-04 19:53:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-1543.html

Comment 10 Mike McCune 2013-08-16 18:10:04 UTC
getting rid of 6.0.0 version since that doesn't exist