Bug 1663972

Summary: Internal Server Error when querying services attribute `reconfigure_dialog `
Product: Red Hat CloudForms Management Engine Reporter: Parthvi Vala <pvala>
Component: APIAssignee: drew uhlmann <duhlmann>
Status: CLOSED ERRATA QA Contact: Parthvi Vala <pvala>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.10.0CC: dmetzger, jrafanie, mshriver, obarenbo, simaishi, yrudman
Target Milestone: GA   
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-12 13:34:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:

Description Parthvi Vala 2019-01-07 12:27:23 UTC
Description of problem:
Internal server error when querying `reconfigure_dialog` attribute

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

How reproducible:
Always

Steps to Reproduce:
1. Create 1 or more services.
2. Send request: GET /api/services/:id?attributes=reconfigure_dialog

Actual results:
{
	"error": {
		"kind": "internal_server_error",
		"message": "undefined method `dialog_tabs' for nil:NilClass",
		"klass": "NoMethodError"
	}
}

Expected results:
{
	"name": "services",
	"count": 3,
	"subcount": 3,
	"pages": 1,
	"resources": [
		{
			"href": "https://<ip_address>/api/services/1"
		},
		{
			"href": "https://<ip_address>/api/services/2"
		},
		{
			"href": "https://<ip_address>/api/services/3"
		}
	],
	"actions": [
		...
	],
	"links": {
		"self": "https://<ip_address>/api/services?attributes=reconfigure_dialog&offset=0",
		"first": "https://<ip_address>/api/services?attributes=reconfigure_dialog&offset=0",
		"last": "https://<ip_address>/api/services?attributes=reconfigure_dialog&offset=0"
	}
}

Additional info:

Comment 2 Joe Rafaniello 2019-01-08 21:30:46 UTC
Keith, can you see if you can recreate this?

Comment 3 drew uhlmann 2019-04-04 16:42:08 UTC
I can reproduce on master as of Thurs April 4. 

[----] I, [2019-04-04T12:40:58.449747 #72876:3fda21318004]  INFO -- : MIQ(Api::ServicesController.log_request) Parameters:     {"attributes"=>"reconfigure_dialog",            "action"=>"show", "controller"=>"api/services", "format"=>"json", "body"=>{}}
 [----] E, [2019-04-04T12:40:58.476225 #72876:3fda21318004] ERROR -- : MIQ(Api::ServicesController.api_error) NoMethodError: undefined method `dialog_tabs' for nil:NilClass
 [----] E, [2019-04-04T12:40:58.476426 #72876:3fda21318004] ERROR -- : MIQ(Api::ServicesController.api_error)
 
 /Users/duhlmann/manageiq/app/models/dialog_serializer.rb:22:in `block in serialize_dialogs'
 /Users/duhlmann/manageiq/app/models/dialog_serializer.rb:21:in `map'
 /Users/duhlmann/manageiq/app/models/dialog_serializer.rb:21:in `serialize_dialogs'
 /Users/duhlmann/manageiq/app/models/dialog_serializer.rb:9:in `serialize'
 /Users/duhlmann/manageiq/app/models/service.rb:347:in `reconfigure_dialog'
 /Users/duhlmann/.rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7.2/lib/active_support/core_ext/object/try.rb:17:in `public_send'
 /Users/duhlmann/.rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7.2/lib/active_support/core_ext/object/try.rb:17:in `public_send'
 /Users/duhlmann/.rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7.2/lib/active_support/core_ext/object/try.rb:17:in `try!'
 /Users/duhlmann/.rvm/gems/ruby-2.5.1/gems/activesupport-5.0.7.2/lib/active_support/core_ext/object/try.rb:6:in `try'
 /Users/duhlmann/.rvm/gems/ruby-2.5.1/bundler/gems/manageiq-api-023da5f3789c/app/controllers/api/base_controller/renderer.rb:209:in `virtual_attribute_search'
 /Users/duhlmann/.rvm/gems/ruby-2.5.1/bundler/gems/manageiq-api-023da5f3789c/app/controllers/api/base_controller/renderer.rb:274:in `fetch_direct_virtual_attribute'
 /Users/duhlmann/.rvm/gems/ruby-2.5.1/bundler/gems/manageiq-api-023da5f3789c/app/controllers/api/base_controller/renderer.rb:262:in `block in expand_virtual_attributes'
 /Users/duhlmann/.rvm/gems/ruby-2.5.1/bundler/gems/manageiq-api-023da5f3789c/app/controllers/api/base_controller/renderer.rb:258:in `each'

Comment 4 drew uhlmann 2019-04-09 14:06:34 UTC
https://github.com/ManageIQ/manageiq/pull/18636

Comment 5 Parthvi Vala 2019-05-02 13:55:29 UTC
FIXED. Verified on 5.11.0.2.20190430174828_0e34dea.

Comment 7 errata-xmlrpc 2019-12-12 13:34:59 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/RHBA-2019:4199