neubyr
2011-Oct-17 22:03 UTC
[Puppet Users] setting ACLs using exec resource in Puppet DSL
Hi,
I am trying to set ACLs using exec resource in Puppet DSL as follows:
<pre>
...
...
define :set_acl_userdir do
username = @name
user_dirname = dir + username
user_dirname_default = user_dirname + ''_default''
exec user_dirname_default, :command => ''/usr/bin/setfacl -d -m
m:username:rwx user_dirname''
end
...
...
node ''default'' do
users.each do |u|
mk_userdir u
set_acl_userdir u
end
end
</pre>
I am getting following error when I run this script:
<pre>
Puppet::Parser::Compiler failed with error TypeError: can''t convert
Hash into String on node
</pre>
I am not sure how to use exec in Puppet DSL scripts. Any documentation
or example usage will be really helpful.
thanks,
neuby.r
--
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.
Nan Liu
2011-Oct-17 23:17 UTC
Re: [Puppet Users] setting ACLs using exec resource in Puppet DSL
On Mon, Oct 17, 2011 at 3:03 PM, neubyr <neubyr@gmail.com> wrote:> Hi, > > I am trying to set ACLs using exec resource in Puppet DSL as follows: > > <pre> > ... > ... > define :set_acl_userdir do > username = @name > user_dirname = dir + username > user_dirname_default = user_dirname + ''_default'' > exec user_dirname_default, :command => ''/usr/bin/setfacl -d -m > m:username:rwx user_dirname'' > end > ... > ... > > node ''default'' do > users.each do |u| > mk_userdir u > set_acl_userdir u > end > end > </pre> > > I am getting following error when I run this script: > <pre> > Puppet::Parser::Compiler failed with error TypeError: can''t convert > Hash into String on node > </pre> > > I am not sure how to use exec in Puppet DSL scripts. Any documentation > or example usage will be really helpful.exec have namspace clashing, so you need to use create_resource :exec .... See: http://projects.puppetlabs.com/projects/1/wiki/Ruby_Dsl HTH, Nan -- 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.
jcbollinger
2011-Oct-18 13:09 UTC
[Puppet Users] Re: setting ACLs using exec resource in Puppet DSL
On Oct 17, 5:03 pm, neubyr <neu...@gmail.com> wrote:> Hi, > > I am trying to set ACLs using exec resource in Puppet DSL as follows:No, you''re not. You are trying to set ACLs by using an Exec resource in a *Ruby* Puppet manifest, not one written in Puppet DSL. It''s not obvious to me at the moment why you aren''t, in fact, using the DSL. I recommend that you do, as it leaves rather less room for you to get yourself into trouble, and you''ll probably get better help as well. John -- 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.
neubyr
2011-Oct-18 13:23 UTC
Re: [Puppet Users] setting ACLs using exec resource in Puppet DSL
On Mon, Oct 17, 2011 at 6:17 PM, Nan Liu <nan@puppetlabs.com> wrote:> On Mon, Oct 17, 2011 at 3:03 PM, neubyr <neubyr@gmail.com> wrote: >> Hi, >> >> I am trying to set ACLs using exec resource in Puppet DSL as follows: >> >> <pre> >> ... >> ... >> define :set_acl_userdir do >> username = @name >> user_dirname = dir + username >> user_dirname_default = user_dirname + ''_default'' >> exec user_dirname_default, :command => ''/usr/bin/setfacl -d -m >> m:username:rwx user_dirname'' >> end >> ... >> ... >> >> node ''default'' do >> users.each do |u| >> mk_userdir u >> set_acl_userdir u >> end >> end >> </pre> >> >> I am getting following error when I run this script: >> <pre> >> Puppet::Parser::Compiler failed with error TypeError: can''t convert >> Hash into String on node >> </pre> >> >> I am not sure how to use exec in Puppet DSL scripts. Any documentation >> or example usage will be really helpful. > > exec have namspace clashing, so you need to use create_resource :exec > .... See: http://projects.puppetlabs.com/projects/1/wiki/Ruby_Dsl > > HTH, > > Nan >Thanks for the help Nan. It worked. -- neubyr -- 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.
neubyr
2011-Oct-18 13:28 UTC
Re: [Puppet Users] Re: setting ACLs using exec resource in Puppet DSL
On Tue, Oct 18, 2011 at 8:09 AM, jcbollinger <John.Bollinger@stjude.org> wrote:> > > On Oct 17, 5:03 pm, neubyr <neu...@gmail.com> wrote: >> Hi, >> >> I am trying to set ACLs using exec resource in Puppet DSL as follows: > > > No, you''re not. You are trying to set ACLs by using an Exec resource > in a *Ruby* Puppet manifest, not one written in Puppet DSL. It''s not > obvious to me at the moment why you aren''t, in fact, using the DSL. I > recommend that you do, as it leaves rather less room for you to get > yourself into trouble, and you''ll probably get better help as well. >Sorry for the wrong terminology here. Thanks for correcting it. I am using Ruby DSL. Nan''s suggestion worked for me. I am setting ACLs based on list of users in a group (system''s group database). To iterate over this user list I used Ruby DSL instead of Puppet DSL. -neubyr -- 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.