Bug 1419730

Summary: Services with nil service_template will fail while looking up atomic? or composite?
Product: Red Hat CloudForms Management Engine Reporter: Drew Bomhof <dbomhof>
Component: ProvisioningAssignee: Drew Bomhof <dbomhof>
Status: CLOSED CURRENTRELEASE QA Contact: Dmitry Misharov <dmisharo>
Severity: medium Docs Contact:
Priority: high    
Version: unspecifiedCC: jhardy, obarenbo, simaishi
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: automate
Fixed In Version: 5.8.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1422650 (view as bug list) Environment:
Last Closed: 2017-06-12 16:24:10 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:
Bug Depends On:    
Bug Blocks: 1422650    

Description Drew Bomhof 2017-02-06 21:57:11 UTC
Description of problem:

Calling service.atomic? or service.composite? will fail if a service does not an associated service_template.  

Building a service via Automate can duplicate this case.


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


How reproducible:


Steps to Reproduce:
1. Build a service via Automate without an associated service_template
2. Call atomic? or composite? on said service

Actual results:

An exception will be raised - NoMethodError - undefined method atomic? | composite? for nil:NilClass


Expected results:

true or false returned


Additional info:

Comment 3 CFME Bot 2017-02-09 16:51:06 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/be71c6f1912b08b0ae9f68460221b4e99303b7a5

commit be71c6f1912b08b0ae9f68460221b4e99303b7a5
Author:     Drew Bomhof <dbomhof>
AuthorDate: Mon Feb 6 17:03:29 2017 -0500
Commit:     Drew Bomhof <dbomhof>
CommitDate: Tue Feb 7 09:22:29 2017 -0500

    Allow power_state for services that do not have an associated service_template
    
    For the cases in Automate where a service does not have an associated ServiceTemplate
    
    1. If children exist we have a composite service
    2. If no children exists we have an atomic service
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1419730

 app/models/service.rb       | 10 ++++++++--
 spec/models/service_spec.rb | 10 ++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

Comment 5 Milan Falešník 2017-03-14 13:56:04 UTC
Verified in 5.8.0.4. A service created without service template responds to atomic? and composite? with a boolean and not an error.