Bug 1419730 - Services with nil service_template will fail while looking up atomic? or composite?
Summary: Services with nil service_template will fail while looking up atomic? or comp...
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Provisioning
Version: unspecified
Hardware: x86_64
OS: Linux
Target Milestone: GA
: 5.8.0
Assignee: Drew Bomhof
QA Contact: Dmitry Misharov
Whiteboard: automate
Depends On:
Blocks: 1422650
TreeView+ depends on / blocked
Reported: 2017-02-06 21:57 UTC by Drew Bomhof
Modified: 2018-06-01 13:14 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1422650 (view as bug list)
Last Closed: 2017-06-12 16:24:10 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:

Attachments (Terms of Use)

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:

commit be71c6f1912b08b0ae9f68460221b4e99303b7a5
Author:     Drew Bomhof <dbomhof@redhat.com>
AuthorDate: Mon Feb 6 17:03:29 2017 -0500
Commit:     Drew Bomhof <dbomhof@redhat.com>
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

 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 A service created without service template responds to atomic? and composite? with a boolean and not an error.

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