← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1328953] [NEW] template for resolv.conf doesn't work if no options are provided

 

Public bug reported:

When using the plugin for configuring resolv.conf it will always fail if
no options are provided in the config.

The reason is the template includes the check [1]:

#if $varExists('options') or $varExists('flags')

The flags variable is set to an empty list in the generate_resolv_conf
function [2] before the template is rendered and $varExists('flags')
will always return true because of this. Because I know the variable
will always exist and an empty list resolves as false in python I was
able to work around this bug by changing the line in the template to
read:

#if $varExists('options') or $flags

The plugin is now handling my configs properly and generating a valid
resolv.conf on the systems.

[1] http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/971/templates/resolv.conf.tmpl#L30
[2] http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/971/cloudinit/config/cc_resolv_conf.py#L67

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1328953

Title:
  template for resolv.conf doesn't work if no options are provided

Status in Init scripts for use on cloud images:
  New

Bug description:
  When using the plugin for configuring resolv.conf it will always fail
  if no options are provided in the config.

  The reason is the template includes the check [1]:

  #if $varExists('options') or $varExists('flags')

  The flags variable is set to an empty list in the generate_resolv_conf
  function [2] before the template is rendered and $varExists('flags')
  will always return true because of this. Because I know the variable
  will always exist and an empty list resolves as false in python I was
  able to work around this bug by changing the line in the template to
  read:

  #if $varExists('options') or $flags

  The plugin is now handling my configs properly and generating a valid
  resolv.conf on the systems.

  [1] http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/971/templates/resolv.conf.tmpl#L30
  [2] http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/971/cloudinit/config/cc_resolv_conf.py#L67

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1328953/+subscriptions


Follow ups

References