On 11/17/15 11:08 AM, tobias.ko...@gmail.com wrote: > Hi, > > I got a file resource > > file {'/usr/java/jboss-as/server/somesoftware/deploy/jontram-ds.xml': > ensure => file, > owner => 'root', > group => 'root', > mode => '0655', > content => template('somesoftware/jboss/jontram-ds.xml.erb'), > require => [ Class['somesoftware::cpfiles'], > somesoftware::mariadb::createdb [ $db_name ] ], > } > > The second last line is obviously to long (over 80 lines). It works in > one line but I get a puppet-lint error. I would like to cut it it two. > My first thought was to use the '\' > > like > require => [ Class['somesoftware::cpfiles'],\ > somesoftware::mariadb::createdb [ $db_name ] > } > > but then I get an error > > Error: Could not retrieve catalog from remote server: Error 400 on > SERVER: Syntax error at '\'; expected ']' at ... > > It works if I just press enter at the end of the line and write the rest > on the next line (without the \). > > So I wonder is it right to not use \ for line wrapping? If yes where can > I find documentation about that behavior? >
Hi Tobias, Somehow line length was added to the style guide, though Puppet does not provide a mechanism, such as `\` to denote line wrapping. While not having huge lines is a good idea, adhering to an arbitrary limit without the ability to wrap to the next line is not. Suggest turning it off. In fact, we disable it by default[1] when creating new modules. You can limit the length of your require like this file { '/usr/java/jboss-as/server/somesoftware/deploy/jontram-ds.xml': ensure => file, owner => 'root', group => 'root', mode => '0655', content => template('somesoftware/jboss/jontram-ds.xml.erb'), require => [Class['somesoftware::cpfiles'], Somesoftware::Mariadb::Createdb[$db_name], ], } In general, putting elements of an array on multiple lines helps readability, especially when reviewing diffs. [1] - https://github.com/puppetlabs/puppet/blob/1a557254012447a4f0a2e01eeebaf52c75ab6f80/lib/puppet/module_tool/skeleton/templates/generator/Rakefile#L3 Best regards, -g -- Garrett Honeycutt @learnpuppet Puppet Training with LearnPuppet.com Mobile: +1.206.414.8658 -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/564B817F.4060907%40garretthoneycutt.com. For more options, visit https://groups.google.com/d/optout.