| From | Sent On | Attachments |
|---|---|---|
| Paul Lathrop | Apr 19, 2010 4:25 pm | |
| Luke Kanies | Apr 21, 2010 9:50 am |
| Subject: | [Puppet-dev] sysctl type/provider | |
|---|---|---|
| From: | Paul Lathrop (pa...@tertiusfamily.net) | |
| Date: | Apr 19, 2010 4:25:56 pm | |
| List: | com.googlegroups.puppet-dev | |
Hey all,
I'm not sure where I originally snagged this sysctl type/provider, but we were using it w/o problems until we upgraded to 0.25.x and I'm having trouble debugging the issue. The error we're getting is:
Apr 19 15:46:19 s0005 puppetmasterd[21382]: (//digg-cassandra/Sysctl[net.ipv4.tcp_max_syn_backlog]) Failed to retrieve current state of resource: No ability to determine if sysctl exists
Which Luke and James both suggested (in IRC) indicates a missing 'exists?' method, but this type descends from ParsedFile; other examples don't define their own 'exists?' method either (see the cron type/provider for example).
Any ideas would be appreciated.
#### modules/sysctl/plugins/puppet/type/sysctl.rb module Puppet newtype(:sysctl) do
@doc = "Manages kernel parameters in /etc/sysctl.conf. By default this will only edit the configuration file, and not change any of the runtime values. If you wish changes to be activated right away, you can do so with an exec like so:
exec { load-sysctl: command => \"/sbin/sysctl -p /etc/sysctl.conf\", refreshonly => true }
Set any changes you want to happen right away to notify this command, or you can set it as the default:
Sysctl { notify => Exec[load-sysctl] }"
ensurable
newparam(:name, :namevar => true) do desc "Name of the parameter" isnamevar end
newproperty(:val) do desc "Value the parameter should be set to" end
newproperty(:target) do desc "Name of the file to store parameters in" defaultto { if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile) @resource.class.defaultprovider.default_target else nil end } end end end
##### modules/sysctl/plugins/puppet/provider/sysctl/parsed.rb require 'puppet/provider/parsedfile'
sysctlconf = "/etc/sysctl.conf"
Puppet::Type.type(:sysctl).provide(:parsed, :parent => Puppet::Provider::ParsedFile, :default_target => sysctlconf, :filetype => :flat ) do
confine :exists => sysctlconf text_line :comment, :match => /^\s*#/; text_line :blank, :match => /^\s*$/;
record_line :parsed, :fields => %w{name val}, :joiner => ' = ', :separator => /\s*=\s*/
end
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to pupp...@googlegroups.com.
To unsubscribe from this group, send email to
puppet-dev+unsu...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.





