component.assembly_uuid raises an exception when assembly_id is None

Bug #1306731 reported by Pierre Padrixe (stannie)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Solum
Fix Released
Undecided
Pierre Padrixe (stannie)

Bug Description

component.assembly_uuid raises an exception when assembly_id is None.

And when I am doing Component.as_dict with no assembly_id set, it raises a ResourceNotFound: assemblies could not be found.
It shouldn't raise any exception and just retourn the dict without the field.

(Note that assembly_id FK is nullable in Component)

as_dict stacktrace:
  File "solum/objects/sqlalchemy/models.py", line 75, in as_dict
    d[k] = self[k]
  File "solum/openstack/common/db/sqlalchemy/models.py", line 57, in __getitem__
    return getattr(self, key)
  File "solum/objects/sqlalchemy/component.py", line 46, in assembly_uuid
    return objects.registry.Assembly.get_by_id(None, self.assembly_id).uuid
  File "solum/objects/sqlalchemy/models.py", line 92, in get_by_id
    cls._raise_not_found(item_id)
  File "solum/objects/sqlalchemy/models.py", line 148, in _raise_not_found
    raise exception.ResourceNotFound(name=cls.__resource__, id=item_id)
ResourceNotFound: The assemblies resource None could not be found.

Changed in solum:
assignee: nobody → Pierre Padrixe (stannie) (pierre-padrixe)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to solum (master)

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

Changed in solum:
status: New → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to solum (master)

Reviewed: https://review.openstack.org/86974
Committed: https://git.openstack.org/cgit/stackforge/solum/commit/?id=e2368f5fdbf98420eb820ae09bbcc91fc6a045ab
Submitter: Jenkins
Branch: master

commit e2368f5fdbf98420eb820ae09bbcc91fc6a045ab
Author: Pierre Padrixe <email address hidden>
Date: Mon Apr 14 10:49:32 2014 +0200

    Allow as_dict with no assembly_id FK set in Component

    Component.assembly_uuid used to raise an exception when no assembly_id
    was set. It was an acceptable behavior but when you were calling as_dict
    you were getting a ResourneNotFound and couldn't retrieve your dict.
    The purpose of this patch is to allow the use of as_dict with no assembly
    set as FK.

    Change-Id: I3518e0dfb3f85631260474ba465146314e48a12c
    Closes-Bug: #1306731

Changed in solum:
status: In Progress → Fix Committed
Adrian Otto (aotto)
Changed in solum:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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