Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1627679 - listing organization fails after adding default organization/location
Summary: listing organization fails after adding default organization/location
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Organizations and Locations
Version: 6.4
Hardware: x86_64
OS: All
medium
medium
Target Milestone: 6.4.0
Assignee: Marek Hulan
QA Contact: Lai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-09-11 08:55 UTC by Ranjan Kumar
Modified: 2019-11-05 23:34 UTC (History)
15 users (show)

Fixed In Version: foreman-1.18.0.29-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-16 19:02:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 24957 0 Normal Closed listing organization fails after adding default organization/location 2020-06-08 11:12:05 UTC

Description Ranjan Kumar 2018-09-11 08:55:38 UTC
Description of problem:After adding default organization/location, Listing organization and locations fails with error

NoMethodError: undefined method `organization_ids' for #<Organization:0x00007ff57ad59770>


Version-Release number of selected component (if applicable):6.4


How reproducible:Always


Steps to Reproduce:
Step 1. 
[root@satellite64 ~]# hammer organization list
---|----------------------|----------------------|-------------|----------------------
ID | TITLE                | NAME                 | DESCRIPTION | LABEL                
---|----------------------|----------------------|-------------|----------------------
1  | Default Organization | Default Organization |             | Default_Organization             
---|----------------------|----------------------|-------------|----------------------

Step 2. 
[root@satellite64 ~]# hammer location list
---|------------------|------------------|------------
ID | TITLE            | NAME             | DESCRIPTION
---|------------------|------------------|------------
2  | Default Location | Default Location |            
---|------------------|------------------|------------

Step 3: add default
[root@satellite64 ~]# hammer defaults add --param-name organization_id --param-value 1
Added organization_id default-option with value 1.

[root@satellite64 ~]# hammer defaults list
----------------|------
PARAMETER       | VALUE
----------------|------
organization_id | 1    
----------------|------

Step 4: List location 
[root@satellite64 ~]# hammer location list
---|-------|------|------------
ID | TITLE | NAME | DESCRIPTION
---|-------|------|------------

Step 5: Listing location raise an error
[root@satellite64 ~]# hammer organization list
Internal Server Error: the server was unable to finish the request. 
This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs.

Error in logs
NoMethodError: undefined method `organization_ids' for #<Organization:0x00007ff57ad59770>
Did you mean?  organization_parameter_ids
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activemodel-5.1.6/lib/active_model/attribute_methods.rb:432:in `method_missing'


Actual results: Listing organization raises an error


Expected results: Location and Organization should be listed


Additional info:

Comment 6 Marek Hulan 2018-09-17 11:55:47 UTC
I think I have a fix, will ping you on PR to test if you already started looking too :-)

Comment 7 Marek Hulan 2018-09-17 11:56:25 UTC
Created redmine issue https://projects.theforeman.org/issues/24957 from this bug

Comment 9 Satellite Program 2018-09-18 14:05:00 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/24957 has been resolved.

Comment 11 Patrick Creech 2018-09-24 14:46:47 UTC
snap 23, not 63

Comment 12 Lai 2018-09-24 20:15:58 UTC
I tried the above steps and got all the way down to location list and got it to work, but hammer organization list gives an error.  The other hammer command still works -> hammer location list, hammer defaults list


-bash-4.2# hammer location list
---|------------------|------------------|------------
ID | TITLE            | NAME             | DESCRIPTION
---|------------------|------------------|------------
2  | Default Location | Default Location |            
---|------------------|------------------|------------

-bash-4.2# hammer defaults list
----------------|------
PARAMETER       | VALUE
----------------|------
organization_id | 1    
----------------|------

-bash-4.2# hammer organization list
Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs.

Services seems to be working fine with hammer ping:

-bash-4.2# hammer ping
candlepin:      
    Status:          ok
    Server Response: Duration: 12ms
candlepin_auth: 
    Status:          ok
    Server Response: Duration: 12ms
pulp:           
    Status:          ok
    Server Response: Duration: 35ms
pulp_auth:      
    Status:          ok
    Server Response: Duration: 20ms
foreman_tasks:  
    Status:          ok
    Server Response: Duration: 38ms


This fails ON_QA.  Reassigning back to dev.

Comment 13 Mike McCune 2018-09-24 22:09:33 UTC
Can you share reproducer info? I can't get this to fail on my satellite.

Can you share a foreman-debug as well?

Comment 14 Marek Hulan 2018-09-25 10:47:23 UTC
Lai, please check your production.log for more errors, this may be unrelated, therefore shouldn't be FailedQA. I'm also unable to reproduce on last snap.

Comment 17 Lai 2018-09-25 16:27:19 UTC
Tested the above steps and got everything to work:

bash-4.2# hammer organization list
---|----------------------|----------------------|-------------|----------------------|------------
ID | TITLE                | NAME                 | DESCRIPTION | LABEL                | DESCRIPTION
---|----------------------|----------------------|-------------|----------------------|------------
1  | Default Organization | Default Organization |             | Default_Organization |            
---|----------------------|----------------------|-------------|----------------------|------------


-bash-4.2# hammer location list
---|------------------|------------------|------------
ID | TITLE            | NAME             | DESCRIPTION
---|------------------|------------------|------------
2  | Default Location | Default Location |            
---|------------------|------------------|------------



-bash-4.2# hammer defaults list
----------|------
PARAMETER | VALUE
----------|------



-bash-4.2# hammer location list
---|------------------|------------------|------------
ID | TITLE            | NAME             | DESCRIPTION
---|------------------|------------------|------------
2  | Default Location | Default Location |            
---|------------------|------------------|------------
-bash-4.2# hammer defaults add --param-name organization_id --param-value 1
Added organization_id default-option with value 1.
-bash-4.2# hammer defaults list
----------------|------
PARAMETER       | VALUE
----------------|------
organization_id | 1    
----------------|------



-bash-4.2# hammer location list
---|------------------|------------------|------------
ID | TITLE            | NAME             | DESCRIPTION
---|------------------|------------------|------------
2  | Default Location | Default Location |            
---|------------------|------------------|------------



-bash-4.2# hammer organization list
---|----------------------|----------------------|-------------|----------------------|------------
ID | TITLE                | NAME                 | DESCRIPTION | LABEL                | DESCRIPTION
---|----------------------|----------------------|-------------|----------------------|------------
1  | Default Organization | Default Organization |             | Default_Organization |            
---|----------------------|----------------------|-------------|----------------------|------------

Tested on snap_6.4.0_23.0

Comment 18 Bryan Kearney 2018-10-16 19:02: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.

https://access.redhat.com/errata/RHSA-2018:2927


Note You need to log in before you can comment on or make changes to this bug.