← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1414556] Re: "if not host:" never holds in function get_instance_availability_zone() of module nova.availability_zones

 

The code has been changed in stable/newton, stable/ocata and master.
So the issue does not exist currently (in stable/newton, stable/ocata and master).


** Changed in: nova
       Status: Confirmed => Invalid

-- 
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/1414556

Title:
  "if not host:" never holds in function
  get_instance_availability_zone() of module nova.availability_zones

Status in OpenStack Compute (nova):
  Invalid

Bug description:
  Version: stable/juno

  Description:
  This bug report is created to separate two issues found in this link: https://bugs.launchpad.net/nova/+bug/1390033.
  The purpose is to fix at first the bug that the "if not host:" never holds in function get_instance_availability_zone() of module nova.availability_zones in case host is None. This is because str(None) is never interpreted False.

  For proof, please look at the output of the Python interactive
  session:

  Python 2.7.6 (default, Mar 22 2014, 22:59:56)
  [GCC 4.8.2] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> host = str(None)
  >>> print host
  None
  >>> if not host:
  .......print "if not host"
  ....else:
  ...... print "else"
  ...
  else

  >>> var = None
  >>> if not var:
  .......print "if not var"
  ....else:
  .......print "else"
  ...
  if not var

  So, it can be seen that str(None) returns an object whose value is
  None, but it is not interpreted False as expected!

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


References