.Nox
2010-Mar-28 09:09 UTC
[Puppet Users] err: Got an uncaught exception of type ArgumentError: Field ''value'' is required
Hello,
I wrote a custom type for managing sshd configuration file
Type:
=======================================================module Puppet
newtype(:sshd_param) do
@doc = "Manages parameters of sshd"
ensurable
newparam(:name) do
desc "The name of the parameter."
isnamevar
end
newproperty(:target) do
desc "Location of sshd configuration file"
defaultto {
if
@resource.class.defaultprovider.ancestors.include?
Puppet::Provider::ParsedFile
@resource.class.defaultprovider.default_target
else
nil
end
}
end
newparam(:value) do
desc "The value to set"
end
end
end
Provider:
=======================================================require
''puppet/provider/parsedfile''
conf = "/etc/ssh/sshd_config"
Puppet::Type.type(:sshd_param).provide(
:parsed,
:parent => Puppet::Provider::ParsedFile,
:default_target => conf,
:filetype => :flat
) do
confine :exists => conf
text_line :comment,
:match => /^#/
text_line :blank,
:match => /^\s*$/
record_line :parsed,
:fields => %w{name value},
:separator => /\s*\ \s*|#.*|\s*$/,
:joiner => '' ''
end
Define:
=======================================================define
ssh::set_value($value,
$target = "/etc/ssh/sshd_config")
{
include ssh::server
sshd_param
{
$name:
value => $value,
target => $target,
notify => Service[sshd_server],
require => Package[sshd_package]
}
}
Package sshd_package and Service sshd_server are defined in
ssh::server
In manifest file I have:
ssh::set_value
{
"PermitRootLogin":
value => "yes",
target => "/etc/ssh/sshd_config"
}
And at every run I get:
err: Got an uncaught exception of type ArgumentError: Field
''value'' is
required
Does anyone know how to fix this issue ?
OS: RHEL 5.4
PUPPET_VER: 0.25.4
PUPPET_MASTER_VER: 0.25.4
Thank you.
--
Maxim Ianoglo
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Dan Bode
2010-Mar-29 17:04 UTC
Re: [Puppet Users] err: Got an uncaught exception of type ArgumentError: Field ''value'' is required
On Sun, Mar 28, 2010 at 2:09 AM, .Nox <dotnox@gmail.com> wrote:> Hello, > > I wrote a custom type for managing sshd configuration file > > Type: > =======================================================> module Puppet > newtype(:sshd_param) do > @doc = "Manages parameters of sshd" > > ensurable > > newparam(:name) do > desc "The name of the parameter." > isnamevar > end > > newproperty(:target) do > desc "Location of sshd configuration file" > > defaultto { > if > @resource.class.defaultprovider.ancestors.include? > Puppet::Provider::ParsedFile > @resource.class.defaultprovider.default_target > else > nil > end > } > end > > newparam(:value) do > desc "The value to set" > end > end > end > > > > Provider: > =======================================================> require ''puppet/provider/parsedfile'' > > conf = "/etc/ssh/sshd_config" > > Puppet::Type.type(:sshd_param).provide( > :parsed, > :parent => Puppet::Provider::ParsedFile, > :default_target => conf, > :filetype => :flat > ) do > > confine :exists => conf > > text_line :comment, > :match => /^#/ > text_line :blank, > :match => /^\s*$/ > record_line :parsed, > :fields => %w{name value}, > :separator => /\s*\ \s*|#.*|\s*$/, > :joiner => '' '' > end > > Define: > =======================================================> define ssh::set_value($value, > $target = "/etc/ssh/sshd_config") > { > include ssh::server > > sshd_param > { > $name: > value => $value, > target => $target, > notify => Service[sshd_server], > require => Package[sshd_package] > } > } > > Package sshd_package and Service sshd_server are defined in > ssh::server > > In manifest file I have: > ssh::set_value > { > "PermitRootLogin": > value => "yes", > target => "/etc/ssh/sshd_config" > } > > > And at every run I get: > err: Got an uncaught exception of type ArgumentError: Field ''value'' is > required >can you reproduce with with --trace.> Does anyone know how to fix this issue ? > > OS: RHEL 5.4 > PUPPET_VER: 0.25.4 > PUPPET_MASTER_VER: 0.25.4 > > Thank you. > -- > Maxim Ianoglo > > -- > 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+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
.Nox
2010-Mar-29 18:36 UTC
[Puppet Users] Re: err: Got an uncaught exception of type ArgumentError: Field ''value'' is required
Hello, [root@vps1 ~]$ puppetd --server test --waitforcert 60 --test --trace info: Retrieving plugin warning: newstate() has been deprecrated; use newproperty(value) info: Caching catalog for vps1.srv171.rackco.com info: Applying configuration version ''1269887449'' notice: //r::ssh/Ssh::Set_value[PermitRootLogin]/ Sshd_param[PermitRootLogin]/ensure: created /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:95:in `join'' /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:89:in `collect'' /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:89:in `join'' /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:341:in `to_line'' /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in `to_file'' /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in `collect'' /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in `to_file'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:316:in `to_file'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:102:in `flush_target'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:74:in `flush'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in `each'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in `flush'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:356:in `flush'' /usr/lib/ruby/site_ruby/1.8/puppet/type.rb:752:in `flush'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:94:in `apply'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:251:in `eval_children_and_apply_resource'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:250:in `eval_children_and_apply_resource'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:207:in `eval_resource'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:296:in `evaluate'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:295:in `evaluate'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in `collect'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in `evaluate'' /usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:142:in `apply'' /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:169:in `run'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:178:in `benchmark'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:177:in `benchmark'' /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:168:in `run'' /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'' /usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in `lock'' /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'' /usr/lib/ruby/1.8/sync.rb:229:in `synchronize'' /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'' /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:134:in `with_client'' /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:51:in `run'' /usr/lib/ruby/site_ruby/1.8/puppet/application/puppetd.rb:103:in `onetime'' /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `send'' /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `run_command'' /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'' /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:306:in `exit_on_fail'' /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'' /usr/sbin/puppetd:159 err: Got an uncaught exception of type ArgumentError: Field ''value'' is required warning: Value of ''preferred_serialization_format'' (pson) is invalid for report, using default (marshal) notice: Finished catalog run in 3.01 seconds Thank you. -- Maxim Ianoglo On Mar 29, 8:04 pm, Dan Bode <d...@reductivelabs.com> wrote:> On Sun, Mar 28, 2010 at 2:09 AM, .Nox <dot...@gmail.com> wrote: > > Hello, > > > I wrote a custom type for managing sshd configuration file > > > Type: > > =======================================================> > module Puppet > > newtype(:sshd_param) do > > @doc = "Manages parameters of sshd" > > > ensurable > > > newparam(:name) do > > desc "The name of the parameter." > > isnamevar > > end > > > newproperty(:target) do > > desc "Location of sshd configuration file" > > > defaultto { > > if > > @resource.class.defaultprovider.ancestors.include? > > Puppet::Provider::ParsedFile > > @resource.class.defaultprovider.default_target > > else > > nil > > end > > } > > end > > > newparam(:value) do > > desc "The value to set" > > end > > end > > end > > > Provider: > > =======================================================> > require ''puppet/provider/parsedfile'' > > > conf = "/etc/ssh/sshd_config" > > > Puppet::Type.type(:sshd_param).provide( > > :parsed, > > :parent => Puppet::Provider::ParsedFile, > > :default_target => conf, > > :filetype => :flat > > ) do > > > confine :exists => conf > > > text_line :comment, > > :match => /^#/ > > text_line :blank, > > :match => /^\s*$/ > > record_line :parsed, > > :fields => %w{name value}, > > :separator => /\s*\ \s*|#.*|\s*$/, > > :joiner => '' '' > > end > > > Define: > > =======================================================> > define ssh::set_value($value, > > $target = "/etc/ssh/sshd_config") > > { > > include ssh::server > > > sshd_param > > { > > $name: > > value => $value, > > target => $target, > > notify => Service[sshd_server], > > require => Package[sshd_package] > > } > > } > > > Package sshd_package and Service sshd_server are defined in > > ssh::server > > > In manifest file I have: > > ssh::set_value > > { > > "PermitRootLogin": > > value => "yes", > > target => "/etc/ssh/sshd_config" > > } > > > And at every run I get: > > err: Got an uncaught exception of type ArgumentError: Field ''value'' is > > required > > can you reproduce with with --trace. > > > Does anyone know how to fix this issue ? > > > OS: RHEL 5.4 > > PUPPET_VER: 0.25.4 > > PUPPET_MASTER_VER: 0.25.4 > > > Thank you. > > -- > > Maxim Ianoglo > > > -- > > 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+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Dan Bode
2010-Mar-29 18:54 UTC
Re: [Puppet Users] Re: err: Got an uncaught exception of type ArgumentError: Field ''value'' is required
I just saw the mistake.
The fields for parsedfile need to be properties, not parameters.
change
newparam(:value) do
desc "The value to set"
end
to
newproperty(:value) do
desc "The value to set"
end
and it should work.
On Mon, Mar 29, 2010 at 11:36 AM, .Nox <dotnox@gmail.com> wrote:
> Hello,
>
> [root@vps1 ~]$ puppetd --server test --waitforcert 60 --test --trace
> info: Retrieving plugin
> warning: newstate() has been deprecrated; use newproperty(value)
> info: Caching catalog for vps1.srv171.rackco.com
> info: Applying configuration version ''1269887449''
> notice: //r::ssh/Ssh::Set_value[PermitRootLogin]/
> Sshd_param[PermitRootLogin]/ensure: created
> /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:95:in
`join''
> /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:89:in
`collect''
> /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:89:in
`join''
> /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:341:in
> `to_line''
> /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in
> `to_file''
> /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in
> `collect''
> /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in
> `to_file''
> /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:316:in
> `to_file''
> /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:102:in
> `flush_target''
> /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:74:in
> `flush''
> /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in
`each''
> /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in
> `flush''
> /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:356:in
> `flush''
> /usr/lib/ruby/site_ruby/1.8/puppet/type.rb:752:in `flush''
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:94:in `apply''
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:251:in
> `eval_children_and_apply_resource''
> /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark''
> /usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
> /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime''
> /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark''
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:250:in
> `eval_children_and_apply_resource''
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:207:in
> `eval_resource''
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:296:in
`evaluate''
> /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark''
> /usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
> /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime''
> /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark''
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:295:in
`evaluate''
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in `collect''
> /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in
`evaluate''
> /usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:142:in
`apply''
> /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:169:in `run''
> /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:178:in `benchmark''
> /usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
> /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime''
> /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:177:in `benchmark''
> /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:168:in `run''
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run''
> /usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in `lock''
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run''
> /usr/lib/ruby/1.8/sync.rb:229:in `synchronize''
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run''
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:134:in `with_client''
> /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:51:in `run''
> /usr/lib/ruby/site_ruby/1.8/puppet/application/puppetd.rb:103:in
> `onetime''
> /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `send''
> /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in
`run_command''
> /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run''
> /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:306:in
> `exit_on_fail''
> /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run''
> /usr/sbin/puppetd:159
> err: Got an uncaught exception of type ArgumentError: Field
''value'' is
> required
> warning: Value of ''preferred_serialization_format'' (pson)
is invalid
> for report, using default (marshal)
> notice: Finished catalog run in 3.01 seconds
>
> Thank you.
> --
> Maxim Ianoglo
>
> On Mar 29, 8:04 pm, Dan Bode <d...@reductivelabs.com> wrote:
> > On Sun, Mar 28, 2010 at 2:09 AM, .Nox <dot...@gmail.com> wrote:
> > > Hello,
> >
> > > I wrote a custom type for managing sshd configuration file
> >
> > > Type:
> > > =======================================================> >
> module Puppet
> > > newtype(:sshd_param) do
> > > @doc = "Manages parameters of sshd"
> >
> > > ensurable
> >
> > > newparam(:name) do
> > > desc "The name of the parameter."
> > > isnamevar
> > > end
> >
> > > newproperty(:target) do
> > > desc "Location of sshd configuration file"
> >
> > > defaultto {
> > > if
> > >
@resource.class.defaultprovider.ancestors.include?
> > > Puppet::Provider::ParsedFile
> > > @resource.class.defaultprovider.default_target
> > > else
> > > nil
> > > end
> > > }
> > > end
> >
> > > newparam(:value) do
> > > desc "The value to set"
> > > end
> > > end
> > > end
> >
> > > Provider:
> > > =======================================================> >
> require ''puppet/provider/parsedfile''
> >
> > > conf = "/etc/ssh/sshd_config"
> >
> > > Puppet::Type.type(:sshd_param).provide(
> > > :parsed,
> > > :parent => Puppet::Provider::ParsedFile,
> > > :default_target => conf,
> > > :filetype => :flat
> > > ) do
> >
> > > confine :exists => conf
> >
> > > text_line :comment,
> > > :match => /^#/
> > > text_line :blank,
> > > :match => /^\s*$/
> > > record_line :parsed,
> > > :fields => %w{name value},
> > > :separator => /\s*\ \s*|#.*|\s*$/,
> > > :joiner => '' ''
> > > end
> >
> > > Define:
> > > =======================================================> >
> define ssh::set_value($value,
> > > $target = "/etc/ssh/sshd_config")
> > > {
> > > include ssh::server
> >
> > > sshd_param
> > > {
> > > $name:
> > > value => $value,
> > > target => $target,
> > > notify => Service[sshd_server],
> > > require => Package[sshd_package]
> > > }
> > > }
> >
> > > Package sshd_package and Service sshd_server are defined in
> > > ssh::server
> >
> > > In manifest file I have:
> > > ssh::set_value
> > > {
> > > "PermitRootLogin":
> > > value => "yes",
> > > target => "/etc/ssh/sshd_config"
> > > }
> >
> > > And at every run I get:
> > > err: Got an uncaught exception of type ArgumentError: Field
''value'' is
> > > required
> >
> > can you reproduce with with --trace.
> >
> > > Does anyone know how to fix this issue ?
> >
> > > OS: RHEL 5.4
> > > PUPPET_VER: 0.25.4
> > > PUPPET_MASTER_VER: 0.25.4
> >
> > > Thank you.
> > > --
> > > Maxim Ianoglo
> >
> > > --
> > > 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+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com>
>
<puppet-users%2Bunsubscribe@googlegroups.com<puppet-users%252Bunsubscribe@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+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
.Nox
2010-Mar-29 21:16 UTC
[Puppet Users] Re: err: Got an uncaught exception of type ArgumentError: Field ''value'' is required
Changed. Same error.
But if I add
:optional => %w{value}
into record_line this seems to fix the issue - and seems to work and I
am not really sure why because I did not find anywhere a complete
documentation on parsed file ( May be someone know where to get it -
without reading sources)
Thank you.
--
Maxim Ianoglo
On Mar 29, 9:54 pm, Dan Bode <d...@reductivelabs.com>
wrote:> I just saw the mistake.
>
> The fields for parsedfile need to be properties, not parameters.
>
> change
>
> newparam(:value) do
> desc "The value to set"
> end
>
> to
>
> newproperty(:value) do
> desc "The value to set"
> end
>
> and it should work.
>
> On Mon, Mar 29, 2010 at 11:36 AM, .Nox <dot...@gmail.com> wrote:
> > Hello,
>
> > [root@vps1 ~]$ puppetd --server test --waitforcert 60 --test --trace
> > info: Retrieving plugin
> > warning: newstate() has been deprecrated; use newproperty(value)
> > info: Caching catalog for vps1.srv171.rackco.com
> > info: Applying configuration version ''1269887449''
> > notice: //r::ssh/Ssh::Set_value[PermitRootLogin]/
> > Sshd_param[PermitRootLogin]/ensure: created
> > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:95:in
`join''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:89:in
`collect''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:89:in
`join''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:341:in
> > `to_line''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in
> > `to_file''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in
> > `collect''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in
> > `to_file''
> > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:316:in
> > `to_file''
> > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:102:in
> > `flush_target''
> > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:74:in
> > `flush''
> > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in
`each''
> > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in
> > `flush''
> > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:356:in
> > `flush''
> > /usr/lib/ruby/site_ruby/1.8/puppet/type.rb:752:in `flush''
> > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:94:in
`apply''
> > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:251:in
> > `eval_children_and_apply_resource''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark''
> > /usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
> > /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark''
> > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:250:in
> > `eval_children_and_apply_resource''
> > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:207:in
> > `eval_resource''
> > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:296:in
`evaluate''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark''
> > /usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
> > /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark''
> > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:295:in
`evaluate''
> > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in
`collect''
> > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in
`evaluate''
> > /usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:142:in
`apply''
> > /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:169:in `run''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:178:in `benchmark''
> > /usr/lib/ruby/1.8/benchmark.rb:293:in `measure''
> > /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime''
> > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:177:in `benchmark''
> > /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:168:in `run''
> > /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run''
> > /usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in
`lock''
> > /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run''
> > /usr/lib/ruby/1.8/sync.rb:229:in `synchronize''
> > /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run''
> > /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:134:in
`with_client''
> > /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:51:in `run''
> > /usr/lib/ruby/site_ruby/1.8/puppet/application/puppetd.rb:103:in
> > `onetime''
> > /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in
`send''
> > /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in
`run_command''
> > /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in
`run''
> > /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:306:in
> > `exit_on_fail''
> > /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in
`run''
> > /usr/sbin/puppetd:159
> > err: Got an uncaught exception of type ArgumentError: Field
''value'' is
> > required
> > warning: Value of ''preferred_serialization_format''
(pson) is invalid
> > for report, using default (marshal)
> > notice: Finished catalog run in 3.01 seconds
>
> > Thank you.
> > --
> > Maxim Ianoglo
>
> > On Mar 29, 8:04 pm, Dan Bode <d...@reductivelabs.com> wrote:
> > > On Sun, Mar 28, 2010 at 2:09 AM, .Nox <dot...@gmail.com>
wrote:
> > > > Hello,
>
> > > > I wrote a custom type for managing sshd configuration file
>
> > > > Type:
> > > > =======================================================>
> > > module Puppet
> > > > newtype(:sshd_param) do
> > > > @doc = "Manages parameters of sshd"
>
> > > > ensurable
>
> > > > newparam(:name) do
> > > > desc "The name of the parameter."
> > > > isnamevar
> > > > end
>
> > > > newproperty(:target) do
> > > > desc "Location of sshd configuration
file"
>
> > > > defaultto {
> > > > if
> > > >
@resource.class.defaultprovider.ancestors.include?
> > > > Puppet::Provider::ParsedFile
> > > >
@resource.class.defaultprovider.default_target
> > > > else
> > > > nil
> > > > end
> > > > }
> > > > end
>
> > > > newparam(:value) do
> > > > desc "The value to set"
> > > > end
> > > > end
> > > > end
>
> > > > Provider:
> > > > =======================================================>
> > > require ''puppet/provider/parsedfile''
>
> > > > conf = "/etc/ssh/sshd_config"
>
> > > > Puppet::Type.type(:sshd_param).provide(
> > > > :parsed,
> > > > :parent => Puppet::Provider::ParsedFile,
> > > > :default_target => conf,
> > > > :filetype => :flat
> > > > ) do
>
> > > > confine :exists => conf
>
> > > > text_line :comment,
> > > > :match => /^#/
> > > > text_line :blank,
> > > > :match => /^\s*$/
> > > > record_line :parsed,
> > > > :fields => %w{name value},
> > > > :separator => /\s*\ \s*|#.*|\s*$/,
> > > > :joiner => '' ''
> > > > end
>
> > > > Define:
> > > > =======================================================>
> > > define ssh::set_value($value,
> > > > $target =
"/etc/ssh/sshd_config")
> > > > {
> > > > include ssh::server
>
> > > > sshd_param
> > > > {
> > > > $name:
> > > > value => $value,
> > > > target => $target,
> > > > notify => Service[sshd_server],
> > > > require => Package[sshd_package]
> > > > }
> > > > }
>
> > > > Package sshd_package and Service sshd_server are defined in
> > > > ssh::server
>
> > > > In manifest file I have:
> > > > ssh::set_value
> > > > {
> > > > "PermitRootLogin":
> > > > value => "yes",
> > > > target => "/etc/ssh/sshd_config"
> > > > }
>
> > > > And at every run I get:
> > > > err: Got an uncaught exception of type ArgumentError: Field
''value'' is
> > > > required
>
> > > can you reproduce with with --trace.
>
> > > > Does anyone know how to fix this issue ?
>
> > > > OS: RHEL 5.4
> > > > PUPPET_VER: 0.25.4
> > > > PUPPET_MASTER_VER: 0.25.4
>
> > > > Thank you.
> > > > --
> > > > Maxim Ianoglo
>
> > > > --
> > > > 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+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com>
> >
<puppet-users%2Bunsubscribe@googlegroups.com<puppet-users%252Bunsubscribe@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+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Dan Bode
2010-Mar-30 17:46 UTC
Re: [Puppet Users] Re: err: Got an uncaught exception of type ArgumentError: Field ''value'' is required
On Mon, Mar 29, 2010 at 2:16 PM, .Nox <dotnox@gmail.com> wrote:> Changed. Same error. > > But if I add > :optional => %w{value} > into record_line this seems to fix the issue - and seems to work and I > am not really sure why because I did not find anywhere a complete > documentation on parsed file ( May be someone know where to get it - > without reading sources) >its not really something that we have documented yet. The only way to really understand it in detail is to read parsedfile.rb, fileparsing.rb and by reading provider examples. James has a good blog entry for getting started: http://www.kartar.net/2010/02/puppet-parsedfile-types-and-providers/> > Thank you. > -- > Maxim Ianoglo > > On Mar 29, 9:54 pm, Dan Bode <d...@reductivelabs.com> wrote: > > I just saw the mistake. > > > > The fields for parsedfile need to be properties, not parameters. > > > > change > > > > newparam(:value) do > > desc "The value to set" > > end > > > > to > > > > newproperty(:value) do > > desc "The value to set" > > end > > > > and it should work. > > > > On Mon, Mar 29, 2010 at 11:36 AM, .Nox <dot...@gmail.com> wrote: > > > Hello, > > > > > [root@vps1 ~]$ puppetd --server test --waitforcert 60 --test --trace > > > info: Retrieving plugin > > > warning: newstate() has been deprecrated; use newproperty(value) > > > info: Caching catalog for vps1.srv171.rackco.com > > > info: Applying configuration version ''1269887449'' > > > notice: //r::ssh/Ssh::Set_value[PermitRootLogin]/ > > > Sshd_param[PermitRootLogin]/ensure: created > > > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:95:in `join'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:89:in `collect'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:89:in `join'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:341:in > > > `to_line'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in > > > `to_file'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in > > > `collect'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:314:in > > > `to_file'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:316:in > > > `to_file'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:102:in > > > `flush_target'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:74:in > > > `flush'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in `each'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:72:in > > > `flush'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb:356:in > > > `flush'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/type.rb:752:in `flush'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:94:in `apply'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:251:in > > > `eval_children_and_apply_resource'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark'' > > > /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' > > > /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:250:in > > > `eval_children_and_apply_resource'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:207:in > > > `eval_resource'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:296:in `evaluate'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark'' > > > /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' > > > /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:295:in `evaluate'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in `collect'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in `evaluate'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:142:in `apply'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:169:in `run'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:178:in `benchmark'' > > > /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' > > > /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:177:in `benchmark'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:168:in `run'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in `lock'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'' > > > /usr/lib/ruby/1.8/sync.rb:229:in `synchronize'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:134:in `with_client'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:51:in `run'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/application/puppetd.rb:103:in > > > `onetime'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `send'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `run_command'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:306:in > > > `exit_on_fail'' > > > /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'' > > > /usr/sbin/puppetd:159 > > > err: Got an uncaught exception of type ArgumentError: Field ''value'' is > > > required > > > warning: Value of ''preferred_serialization_format'' (pson) is invalid > > > for report, using default (marshal) > > > notice: Finished catalog run in 3.01 seconds > > > > > Thank you. > > > -- > > > Maxim Ianoglo > > > > > On Mar 29, 8:04 pm, Dan Bode <d...@reductivelabs.com> wrote: > > > > On Sun, Mar 28, 2010 at 2:09 AM, .Nox <dot...@gmail.com> wrote: > > > > > Hello, > > > > > > > I wrote a custom type for managing sshd configuration file > > > > > > > Type: > > > > > =======================================================> > > > > module Puppet > > > > > newtype(:sshd_param) do > > > > > @doc = "Manages parameters of sshd" > > > > > > > ensurable > > > > > > > newparam(:name) do > > > > > desc "The name of the parameter." > > > > > isnamevar > > > > > end > > > > > > > newproperty(:target) do > > > > > desc "Location of sshd configuration file" > > > > > > > defaultto { > > > > > if > > > > > > @resource.class.defaultprovider.ancestors.include? > > > > > Puppet::Provider::ParsedFile > > > > > @resource.class.defaultprovider.default_target > > > > > else > > > > > nil > > > > > end > > > > > } > > > > > end > > > > > > > newparam(:value) do > > > > > desc "The value to set" > > > > > end > > > > > end > > > > > end > > > > > > > Provider: > > > > > =======================================================> > > > > require ''puppet/provider/parsedfile'' > > > > > > > conf = "/etc/ssh/sshd_config" > > > > > > > Puppet::Type.type(:sshd_param).provide( > > > > > :parsed, > > > > > :parent => Puppet::Provider::ParsedFile, > > > > > :default_target => conf, > > > > > :filetype => :flat > > > > > ) do > > > > > > > confine :exists => conf > > > > > > > text_line :comment, > > > > > :match => /^#/ > > > > > text_line :blank, > > > > > :match => /^\s*$/ > > > > > record_line :parsed, > > > > > :fields => %w{name value}, > > > > > :separator => /\s*\ \s*|#.*|\s*$/, > > > > > :joiner => '' '' > > > > > end > > > > > > > Define: > > > > > =======================================================> > > > > define ssh::set_value($value, > > > > > $target = "/etc/ssh/sshd_config") > > > > > { > > > > > include ssh::server > > > > > > > sshd_param > > > > > { > > > > > $name: > > > > > value => $value, > > > > > target => $target, > > > > > notify => Service[sshd_server], > > > > > require => Package[sshd_package] > > > > > } > > > > > } > > > > > > > Package sshd_package and Service sshd_server are defined in > > > > > ssh::server > > > > > > > In manifest file I have: > > > > > ssh::set_value > > > > > { > > > > > "PermitRootLogin": > > > > > value => "yes", > > > > > target => "/etc/ssh/sshd_config" > > > > > } > > > > > > > And at every run I get: > > > > > err: Got an uncaught exception of type ArgumentError: Field ''value'' > is > > > > > required > > > > > > can you reproduce with with --trace. > > > > > > > Does anyone know how to fix this issue ? > > > > > > > OS: RHEL 5.4 > > > > > PUPPET_VER: 0.25.4 > > > > > PUPPET_MASTER_VER: 0.25.4 > > > > > > > Thank you. > > > > > -- > > > > > Maxim Ianoglo > > > > > > > -- > > > > > 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+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > <puppet-users%2Bunsubscribe@googlegroups.com<puppet-users%252Bunsubscribe@googlegroups.com> > > > > > <puppet-users%2Bunsubscribe@googlegroups.com<puppet-users%252Bunsubscribe@googlegroups.com> > <puppet-users%252Bunsubscribe@googlegroups.com<puppet-users%25252Bunsubscribe@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+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > <puppet-users%2Bunsubscribe@googlegroups.com<puppet-users%252Bunsubscribe@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+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.