Bug 1716847

Summary: service template update with REST API result undefined method `key?' for nil:NilClass
Product: Red Hat CloudForms Management Engine Reporter: Gellert Kis <gekis>
Component: AutomateAssignee: drew uhlmann <duhlmann>
Status: CLOSED CURRENTRELEASE QA Contact: Parthvi Vala <pvala>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: high    
Version: 5.10.4CC: bilwei, duhlmann, gmccullo, jocarter, mfeifer, mkanoor, mshriver, obarenbo, pvala, simaishi, tfitzger, yrudman
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.16 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1732117 (view as bug list) Environment:
tested in both with 5.10.0.33 and 5.10.4.3
Last Closed: 2019-12-13 14:54:53 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:
Bug Depends On:    
Bug Blocks: 1732117    

Comment 2 Gellert Kis 2019-06-04 11:34:20 UTC
we found that bug is seems only for Ansible Playbook and not for any other provider catalog type

Comment 3 drew uhlmann 2019-06-17 13:19:49 UTC
Hey Bill, GM said that https://github.com/ManageIQ/manageiq/blob/master/app/models/service_template_ansible_playbook.rb#L139 is supposed to have all the options from the angular UI that it needs to be able to successfully do this service template update. 

ServiceTemplate.last.update_catalog_item({:name=>"Updated Service Name", :description=>"Updated Service Description"}, User.first)
NoMethodError: undefined method `key?' for nil:NilClass
	from /var/www/miq/vmdb/app/models/service_template_ansible_playbook.rb:118:in `validate_config_info'
	from /var/www/miq/vmdb/app/models/service_template_ansible_playbook.rb:227:in `validate_update_config_info'
	from /var/www/miq/vmdb/app/models/service_template_ansible_playbook.rb:139:in `update_catalog_item'

I don't know anything about this, could you please tell me how it's supposed to work?

Comment 4 Bill Wei 2019-06-17 14:39:21 UTC
We should by pass the validation and update of config_info unless it presents. Please follow the same pattern in ServiceTemplateAnsibleTower to create a fix.

Comment 5 drew uhlmann 2019-06-17 15:32:55 UTC
This isn't an API bug at all per comment 3.

Comment 6 drew uhlmann 2019-07-08 15:53:03 UTC
Per https://github.com/ManageIQ/manageiq/commit/a8947bca9cf190989a365d9eee38aafc23934683 though I think this should, rather than Bill's suggestion, look more like the code in that PR at app/models/service_template_ansible_tower.rb because I think we support update without config_info.

Comment 8 drew uhlmann 2019-07-15 18:19:18 UTC
Meeeeeee. Sorry, so busy. 

Here's the issue I'm having. 
https://github.com/ManageIQ/manageiq/commit/a8947bca9cf190989a365d9eee38aafc23934683#diff-6e711c8868f44a0279bbeb7815bf8135R230 means we at one point thought you could run an update without config_info being present. 
Bill's comment makes me think that that shouldn't be the case and I don't know what the right thing to do here is. 
Tina, I don't know what to do here.

Comment 9 Bill Wei 2019-07-15 18:42:11 UTC
Drew your example is a spec for ServiceTemplate. 
As mentioned earlier the fix is to follow the example of https://github.com/ManageIQ/manageiq/blob/master/app/models/service_template_ansible_tower.rb#L76. The fix should be made in class ServiceTemplateAnsiblePlaybook.

Comment 10 drew uhlmann 2019-07-15 18:45:58 UTC
Bill, we pass options in here: https://github.com/ManageIQ/manageiq/blob/master/app/models/service_template_ansible_playbook.rb#L226 and then never use them. I know which file needs the change you're talking about. But that method looks like it's doing the wrong thing anyway at the moment.

Comment 11 drew uhlmann 2019-07-15 18:56:13 UTC
I put in the link to the spec to service template because that's what the service template ansible playbook is calling when it calls super: https://github.com/ManageIQ/manageiq/blob/master/app/models/service_template_ansible_playbook.rb#L227

Comment 12 Bill Wei 2019-07-16 15:38:29 UTC
solved through https://github.com/ManageIQ/manageiq/pull/18981

Comment 14 drew uhlmann 2019-07-16 19:03:36 UTC
It means I'm working on it right now.

Comment 16 Parthvi Vala 2019-07-25 09:14:12 UTC
FIXED. Verified on 5.11.0.16.20190724210259_2b4aa51.