← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1248699] Re: Fix checking if an ip interface exist when machine hostname is not configured in Ubuntu

 

** Changed in: nova
       Status: Fix Committed => Fix Released

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

Title:
  Fix checking if an ip interface exist when machine hostname is not
  configured in Ubuntu

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  In Ubuntu when you don't specify the hostname of the machine in
  /etc/hosts , and you try to run sudo <whatever> you get this message
  shown in your terminal:

  sudo: unable to resolve host ....

  But this shouldn't be causing nova compute to fail, but it does
  because of this function (nova/network/linux_net.py):

  def device_exists(device):
      (_out, err) = _execute('ip', 'link', 'show', 'dev', device,
                                               check_exit_code=False, run_as_root=True)
      return not err

  As you can see this function instead of checking the return code of
  the command "ip link show", it try to check whether anything was
  displayed to stderr or no,  and guess what ? the message "sudo: unable
  to resolve host ...." is sent to stderr !!

  I will go as far as to tell (And maybe i am wrong) that there is only
  one way and one preferable way to check wether a command succeed or
  failed is by checking the return code of this latter, and if there is
  some special case where a command is returning wrong return code, than
  it should be treated as it is, i.e. special case. Remember "Special
  cases aren't special enough to break the rules."

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