-
-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix formatting in python plugin template #282
Conversation
The failed tests show that the python module should be used with the double quotes included in parameters values:
I think this behavior has changed since version 3.3.0 and it would help if we have a note in the documentation. |
I think collectd configuration syntax hasn't changed. The rspec code (collectd_plugin_python_module_spec.rb) shows configuration similar to the man page example: collectd-python. But there is the missing newlines issue (#281) |
Nope, that wasn't me. The line ending was removed in #267. |
#267 fixed not getting any python based data. It's still happily running in production over here. |
<% end %> | ||
<%- @config.sort.each do |key,value| -%> | ||
<%- if value.is_a?(String) -%> | ||
<%= key %> "<%= value %>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be careful, this doesn't check if string is already quoted. Have a look at the specs.
<%- else -%> | ||
<%= key %> <%= value %> | ||
<%- end -%> | ||
<%- end -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be replaced by <% end %>
if you don't wanna re-introduce #267.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think #267 was caused by a missing newline after </Module>
@arioch sure, but removing line endings after key-value pair ( |
<% end %> | ||
<%- @config.sort.each do |key,value| -%> | ||
<%= key %> <%= value %> | ||
<%- end -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace this by <% end %>
, otherwise there won't be new line between multiple modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested with multiple modules.
It results with config file:
# Generated by Puppet
<Plugin "python">
ModulePath "/usr/lib64/collectd"
LogTraces false
Interactive false
Import "elasticsearch"
<Module "elasticsearch">
Cluster test
Verbose false
Version 1.0
</Module>
Import "rabbitmq"
<Module "rabbitmq">
Host "localhost"
Password "ppp"
Port "15672"
PrefixVhost true
Realm "RabbitMQ Management"
Username "uuu"
</Module>
</Plugin>
I think newlines between modules looks ok here.
It's done with ensure_newline
used in manifests/plugin/python.pp
and #267 fixed missing newline at the end of file: pull/267/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deric when I replace <%- end -%>
by <% end %>
I get extra (not needed) new line before </Module>
and wrong indentation in the <Module>
block:
Notice: /Stage[main]/Collectd::Plugin::Python/Concat[/etc/collectd.d/python-config.conf]/File[/etc/collectd.d/python-config.conf]/content:
--- /etc/collectd.d/python-config.conf 2015-06-30 09:45:40.752012515 +0200
+++ /tmp/puppet-file20150703-10516-16ym6qz-0 2015-07-03 08:50:02.977012923 +0200
@@ -8,19 +8,21 @@
<Module "elasticsearch">
Cluster opslogstash
- Verbose false
- Version 1.0
+ Verbose false
+ Version 1.0
+
</Module>
Import "rabbitmq"
<Module "rabbitmq">
Host "localhost"
- Password "ppp"
- Port "15672"
- PrefixVhost true
- Realm "RabbitMQ Management"
- Username "uuu"
+ Password "ppp"
+ Port "15672"
+ PrefixVhost true
+ Realm "RabbitMQ Management"
+ Username "uuu"
+
</Module>
</Plugin>
Ok, cool. Thanks for debugging this. |
So is this ready to be merged then? |
Yeah, good to merge. I've tested this on a configuration with multiple python modules. Indentation and new lines works fine. Tested on |
Fix formatting in python plugin template
Fix for: #281