MuranoPL does not handle properly derived class without __init__ method.

Bug #1597457 reported by Alexander Saprykin
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Murano
Fix Released
High
Stan Lagun
Mitaka
Fix Committed
High
Valerii Kovalchuk
Newton
Fix Released
High
Stan Lagun

Bug Description

MuranoPL engine doesn't parse correctly signature of __init__ method that is not defined in derived class.

In case of inheritance, when Base class has __init__ method, but Derived class does not have __init__ method, attempt to create Derived class instance fails with exception:

[TypeError]: __init__() takes exactly 2 arguments (1 given)

Example:

class Base(object):

    def __init__(self, this):
        self._owner = this.find_owner('io.murano.Environment')

class Derived(Base):
    pass

Workaround:

Define explicit method __init__ in derived class that calls parent's class __init__ method.

Tags: muranopl
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to murano (master)

Fix proposed to branch: master
Review: https://review.openstack.org/335621

Changed in murano:
assignee: nobody → Stan Lagun (slagun)
status: New → In Progress
Changed in murano:
importance: Undecided → High
milestone: none → newton-2
tags: added: muranopl
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to murano (master)

Reviewed: https://review.openstack.org/335621
Committed: https://git.openstack.org/cgit/openstack/murano/commit/?id=345117b533ba74a39948ab2df5a54620a71fff0a
Submitter: Jenkins
Branch: master

commit 345117b533ba74a39948ab2df5a54620a71fff0a
Author: Stan Lagun <email address hidden>
Date: Wed Jun 29 11:52:21 2016 -0700

    Improve __init__ detection

    __init__ method was not detected for Python classes registered into MuranoPL
    (for example, for Python MuranoPL plugins) in it was inherited rather than
    implemented in the class.

    Closes Bug: #1597457

    Change-Id: I6f3ae0f6786f807de556f09906856153559efa97

Changed in murano:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to murano (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/338915

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to murano (stable/mitaka)

Reviewed: https://review.openstack.org/338915
Committed: https://git.openstack.org/cgit/openstack/murano/commit/?id=b29afa891555d879d768564ec4fdb06cc7d2c3eb
Submitter: Jenkins
Branch: stable/mitaka

commit b29afa891555d879d768564ec4fdb06cc7d2c3eb
Author: Stan Lagun <email address hidden>
Date: Wed Jun 29 11:52:21 2016 -0700

    Improve __init__ detection

    __init__ method was not detected for Python classes registered into MuranoPL
    (for example, for Python MuranoPL plugins) in it was inherited rather than
    implemented in the class.

    Closes Bug: #1597457

    Change-Id: I6f3ae0f6786f807de556f09906856153559efa97
    (cherry picked from commit 345117b533ba74a39948ab2df5a54620a71fff0a)

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/murano 3.0.0.0b2

This issue was fixed in the openstack/murano 3.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/murano 2.0.2

This issue was fixed in the openstack/murano 2.0.2 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.