MacAddress.__unicode__: AttributeError: 'str' object has no attribute 'get_raw'

Bug #1285233 reported by Tycho Andersen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Julian Edwards

Bug Description

CloudFive:~/cloud-installer/cloudfive$ sudo maas-region-admin shell
Python 2.7.6 (default, Jan 12 2014, 08:16:39)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from maasserver.models.node import Node
>>> Node.objects.all()
[<Node: node-e92fceaa-9e5d-11e3-bd32-eca86bfe1886 (juju-bootstrap.master)>, <Node: node-65e14a28-9e6d-11e3-bd32-eca86bfe1886 (hatgg.master)>, <Node: node-660118d0-9e6d-11e3-bd32-eca86bfe1886 (tjpfr.master)>, <Node: node-661ff1c4-9e6d-11e3-bd32-eca86bfe1886 (a9jcc.master)>, <Node: node-663fc5c6-9e6d-11e3-bd32-eca86bfe1886 (b4ef3.master)>, <Node: node-665e6030-9e6d-11e3-bd32-eca86bfe1886 (7yr9q.master)>, <Node: node-667d5166-9e6d-11e3-bd32-eca86bfe1886 (dg3p3.master)>, <Node: node-2dc0f6ec-9eff-11e3-b2e8-00ee4c62088d (jbjtt.master)>, <Node: node-2de55604-9eff-11e3-b2e8-00ee4c62088d (qdf8b.master)>, <Node: node-cf8088f8-9eff-11e3-a872-00ee4c62088d (xh4cc.master)>]
>>> Node.objects.all()[0].power_parameters
u''
>>> Node.objects.all()[0].get_primary_mac()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/django/db/models/base.py", line 423, in __repr__
    u = six.text_type(self)
  File "/usr/lib/python2.7/dist-packages/maasserver/models/macaddress.py", line 51, in __unicode__
    text = self.mac_address.get_raw()
AttributeError: 'str' object has no attribute 'get_raw'

Related branches

Changed in maas:
status: New → Triaged
importance: Undecided → Critical
summary: - get_effective_mac doesn't work from maas-region-admin shell
+ MacAddress.__unicode__: AttributeError: 'str' object has no attribute
+ 'get_raw'
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

It looks as if the __unicode__ method sometimes gets to deal with a cleaned self.mac_address, sometimes with a non-cleaned version. The solution is to make it cope with unicode or str versions of self.mac_address as well as the MAC object which it currently expects.

Changed in maas:
assignee: nobody → Julian Edwards (julian-edwards)
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
milestone: none → 14.04
Changed in maas:
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.