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

Bug #1328953 reported by Russell Harrison
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released

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

Related branches

Revision history for this message
Scott Moser (smoser) wrote :

fix-commited in revno 997.

Changed in cloud-init:
importance: Undecided → Medium
status: New → Fix Committed
Revision history for this message
Scott Moser (smoser) wrote :

fixed in 0.7.6

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
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.