← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1438020] Re: replace "hpy.host" with "hyp['host']"

 

Not an actual bug

** Changed in: nova
       Status: In Progress => Won't Fix

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1438020

Title:
  replace "hpy.host" with "hyp['host']"

Status in OpenStack Compute (Nova):
  Won't Fix

Bug description:
  class ComputeNode in https://github.com/openstack/nova/blob/master/nova/objects/compute_node.py#L27
  is extend from NovaObjectDictCompat in https://github.com/openstack/nova/blob/master/nova/objects/base.py#L652

  def __getitem__(self, name):
          """For backwards-compatibility with dict-based objects.
          NOTE(danms): May be removed in the future.
          """
          return getattr(self, name)

  as we can see above,function __getitem__ may be removed in the
  future.and now some codes use this function to get attribute from
  computenode object,

  "hpy.host",
  https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/contrib/hypervisors.py#L92

  but the unit test data not,data in unit test is only a pure dict.

  https://github.com/openstack/nova/blob/8b29068398b1217579aca07f2596ae88682d5055/nova/tests/unit/objects/test_compute_node.py

  In order to make it more consistent,change codes from "obj.attr" to
  "obj['attr']".

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1438020/+subscriptions


References