Merge pull request #5 from tcpcloud/hotfix

Hotfix before stacklight is merged
diff --git a/collectd/client.sls b/collectd/client.sls
index 9b93af6..d81c660 100644
--- a/collectd/client.sls
+++ b/collectd/client.sls
@@ -86,7 +86,7 @@
   - watch:
     - file: collectd_client_grain
 
-{%- for plugin_name, plugin in service_grains.collectd.plugin.iteritems() %}
+{%- for plugin_name, plugin in service_grains.collectd.get('plugin', {}).iteritems() %}
 
 {%- if (plugin.get('execution', 'local') == 'local' or client.remote_collector) and plugin.get('plugin', 'native') not in ['python'] %}
 
diff --git a/collectd/files/collectd.conf b/collectd/files/collectd.conf
index d113f04..03175e2 100644
--- a/collectd/files/collectd.conf
+++ b/collectd/files/collectd.conf
@@ -881,7 +881,7 @@
 {%- if client.file_logging %}
 Include "/etc/collectd/conf.d/00_collectd_logfile.conf"
 {%- endif %}
-{%- for plugin_name, plugin in service_grains.collectd.plugin.iteritems() %}
+{%- for plugin_name, plugin in service_grains.collectd.get('plugin', {}).iteritems() %}
 {%- if (plugin.get('execution', 'local') == 'local' or client.remote_collector) and plugin.get('plugin', 'native') not in ['python'] %}
 Include "{{ client.config_dir }}/{{ plugin_name }}.conf"
 {%- endif %}
diff --git a/collectd/files/collectd_python.conf b/collectd/files/collectd_python.conf
index ad3ad68..a30ee36 100644
--- a/collectd/files/collectd_python.conf
+++ b/collectd/files/collectd_python.conf
@@ -7,11 +7,12 @@
   ModulePath "/usr/lib/collectd-python"
   LogTraces false
   Interactive false
-
+  {%- if plugin is mapping %}
   {%- for plugin_name, plugin in plugin.iteritems() %}
   {%- if (plugin.get('execution', 'local') == 'local' or client.remote_collector) and plugin.get('plugin', 'native') == 'python' %}
   {%- include plugin.template %}
   {%- endif %}
   {%- endfor %}
+  {%- endif %}
 
 </Plugin>