This works also :

content => inline_template("<%= Hash[scope.to_hash.reject { |k,v| k.to_s
=~ /(uptime|timestamp|memory|free|swap)/ }.sort].to_yaml %>")

It does not sort but keep the fact list in the same order.

Louis Coilliot

Le 14/12/2012 03:05, Zane Williamson a écrit :
> Well I think I came up with a decent hack.
>
> content  => inline_template("<%= scope.to_hash.reject { |k,v| k.to_s
> =~ /(uptime_seconds|uptime_hours|timestamp|free)/ }.to_yaml.sort {
> |a,b| b <=> a} %>")
>
> the sort and then inverse (to make sure the "---/n" is on top for the
> fact file format) seems to stop to_yaml from adding spaces.
>
> On Thursday, December 13, 2012 5:06:54 PM UTC-8, Zane Williamson wrote:
>
>     Has anyone else ran into this?
>
>     debug: /Stage[main]/Mcollective/File[/var/tmp/facts.yaml]/content:
>     Executing 'diff -u /var/tmp/facts.yaml
>     /tmp/puppet-file20121214-13448-933j3r-0'
>     notice: /Stage[main]/Mcollective/File[/var/tmp/facts.yaml]/content: 
>     --- /var/tmp/facts.yaml2012-12-14 00:53:20.000000000 +0000
>     +++ /tmp/puppet-file20121214-13448-933j3r-02012-12-14
>     00:55:35.000000000 +0000
>     @@ -93,13 +93,13 @@
>        architecture: *id002
>        processor14: Intel(R) Xeon(R) CPU E5-2420 0 @ 1.90GHz
>     -  type: Rack Mount Chassis
>        processor20: Intel(R) Xeon(R) CPU E5-2420 0 @ 1.90GHz
>     +  type: Rack Mount Chassis
>        domain: mochimedia.net <http://mochimedia.net>
>        timezone: UTC
>        title: mcollective
>     -  diskdrives: sda
>     +  diskdrives: sda
>        ipaddress_eth1: 10.0.8.71
>        processor8: Intel(R) Xeon(R) CPU E5-2420 0 @ 1.90GHz
>        processor11: Intel(R) Xeon(R) CPU E5-2420 0 @ 1.90GHz
>
>     When Puppet comparse the /var/tmp/facts.yaml file to the file in
>     the Filebucket it adds some replaces some entries with an extra
>     space.  It appears to add a couple different entries each run.  
>
>     Here is the file resource --
>
>      "/var/tmp/facts.yaml":
>           owner    => root,
>           group    => root,
>           mode     => 400,
>           loglevel => debug,
>           content  => inline_template("<%= scope.to_hash.reject {
>     |k,v| k.to_s =~ /(uptime_seconds|uptime_hours|timestamp|free)/
>     }.to_yaml %>")
>
>     Any thoughts or suggestions?  Seems like an odd one to me.
>
>     -Z
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/eE8sQojblMUJ.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to