Reduce Duplicated File Attributes failure

120 views
Skip to first unread message

Paolo Supino

unread,
Jul 2, 2014, 3:05:55 PM7/2/14
to puppet...@googlegroups.com
Hi 

I'm trying to follow the process described in the link: http://www.puppetcookbook.com/posts/remove-duplicated-file-resource-attributes.html in a Puppet 2.7.x (x == 23 or 25) to try and reduce carpal tunnel syndrome... ;-) 

but when I run puppet I get the following error: "err: Could not parse for environment production: All resource specifications require names; expected '%s' at init.pp:13" ...

Line 13 is the closing curly brace for the block (numbers on the left are the line numbers as they appear in the editor): 

  8   file {
  9     ensure  => 'present',
 10     owner   => 'jboss',
 11     group   => 'jboss',
 12     mode    => '0775',
 13   }

Can this be done with Puppet 2.7.x (I don't know for what version puppet cookbook was written (the original one)








TIA,
Paolo 



Matthew Hyclak

unread,
Jul 2, 2014, 3:08:48 PM7/2/14
to puppet...@googlegroups.com
You need to tell puppet what file you would like those attributes set. Probably

file {
  '/etc/jboss.conf':
    ensure => 'present',
    owner  => 'jboss',
    group   => 'jboss',
    mode   => '0755'.
}

which would create a blank file at /etc/jboss.conf.

If you need to control the contents of the file, you would need a source or content parameter.

Matt


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CA%2BB25By4_KvX5s61N8G%3D3qLsH_3ZApYGSgbpkKP3f5qD2qe9ag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Martin Alfke

unread,
Jul 2, 2014, 6:39:47 PM7/2/14
to puppet...@googlegroups.com
Hi,

you want to use file resource defaults for code de-deplucation.
resource defaults are references and the resource type starts with a capital letter.

You want:

File {
ensure => ‘file’,
owner => ….,

}

Please always use ensure => file and not ensure => present.
The first one is more clear.

hth,

Martin

Paolo Supino

unread,
Jul 4, 2014, 8:08:09 AM7/4/14
to puppet...@googlegroups.com
Hi Martin 

I opted to write it instead of using copy and paste and missed the letter capitalization :(
thanx for the 'ensure' tip... 






Paolo 


On Wed, Jul 2, 2014 at 8:39 PM, Martin Alfke <tux...@gmail.com> wrote:
Hi,

you want to use file resource defaults for code de-deplucation.
resource defaults are references and the resource type starts with a capital letter.

You want:

File {
   ensure => 'file',
   owner => ....,
   ...
Reply all
Reply to author
Forward
0 new messages