fetch.configure_sources() breaks with 0 extra sources

Bug #1269780 reported by Stuart Bishop
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charm Helpers
Fix Released
High
Stuart Bishop

Bug Description

fetch.configure_sources() fails with configuration that wants to specify no extra sources, like the following:

install_sources: ""
install_keys: ""

The problem is that yaml.safe_load("") returns None, not "", and the subsequent len() call fails.

Related branches

Revision history for this message
Stuart Bishop (stub) wrote :

=== modified file 'hooks/charmhelpers/fetch/__init__.py'
--- hooks/charmhelpers/fetch/__init__.py 2013-09-24 11:09:35 +0000
+++ hooks/charmhelpers/fetch/__init__.py 2014-01-16 12:20:51 +0000
@@ -117,8 +117,8 @@

     Note that 'null' (a.k.a. None) should not be quoted.
     """
- sources = safe_load(config(sources_var))
- keys = safe_load(config(keys_var))
+ sources = safe_load(config(sources_var)) or []
+ keys = safe_load(config(keys_var)) or []
     if isinstance(sources, basestring) and isinstance(keys, basestring):
         add_source(sources, keys)
     else:

Stuart Bishop (stub)
Changed in charm-helpers:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Stuart Bishop (stub)
Stuart Bishop (stub)
Changed in charm-helpers:
status: In Progress → Fix Released
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.